/* =========================================================
   RAWI AL-SHAMAL — Daylight Pearlescent Glass Architecture
   Contextual Corner Radii + Live Yemeni Geometric Motifs
   2-Column Uncropped Book Grid + Living Floating Motion
   ========================================================= */

:root {
  --font-ar: 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  --font-en: 'Outfit', system-ui, sans-serif;

  /* هندسة الزوايا المتدرجة حسب الدور والسياق المعماري */
  --radius-shell: 24px;    /* للحاويات الرئيسية الكبرى */
  --radius-card: 16px;     /* لبطاقات المحتوى والنوافذ */
  --radius-media: 10px;    /* لأغلفة الكتب وصور الأعمال */
  --radius-control: 11px;  /* لحقول الإدخال وصناديق المواصفات والتنبيهات */
  --radius-badge: 7px;     /* للشارات والوسوم الهندسية الحادة */
  --radius-pill: 999px;    /* للهيدر النحيف والشريط العائم والتبويبات */

  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  --header-h: 48px;
  --dock-space: 104px;

  /* لوحة الوضع النهاري اللؤلؤي فقط */
  --bg-page-top: #f7fafe;
  --bg-page-mid: #edf3fc;
  --bg-page-bot: #f5f8fd;

  --glass-bg: rgba(255, 255, 255, 0.68);
  --glass-bg-card: rgba(255, 255, 255, 0.85);
  --glass-bg-strong: rgba(255, 255, 255, 0.93);
  --glass-border: rgba(255, 255, 255, 0.96);
  --glass-border-line: rgba(15, 23, 42, 0.085);
  --glass-shadow: 0 14px 36px rgba(15, 23, 42, 0.055), inset 0 1px 0 rgba(255, 255, 255, 1);
  --card-shadow: 0 8px 24px rgba(15, 23, 42, 0.048), inset 0 1px 0 rgba(255, 255, 255, 0.96);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent: #1d4ed8;
  --accent-2: #4f46e5;
  --accent-glow: rgba(29, 78, 216, 0.20);
  --yemen-ochre: #b45309;
  --success: #059669;
  --warning: #d97706;
  --danger: #e11d48;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-ar);
  background: linear-gradient(160deg, var(--bg-page-top) 0%, var(--bg-page-mid) 52%, var(--bg-page-bot) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.65;
  padding-top: calc(var(--header-h) + 22px);
  padding-bottom: var(--dock-space);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

/* تنسيق موحد لأيقونات Lucide */
svg.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 1.85;
  flex-shrink: 0;
}

/* ---------- خلفية النقوش الهندسية اليمنية الحية ---------- */
.yemeni-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.pearl-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
}

.glow-sapphire {
  width: 480px;
  height: 480px;
  top: -140px;
  right: -110px;
  background: rgba(59, 130, 246, 0.16);
}

.glow-amber {
  width: 440px;
  height: 440px;
  bottom: 4%;
  left: -120px;
  background: rgba(217, 119, 6, 0.12);
}

.glow-mint {
  width: 340px;
  height: 340px;
  top: 44%;
  right: 28%;
  background: rgba(16, 185, 129, 0.08);
}

.yemeni-pattern {
  position: absolute;
  inset: -160px;
  background-repeat: repeat;
  will-change: transform;
}

.pattern-qamariya {
  opacity: 0.064;
  background-size: 150px 150px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150' viewBox='0 0 150 150'%3E%3Cg fill='none' stroke='%231e3a8a' stroke-width='1.15'%3E%3Cpolygon points='75,10 94,56 140,75 94,94 75,140 56,94 10,75 56,56'/%3E%3Crect x='29' y='29' width='92' height='92' transform='rotate(45 75 75)'/%3E%3Ccircle cx='75' cy='75' r='24'/%3E%3Ccircle cx='75' cy='75' r='7'/%3E%3Cpath d='M0 75 H20 M130 75 H150 M75 0 V20 M75 130 V150'/%3E%3C/g%3E%3C/svg%3E");
  animation: yemeniDriftForward 42s linear infinite;
}

