:root {
  --glass-bg: rgba(15, 23, 42, 0.5);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-blur: blur(20px);
  --glow-color: rgba(14, 165, 233, 0.15);
  --accent-glow: rgba(99, 102, 241, 0.15);
  --card-hover-bg: rgba(30, 41, 59, 0.8);
  --primary-color: #0ea5e9;
  --primary-hover: #0284c7;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}
body {
  background: fixed #020617;
  background-image:
    radial-gradient(
      circle at 15% 50%,
      rgba(14, 165, 233, 0.03),
      transparent 40%
    ),
    radial-gradient(
      circle at 85% 30%,
      rgba(99, 102, 241, 0.03),
      transparent 40%
    ),
    linear-gradient(180deg, #020617 0, #0f172a 100%);
  color: var(--text-main);
  font-family:
    Tajawal,
    system-ui,
    -apple-system,
    sans-serif;
}
.books-wrap {
  position: relative;
  display: grid;
  gap: 40px;
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 60px 0 100px;
}
.books-wrap::before {
  content: "";
  position: absolute;
  inset: -50px 0 auto;
  height: 500px;
  background: radial-gradient(
    ellipse at 50% 0,
    rgba(14, 165, 233, 0.08),
    transparent 60%
  );
  pointer-events: none;
  z-index: 0;
  filter: blur(60px);
}
.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 20px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.3px;
  transition: 0.2s;
  color: var(--primary-color);
  background: rgba(14, 165, 233, 0.05);
  border: 1px solid rgba(14, 165, 233, 0.2);
}
.topbar-link--ghost {
  color: var(--text-muted);
  background: 0 0;
  border-color: rgba(255, 255, 255, 0.1);
}
.topbar-link:focus-visible,
.topbar-link:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 165, 233, 0.4);
  background: rgba(14, 165, 233, 0.1);
  color: #fff;
}
.topbar-link--primary {
  color: #fff;
  background: var(--primary-color);
  border: none;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}
.topbar-link--primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.3);
  transform: translateY(-2px);
}
.books-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 48px;
  align-items: center;
  padding: 64px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.6) 0,
    rgba(2, 6, 23, 0.8) 100%
  );
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
  overflow: visible;
}
.books-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at top right,
    rgba(14, 165, 233, 0.1),
    transparent 50%
  );
  pointer-events: none;
  z-index: 0;
  border-radius: 24px;
}
.books-hero__copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.books-hero .kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--primary-color);
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 6px;
  padding: 6px 16px;
  margin-bottom: 24px;
  width: fit-content;
}
.books-hero h1 {
  font-size: clamp(2.5rem, 4vw, 4rem);
  line-height: 1.1;
  margin: 0 0 20px;
  color: var(--text-main);
  letter-spacing: -0.02em;
  font-weight: 800;
  text-wrap: balance;
}
.books-hero h1 span:last-child {
  color: var(--primary-color);
}
.books-hero p {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.6;
  font-weight: 400;
}
.books-hero__copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
}
.books-hero__highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.hero-highlight {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  font-weight: 600;
  transition: 0.2s;
}
.hero-highlight:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}
.hero-highlight i {
  color: var(--primary-color);
}
.books-hero__microstats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.hero-microstat {
  min-width: 0;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  background: rgba(255, 255, 255, 0.01);
  transition: 0.3s;
  position: relative;
}
.hero-microstat:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
.hero-microstat strong {
  display: block;
  color: var(--text-main);
  font-size: 1rem;
  margin-bottom: 6px;
  font-weight: 700;
}
.hero-microstat span {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.books-hero__panel {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.model-poster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.9rem;
}
.books-hero__panel model-viewer {
  width: 100%;
  height: 100%;
}
.books-section-card {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 48px;
  background: rgba(15, 23, 42, 0.4);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}
.books-section-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(14, 165, 233, 0.4),
    transparent
  );
  pointer-events: none;
}
.books-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  margin-bottom: 12px;
  border-radius: 6px;
  color: var(--primary-color);
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.books-section-header h2 {
  margin: 0 0 8px;
  color: var(--text-main);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.books-section-header p {
  margin: 0;
  max-width: 600px;
  color: #94a3b8;
  line-height: 1.8;
  font-size: 1.05rem;
}
.books-toolbar-shell {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 40px;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(12px);
}
.books-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}
.books-toolbar > .books-field:first-child {
  flex: 2 1 240px;
}
.books-toolbar > .books-field:not(:first-child) {
  flex: 1 1 160px;
}
.books-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.books-field__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.books-field i {
  position: absolute;
  bottom: 14px;
  inset-inline-start: 14px;
  color: var(--primary-color);
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.7;
  transition: 0.2s;
}
.books-toolbar input[type="text"],
.books-toolbar input:not([type]),
.books-toolbar select {
  width: 100%;
  height: 48px;
  background: rgba(2, 6, 23, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-radius: 8px;
  padding: 0 16px 0 42px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  outline: 0;
  transition: 0.2s;
  appearance: none;
}
.books-toolbar select {
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230ea5e9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 14px) center;
}
html[dir="rtl"] .books-toolbar select {
  background-position: 14px center;
}
.books-toolbar input[type="text"]:focus,
.books-toolbar input:not([type]):focus,
.books-toolbar select:focus {
  border-color: var(--primary-color);
  background: rgba(2, 6, 23, 0.8);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}
