@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap');

:root {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.2);
  --accent: #8b5cf6;
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.25);
  --blue-badge: #0284c7;
  --danger: #ef4444;
  --success: #10b981;
  --shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

[data-theme="dark"] {
  --bg-base: #000000;
  --bg-surface: #0a0a0c;
  --bg-card: #101014;
  --bg-glass: rgba(10, 10, 12, 0.88);
  --border: #22222a;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.25);
  --shadow: 0 14px 40px -10px rgba(0, 0, 0, 0.85);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Cairo', sans-serif;
}

body {
  background: var(--bg-base);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* الشريط العلوي */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.5rem;
}

.nav-wrap {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

/* أيقونة القائمة المنسدلة = على شكل كتاب عصري */
.book-menu-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  transition: all 0.25s ease;
}

.book-menu-icon:hover {
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
  transform: translateY(-2px);
}

.book-menu-icon .bar {
  width: 22px;
  height: 2.5px;
  background: var(--text-main);
  border-radius: 4px;
  transition: 0.2s;
}

.book-menu-icon .bar:nth-child(2) {
  width: 16px;
  background: var(--primary);
}

.book-menu-icon::before {
  content: '';
  position: absolute;
  right: 6px;
  height: 18px;
  width: 2.5px;
  background: var(--accent);
  border-radius: 4px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-main);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.logo-badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 99px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* الأزرار العصرية */
.btn {
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-pro {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #fff;
  box-shadow: 0 4px 15px var(--gold-glow);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

/* القائمة المنسدلة الجانبية */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
  z-index: 1500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer-box {
  position: fixed;
  top: 0;
  right: -360px;
  width: 340px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 1600;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.drawer-box.active {
  right: 0;
}

.drawer-search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-main);
  outline: none;
}

.drawer-items {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.drawer-link {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  font-weight: 800;
  font-size: 0.92rem;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-decoration: none;
  transition: 0.2s;
}

.drawer-link:hover, .drawer-link.active {
  background: var(--bg-base);
  border-color: var(--primary);
  color: var(--primary);
}

/* قسم الاستقبال ومحرك البحث المتطور */
.hero {
  max-width: 1200px;
  margin: 2rem auto 1.5rem;
  padding: 0 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.25;
  margin-bottom: 0.8rem;
  background: linear-gradient(135deg, var(--text-main) 60%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 720px;
  margin: 0 auto 2rem;
}

/* أقوى مربع بحث متقدم */
.super-search-box {
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0.6rem;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
}

.super-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 25px var(--primary-glow);
}

.search-main-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.4rem 0.8rem;
}

.search-main-row input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 700;
  outline: none;
}

.search-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.7rem 0.6rem 0.2rem;
  border-top: 1px solid var(--border);
}

.chip-select {
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

/* شريط تبويب الأقسام */
.tabs-scroll {
  max-width: 1400px;
  margin: 1.5rem auto 2rem;
  padding: 0 1.5rem;
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-btn {
  padding: 0.7rem 1.4rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.2s;
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

/* شبكة البطاقات */
.content-grid {
  max-width: 1400px;
  margin: 0 auto 5rem;
  padding: 0 1.5rem;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.4rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.4rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.1rem;
  transition: all 0.25s ease;
  position: relative;
}

.card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
}

.card-top {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.badge-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pill {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--bg-base);
  border: 1px solid var(--border);
}

.pill-vip {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #fff;
}

.card-title {
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1.4;
}

.card-info {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

/* النوافذ المنبثقة (Modals) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.8rem;
  box-shadow: var(--shadow);
}

.modal-window.large {
  max-width: 980px;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.input {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-base);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
}

.input:focus {
  border-color: var(--primary);
}

/* التنبيهات المنبثقة السريعة (Toast) */
.toast-box {
  position: fixed;
  bottom: 25px;
  left: 25px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideUp 0.3s ease;
}

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

@media (max-width: 768px) {
  .nav-wrap { padding: 0.5rem 0; }
  .btn span.hide-m { display: none; }
  .hero h1 { font-size: 1.8rem; }
  .toast-box { left: 15px; right: 15px; bottom: 15px; }
}