.pattern-star {
  opacity: 0.044;
  background-size: 220px 220px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='%2392400e' stroke-width='1.05'%3E%3Cpath d='M110 18 L142 78 L202 110 L142 142 L110 202 L78 142 L18 110 L78 78 Z'/%3E%3Cpolygon points='110,44 156,64 176,110 156,156 110,176 64,156 44,110 64,64'/%3E%3Ccircle cx='110' cy='110' r='14'/%3E%3C/g%3E%3C/svg%3E");
  animation: yemeniDriftCounter 58s linear infinite;
}

@keyframes yemeniDriftForward {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(150px, 150px, 0); }
}

@keyframes yemeniDriftCounter {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-110px, 110px, 0); }
}

/* ---------- الهيدر العلوي النحيف جداً: الاسم بالإنجليزية فقط ---------- */
.slim-header {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 1060px);
  height: var(--header-h);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(26px) saturate(185%);
  -webkit-backdrop-filter: blur(26px) saturate(185%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-shadow);
}

.brand-en {
  font-family: var(--font-en);
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #0f172a 0%, #1d4ed8 50%, #0f172a 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: brandShimmer 8s linear infinite;
  padding: 6px 16px;
  user-select: none;
}

@keyframes brandShimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* ---------- الحاوية الرئيسية والبطاقات الزجاجية ---------- */
.app-shell {
  width: min(calc(100% - 24px), 1060px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: stageEnter 0.4s var(--ease-spring);
}

@keyframes stageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.glass-panel {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(175%);
  -webkit-backdrop-filter: blur(24px) saturate(175%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-shell);
  box-shadow: var(--glass-shadow);
  padding: 22px;
}

.glass-card {
  position: relative;
  background: var(--glass-bg-card);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.25s ease, border-color 0.25s ease;
}

.glass-card.interactive {
  cursor: pointer;
}

.glass-card.interactive:hover {
  transform: translateY(-4px);
  border-color: rgba(29, 78, 216, 0.25);
  box-shadow: 0 16px 36px rgba(29, 78, 216, 0.10);
}

.glass-card.interactive:active {
  transform: scale(0.985);
}

/* ---------- شاشة التحميل ---------- */
.loading-stage {
  min-height: 54vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-secondary);
}

.glass-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(29, 78, 216, 0.16);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- بطاقة الهوية الرئيسية (Hero) ---------- */
.hero-panel {
  padding: 30px 26px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.66));
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-badge);
  background: #ffffff;
  border: 1px solid var(--glass-border-line);
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.hero-badge .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.45);
}

.hero-title-ar {
  margin: 0 0 10px;
  font-size: clamp(1.95rem, 5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.22;
  color: var(--text-primary);
}

.hero-bio {
  margin: 0 0 22px;
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 680px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- الأزرار الأنيقة بحركة طفو حية ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 19px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border-line);
  background: #ffffff;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.045);
  transition: transform 0.24s var(--ease-spring), box-shadow 0.24s ease, filter 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.085);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 10px 24px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 14px 30px var(--accent-glow);
}

.btn-support {
  background: linear-gradient(135deg, #d97706, #e11d48);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(225, 29, 72, 0.22);
  animation: floatBreath 4.2s ease-in-out infinite;
}

@keyframes floatBreath {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-3px); }
}

.btn-support:hover {
  filter: brightness(1.07);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  border-color: transparent;
  color: #ffffff;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.81rem;
}

.btn-full {
  width: 100%;
}