.books-toolbar input[type="text"]:focus + i,
.books-toolbar input:not([type]):focus + i,
.books-toolbar select:focus + i {
  opacity: 1;
}
.books-toolbar .chk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}
.books-toolbar .chk:hover {
  background: rgba(14, 165, 233, 0.05);
  border-color: rgba(14, 165, 233, 0.2);
}
.books-toolbar input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
  cursor: pointer;
}
.books-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 12px 0;
}
.books-count {
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 700;
}
.books-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.books-note i {
  color: var(--primary-color);
}
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  align-items: stretch;
}
.book-card {
  position: relative;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.3s,
    box-shadow 0.3s,
    border-color 0.3s;
}
.book-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.5);
}
.book-cover {
  position: relative;
  aspect-ratio: 2/3;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.book-cover::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(15, 23, 42, 0.9));
  pointer-events: none;
}
.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.book-card:hover .book-cover img {
  transform: scale(1.05);
}
.book-cover .ph {
  color: rgba(14, 165, 233, 0.3);
  font-size: 3rem;
}
.book-cover .generated-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  text-align: center;
  gap: 12px;
  z-index: 1;
}
.generated-cover .cover-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  backdrop-filter: blur(8px);
}
.generated-cover .cover-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.01em;
}
.generated-cover .cover-line {
  width: 32px;
  height: 3px;
  border-radius: 999px;
  background: var(--primary-color);
}
.generated-cover .cover-author {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  font-weight: 500;
}
.book-cover .badge {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
  text-transform: uppercase;
  z-index: 2;
}
.badge.free {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge.paid {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.book-body {
  position: relative;
  z-index: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.book-body h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-main);
  line-height: 1.4;
  font-weight: 700;
}
.book-body .cat {
  width: fit-content;
  color: var(--primary-color);
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.book-body .author {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}
.book-body .desc {
  color: #cbd5e1;
  font-size: 0.85rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}
.book-body .meta {
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 16px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-weight: 500;
}
.book-body .meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.book-body .meta i {
  color: var(--primary-color);
  opacity: 0.8;
}
.book-card .get {
  position: relative;
  overflow: hidden;
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary-color);
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: 0.2s;
  font-size: 0.9rem;
}
.book-card:hover .get {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.book-card .get:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.book-card .get.alt {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}
.book-card:hover .get.alt {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  color: #cbd5e1;
}
.books-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 100px 20px;
  grid-column: 1/-1;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.01);
}
.books-empty i {
  font-size: 3rem;
  color: var(--primary-color);
  display: block;
  margin-bottom: 20px;
  opacity: 0.5;
}
html[dir="rtl"] .books-hero p,
html[dir="rtl"] .books-hero__copy,
html[dir="rtl"] .books-note,
html[dir="rtl"] .books-section-header {
  text-align: right;
}
@media (max-width: 1040px) {
  .books-hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 40px;
  }
  html[dir="rtl"] .books-hero p,
  html[dir="rtl"] .books-hero__copy {
    text-align: center;
  }
  .books-hero p {
    margin-left: auto;
    margin-right: auto;
  }
  .books-hero__copy-actions,
  .books-hero__highlights {
    justify-content: center;
  }
  .books-section-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  html[dir="rtl"] .books-section-header {
    text-align: center;
  }
}
@media (max-width: 768px) {
  .books-wrap {
    width: min(100% - 32px, 1200px);
    padding-top: 100px;
    padding-bottom: 60px;
  }
  .books-hero,
  .books-section-card {
    padding: 32px 20px;
    border-radius: 20px;
    gap: 24px;
  }
  .books-hero h1 {
    font-size: 2.2rem;
  }
  .books-hero__copy-actions {
    flex-direction: column;
    width: 100%;
  }
  .books-hero__copy-actions .topbar-link {
    width: 100%;
    justify-content: center;
  }
  .books-hero__microstats {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .hero-microstat {
    padding: 16px;
  }
  .books-toolbar-shell {
    padding: 20px;
    border-radius: 16px;
  }
  .books-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .books-toolbar > .books-field:first-child,
  .books-toolbar > .books-field:not(:first-child) {
    flex: none;
    width: 100%;
  }
  .books-meta-row {
    flex-direction: column;
    text-align: center;
  }
  .books-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .books-toolbar .chk {
    justify-content: flex-start;
  }
}