/* ---------- عناوين الأقسام والتبويبات الأفقية (لمس + ماوس + أسهم) ---------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-sub {
  margin: 3px 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tabs-scroller-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.90);
  border: 1px solid var(--glass-border-line);
  border-radius: var(--radius-pill);
  padding: 4px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.pill-tabs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
  user-select: none;
  padding: 1px 3px;
}

.pill-tabs::-webkit-scrollbar {
  display: none;
}

.pill-tabs.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
}

.pill-tab {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.pill-tab:hover {
  color: var(--text-primary);
  background: rgba(15, 23, 42, 0.045);
}

.pill-tab.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 5px 14px var(--accent-glow);
}

.tab-arrow {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--glass-border-line);
  background: #ffffff;
  color: var(--text-primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.07);
}

.tab-arrow:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.tab-arrow.hidden-arrow {
  display: none;
}

/* ---------- الشبكات (شبكة الكتب 2 في الصف على الهاتف + الباقي) ---------- */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.bento-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 12px;
}

.hub-tile {
  padding: 16px 15px;
  border-radius: var(--radius-card);
  background: var(--glass-bg-card);
  border: 1px solid var(--glass-border);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  text-align: right;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.25s ease, border-color 0.25s ease;
}

.hub-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(29, 78, 216, 0.24);
  box-shadow: 0 14px 32px rgba(29, 78, 216, 0.09);
}

.hub-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-control);
  display: grid;
  place-items: center;
  background: rgba(29, 78, 216, 0.085);
  color: var(--accent);
}

.hub-tile strong {
  font-size: 0.94rem;
}

.hub-tile span {
  font-size: 0.79rem;
  color: var(--text-secondary);
}

/* ---------- الشارات والوسوم الهندسية ---------- */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-badge);
  font-size: 0.73rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid var(--glass-border-line);
  color: var(--text-secondary);
  width: fit-content;
}

.badge svg.lucide {
  width: 13px;
  height: 13px;
}

.badge-accent  { background: rgba(29, 78, 216, 0.09); color: var(--accent); border-color: rgba(29, 78, 216, 0.20); }
.badge-success { background: rgba(5, 150, 105, 0.10); color: var(--success); border-color: rgba(5, 150, 105, 0.22); }
.badge-warning { background: rgba(217, 119, 6, 0.10); color: var(--yemen-ochre); border-color: rgba(217, 119, 6, 0.24); }
.badge-purple  { background: rgba(79, 70, 229, 0.09); color: var(--accent-2); border-color: rgba(79, 70, 229, 0.20); }

/* ---------- بطاقات الكتب (الغلاف يظهر كاملاً 100% دون اقتصاص) ---------- */
.media-frame {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-media);
  overflow: hidden;
  background: #e9eff8;
  border: 1px solid var(--glass-border-line);
  position: relative;
}

.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease-spring);
}

.book-cover-frame {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-media);
  overflow: hidden;
  background: linear-gradient(180deg, #f8fafc 0%, #eaf0f9 100%);
  border: 1px solid var(--glass-border-line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
}

.book-cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  transition: transform 0.45s var(--ease-spring);
}

.glass-card:hover .book-cover-frame img,
.glass-card:hover .media-frame img {
  transform: scale(1.03);
}

.card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.38;
}

.card-excerpt {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: auto;
}

.price-now {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--accent);
}

.price-free {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--success);
}

.price-old {
  font-size: 0.81rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.book-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--glass-border-line);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border-line);
}

/* ---------- صفحة الكتاب المستقلة (الغلاف يميناً والمعلومات بجانبه وتحته) ---------- */
.book-detail-top {
  display: grid;
  grid-template-columns: minmax(175px, 250px) 1fr;
  gap: 22px;
  align-items: start;
}

.book-detail-info {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
}

.book-specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.spec-box {
  padding: 10px 12px;
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--glass-border-line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spec-box span {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.spec-box strong {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.book-detail-bottom {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--glass-border-line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- شريط التقدم (الكتابة / رعاية المشاريع / التحميل) ---------- */
.progress-track {
  width: 100%;
  height: 9px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.075);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--success));
  transition: width 0.55s var(--ease-spring);
}

.writing-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--glass-border-line);
}

.writing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
  font-weight: 600;
}

/* ---------- الإعلانات والتنويهات الداخلية ---------- */
.ad-banner {
  display: grid;
  grid-template-columns: 124px 1fr;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.90), rgba(219, 234, 254, 0.74));
  border: 1px solid rgba(29, 78, 216, 0.18);
  box-shadow: var(--glass-shadow);
}

.ad-banner.no-img {
  grid-template-columns: 1fr;
}

.ad-thumb {
  width: 124px;
  height: 92px;
  border-radius: var(--radius-media);
  object-fit: cover;
  border: 1px solid var(--glass-border);
}

/* ---------- شركاء النجاح والجهات الخارجية ---------- */
.partner-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 12px;
}

.partner-card {
  align-items: center;
  text-align: center;
  padding: 16px 12px;
}

.partner-logo {
  width: 62px;
  height: 62px;
  border-radius: var(--radius-media);
  object-fit: cover;
  background: #f1f5f9;
  border: 1px solid var(--glass-border-line);
  margin: 0 auto;
  display: grid;
  place-items: center;
  color: var(--accent);
}

.entity-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-badge);
  background: #ffffff;
  border: 1px solid var(--glass-border-line);
  font-size: 0.81rem;
  cursor: pointer;
  width: fit-content;
}

.entity-chip img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
}

/* ---------- جدار رسائل الداعمين ---------- */
.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.wall-card {
  padding: 15px;
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--glass-border-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wall-quote {
  margin: 0;
  font-size: 0.91rem;
  color: var(--text-primary);
}

.wall-author {
  font-size: 0.81rem;
  color: var(--accent);
  font-weight: 700;
}

/* ---------- قنوات التواصل ---------- */
.contact-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  border: 1px solid var(--glass-border-line);
  font-size: 0.87rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
  transition: transform 0.25s var(--ease-spring), border-color 0.2s ease;
}

.contact-pill:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

/* ---------- صفحات التفاصيل المستقلة والروابط المضمّنة ---------- */
.back-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.rich-text {
  white-space: pre-wrap;
  color: var(--text-secondary);
  font-size: 0.96rem;
  line-height: 1.86;
  word-break: break-word;
}

.inline-ext-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.inline-ext-link svg.lucide {
  width: 14px;
  height: 14px;
}

.inline-ext-link:hover {
  color: var(--accent-2);
}

.embed-frame {
  width: 100%;
  border-radius: var(--radius-media);
  overflow: hidden;
  border: 1px solid var(--glass-border-line);
  background: #0f172a;
}

.embed-frame.youtube-box {
  aspect-ratio: 16 / 9;
}

.embed-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.embed-frame.fb-box {
  background: #ffffff;
  min-height: 440px;
}

/* ---------- المدخلات وصفحة الدعم ---------- */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.glass-input, .glass-textarea, .glass-select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-control);
  border: 1px solid var(--glass-border-line);
  background: #ffffff;
  color: var(--text-primary);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.24s ease, box-shadow 0.24s ease;
}

.glass-textarea {
  min-height: 94px;
  resize: vertical;
}

.glass-input:focus, .glass-textarea:focus, .glass-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.notice-box {
  padding: 14px 16px;
  border-radius: var(--radius-control);
  background: rgba(29, 78, 216, 0.055);
  border: 1px solid rgba(29, 78, 216, 0.17);
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.75;
}

.notice-box ul {
  margin: 8px 0 0;
  padding-right: 18px;
}

/* ---------- الشريط السفلي العائم بحركة طفو حية ---------- */
.floating-dock {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 20px), 520px);
  z-index: 95;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 6px;
  border-radius: var(--radius-pill);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  animation: dockLevitate 5s ease-in-out infinite;
}

@keyframes dockLevitate {
  0%, 100% { transform: translate(-50%, 0px); }
  50%      { transform: translate(-50%, -4px); }
}

.dock-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 4px;
  border-radius: var(--radius-pill);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.24s var(--ease-spring);
}

.dock-btn span {
  font-size: 0.7rem;
  font-weight: 600;
}

.dock-btn:hover:not(.active) {
  background: rgba(15, 23, 42, 0.045);
  color: var(--text-primary);
}

.dock-btn.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 6px 16px var(--accent-glow);
}

/* ---------- الأدراج ونوافذ التأكيد المنبثقة ---------- */
.sheet-backdrop, .modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

.modal-backdrop {
  align-items: center;
  z-index: 140;
}

.glass-sheet, .glass-modal {
  width: min(100%, 520px);
  max-height: 86vh;
  background: #ffffff;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheetRise 0.3s var(--ease-spring);
}

.glass-modal-sm {
  width: min(100%, 420px);
}

@keyframes sheetRise {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.15);
  margin: 10px auto 0;
}

.sheet-head, .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--glass-border-line);
}

.sheet-head h3, .modal-head h3 {
  margin: 0;
  font-size: 1.03rem;
}

.icon-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--glass-border-line);
  background: #f8fafc;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sheet-body, .modal-body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-row {
  width: 100%;
  padding: 12px 15px;
  border-radius: var(--radius-control);
  border: 1px solid var(--glass-border-line);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.menu-row:hover {
  background: #eff6ff;
  border-color: rgba(29, 78, 216, 0.22);
}

.menu-row-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

/* ---------- نافذة التأكيد وتحذير المغادرة ---------- */
.confirm-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: rgba(29, 78, 216, 0.09);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.confirm-icon-wrap.is-warning {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

.confirm-icon-wrap svg.lucide {
  width: 24px;
  height: 24px;
}

.confirm-text {
  margin: 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.7;
}

.confirm-domain-pill {
  padding: 8px 12px;
  border-radius: var(--radius-control);
  background: #f1f5f9;
  border: 1px solid var(--glass-border-line);
  font-family: var(--font-en);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  direction: ltr;
  word-break: break-all;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

/* ---------- نافذة التحميل التكتيكي ---------- */
.dl-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 6px 0;
}

.dl-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.24rem;
  font-weight: 700;
  color: var(--accent);
  border: 3px solid var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
}

.dl-status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.dl-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- الإشعارات العائمة (Toasts) ---------- */
.toast-stack {
  position: fixed;
  top: calc(var(--header-h) + 18px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 160;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(calc(100% - 28px), 420px);
  pointer-events: none;
}

.toast {
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  border: 1px solid var(--glass-border-line);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
  font-size: 0.87rem;
  font-weight: 600;
  text-align: center;
  animation: stageEnter 0.3s var(--ease-spring);
}

.toast-success { border-color: var(--success); color: var(--success); }
.toast-error   { border-color: var(--danger); color: var(--danger); }

/* ---------- التذييل ---------- */
.site-footer {
  width: min(calc(100% - 24px), 1060px);
  margin: 22px auto 0;
}

.footer-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.footer-en {
  font-family: var(--font-en);
  letter-spacing: 0.14em;
  font-size: 0.84rem;
  color: var(--accent);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.text-link {
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}

.text-link:hover {
  color: var(--accent);
}

.footer-copy {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-secondary);
}

/* ---------- التوافق الكامل مع الهواتف (كتابان في كل صف + غلاف يمين التفاصيل) ---------- */
@media (max-width: 768px) {
  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .books-grid .glass-card {
    padding: 10px;
    gap: 7px;
  }

  .books-grid .card-title {
    font-size: 0.9rem;
  }

  .books-grid .card-excerpt {
    font-size: 0.78rem;
    -webkit-line-clamp: 2;
  }

  .books-grid .btn {
    padding: 7px 9px;
    font-size: 0.77rem;
  }

  .book-detail-top {
    grid-template-columns: 124px 1fr;
    gap: 14px;
  }

  .hero-panel {
    padding: 24px 18px;
  }

  .glass-panel {
    padding: 16px 14px;
    border-radius: 20px;
  }

  .ad-banner {
    grid-template-columns: 1fr;
  }

  .ad-thumb {
    width: 100%;
    height: 160px;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 355px) {
  .book-detail-top {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .yemeni-pattern, .floating-dock, .btn-support, .brand-en {
    animation: none !important;
  }
}
