/* ════════════════════════════════════════════════════
   مكتبة مدرسة سردا الأساسية المختلطة
   T. Wad Refae — تصميم عصري مع أغلفة كتب ملونة
   ════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;900&family=Amiri:wght@400;700&display=swap');

:root {
  /* ألوان الهوية — تراث فلسطيني عصري */
  --primary:        #0d4d70;
  --primary-dark:   #073854;
  --primary-light:  #e8f1f7;
  --accent:         #c9a227;
  --accent-light:   #fef3c7;
  --accent-dark:    #92750c;

  --green:          #166534;
  --green-soft:     #16794d;
  --green-light:    #d1fae5;
  --red:            #b91c1c;
  --red-light:      #fee2e2;

  /* ألوان أغلفة الكتب */
  --cover-religious: #1e6091;
  --cover-history:   #8b4513;
  --cover-science:   #047857;
  --cover-literature:#7c3aed;
  --cover-stories:   #c2410c;
  --cover-language:  #db2777;
  --cover-general:   #4b5563;
  --cover-encycl:    #0891b2;
  --cover-palestine: #b91c1c;
  --cover-nature:    #15803d;

  --bg:             #f5f7fa;
  --bg-soft:        #fafbfc;
  --card:           #ffffff;
  --text:           #1f2937;
  --text-soft:      #6b7280;
  --text-muted:     #9ca3af;
  --border:         #e5e7eb;
  --border-strong:  #d1d5db;

  --radius:         12px;
  --radius-lg:      16px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.06);
  --shadow:         0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:      0 10px 30px rgba(0,0,0,0.12);
  --shadow-xl:      0 20px 50px rgba(0,0,0,0.18);

  --font:           'Tajawal', system-ui, sans-serif;
  --font-display:   'Amiri', 'Tajawal', serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* خلفية تراثية ناعمة (نمط زخرفي خفيف) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(13,77,112,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(201,162,39,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

.hidden { display: none !important; }

/* ════════════════════════════════════════════════════
   شريط علوي (Topbar) — تصميم متطور
════════════════════════════════════════════════════ */
.topbar {
  background:
    linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #1366a1 100%);
  color: #fff;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 3px solid var(--accent);
}

.topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.02) 10px, rgba(255,255,255,0.02) 20px);
  pointer-events: none;
}

.topbar > * { position: relative; z-index: 1; }

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.topbar-icon {
  font-size: 1.9rem;
  background: rgba(255,255,255,0.18);
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  border: 2px solid rgba(255,255,255,0.15);
}

.topbar-titles h1 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
  font-family: var(--font-display);
}

.topbar-titles p {
  font-size: 0.8rem;
  opacity: 0.85;
  font-weight: 400;
}

.topbar-teacher {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 0.75rem;
  opacity: 0.95;
  padding: 8px 14px;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  border-right: 3px solid var(--accent);
  backdrop-filter: blur(10px);
}
.topbar-teacher strong {
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.3px;
}

.topbar-action {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}
.topbar-action:hover {
  background: rgba(255,255,255,0.28);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.2);
}
.topbar-action.danger {
  background: rgba(220,38,38,0.55);
  border-color: rgba(255,200,200,0.3);
}
.topbar-action.danger:hover { background: rgba(220,38,38,0.85); }

/* ════════════════════════════════════════════════════
   Hero Section — صفحة الترحيب
════════════════════════════════════════════════════ */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 50px 28px 70px;
  text-align: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 32px;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(201,162,39,0.18) 0%, transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,0.08) 0%, transparent 40%);
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--bg);
  clip-path: polygon(0 100%, 100% 100%, 100% 0, 50% 70%, 0 0);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  animation: heroFadeIn 0.7s ease-out;
}

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

.hero-decorative {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
  font-size: 2.6rem;
}
.hero-decorative span {
  display: inline-block;
  animation: bookFloat 3s ease-in-out infinite;
}
.hero-decorative span:nth-child(2) { animation-delay: 0.3s; }
.hero-decorative span:nth-child(3) { animation-delay: 0.6s; }

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

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.hero h1 .accent { color: var(--accent); }

.hero p {
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

.hero-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 22px 0 8px;
}
.hero-divider .line {
  width: 60px;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
}
.hero-divider .icon { color: var(--accent); font-size: 1.1rem; }

/* ════════════════════════════════════════════════════
   حاوية الصفحة
════════════════════════════════════════════════════ */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 24px;
}

/* ════════════════════════════════════════════════════
   إحصائيات
════════════════════════════════════════════════════ */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
  animation: statSlideIn 0.5s ease-out backwards;
}
.stat:nth-child(1) { animation-delay: 0.1s; }
.stat:nth-child(2) { animation-delay: 0.2s; }
.stat:nth-child(3) { animation-delay: 0.3s; }

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

.stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.total     { background: var(--primary-light); color: var(--primary); }
.stat-icon.available { background: var(--green-light);   color: var(--green-soft); }
.stat-icon.borrowed  { background: var(--red-light);     color: var(--red); }

.stat-num {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 500;
}

/* ════════════════════════════════════════════════════
   شريط البحث (Toolbar)
════════════════════════════════════════════════════ */
.toolbar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.search-input {
  flex: 1;
  min-width: 240px;
  position: relative;
}
.search-input span {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input input {
  width: 100%;
  padding: 11px 40px 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
  background: var(--bg-soft);
  transition: all 0.2s;
}
.search-input input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13,77,112,0.1);
}

.toolbar select {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.92rem;
  background: var(--bg-soft);
  color: var(--text);
  outline: none;
  cursor: pointer;
  min-width: 170px;
  transition: all 0.2s;
}
.toolbar select:focus { border-color: var(--primary); background: #fff; }

/* ════════════════════════════════════════════════════
   شبكة الكتب — تصميم بطاقات أنيق
════════════════════════════════════════════════════ */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.book-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: cardFadeUp 0.4s ease-out backwards;
}

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

.book-card.clickable { cursor: pointer; }
.book-card.clickable:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.book-card.clickable:hover .book-cover {
  transform: rotate(-2deg) scale(1.04);
}

/* غلاف الكتاب الرمزي */
.book-cover {
  position: relative;
  height: 110px;
  background: var(--cover-general);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.4s ease;
}

/* تصنيف الأغلفة بالألوان */
.book-cover.religious  { background: linear-gradient(135deg, #1e6091, #0d4d70); }
.book-cover.history    { background: linear-gradient(135deg, #8b4513, #654321); }
.book-cover.science    { background: linear-gradient(135deg, #047857, #065f46); }
.book-cover.literature { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.book-cover.stories    { background: linear-gradient(135deg, #c2410c, #9a3412); }
.book-cover.language   { background: linear-gradient(135deg, #db2777, #9d174d); }
.book-cover.general    { background: linear-gradient(135deg, #4b5563, #374151); }
.book-cover.encycl     { background: linear-gradient(135deg, #0891b2, #155e75); }
.book-cover.palestine  { background: linear-gradient(135deg, #b91c1c, #7f1d1d); }
.book-cover.nature     { background: linear-gradient(135deg, #15803d, #14532d); }

/* نمط زخرفي على الغلاف */
.book-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(255,255,255,0.06) 12px, rgba(255,255,255,0.06) 24px);
}
.book-cover::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 5px;
  background: rgba(0,0,0,0.25);
  box-shadow: inset -1px 0 2px rgba(255,255,255,0.15);
}

/* أيقونة الكتاب على الغلاف */
.book-cover-icon {
  font-size: 2.8rem;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  animation: subtleFloat 3s ease-in-out infinite;
}
@keyframes subtleFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* رقم الكتاب على الغلاف */
.book-cover-num {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
}

/* شريط الحالة على الغلاف */
.book-cover-status {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.book-cover-status.available {
  background: rgba(34,197,94,0.85);
  color: #fff;
}
.book-cover-status.borrowed {
  background: rgba(239,68,68,0.85);
  color: #fff;
}

/* محتوى البطاقة */
.book-body {
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.book-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}

.book-author {
  font-size: 0.85rem;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 5px;
}
.book-author::before { content: '✍️'; opacity: 0.7; font-size: 0.85rem; }

.book-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  margin-top: auto;
}
.book-meta-row span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.part-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  margin-right: 5px;
}

.book-borrower {
  background: var(--accent-light);
  border-right: 3px solid var(--accent);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--accent-dark);
}
.book-borrower strong { color: #78350f; }

.book-actions {
  display: flex;
  gap: 6px;
  padding: 0 16px 16px;
  flex-wrap: wrap;
}

/* ════════════════════════════════════════════════════
   أزرار
════════════════════════════════════════════════════ */
.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 15px;
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 3px 10px rgba(13,77,112,0.25);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(13,77,112,0.35);
}

.btn-success {
  background: linear-gradient(135deg, var(--green-soft), var(--green));
  color: #fff;
  box-shadow: 0 3px 10px rgba(22,121,77,0.25);
}
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(22,121,77,0.35); }

.btn-danger {
  background: linear-gradient(135deg, var(--red), #991b1b);
  color: #fff;
}
.btn-danger:hover { transform: translateY(-2px); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 3px 10px rgba(201,162,39,0.3);
}
.btn-accent:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(201,162,39,0.4); }

.btn-ghost {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--border); }

.btn-icon {
  background: var(--bg);
  color: var(--text-soft);
  border: 1px solid var(--border);
  padding: 9px 11px;
}
.btn-icon:hover { background: var(--red-light); color: var(--red); border-color: #fecaca; }

.btn-block { width: 100%; padding: 12px; font-size: 0.95rem; }
.btn-flex { flex: 1; }

/* ════════════════════════════════════════════════════
   حالات (تحميل/خطأ/فارغ)
════════════════════════════════════════════════════ */
.state {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 70px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.state-icon {
  font-size: 3.5rem;
  margin-bottom: 14px;
  display: block;
  animation: subtleFloat 3s ease-in-out infinite;
}
.state-text {
  color: var(--text-soft);
  margin-bottom: 18px;
  font-size: 1rem;
}

.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════
   شاشة تسجيل الدخول
════════════════════════════════════════════════════ */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.login-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 30% 30%, rgba(201,162,39,0.15) 0%, transparent 40%),
    radial-gradient(circle at 70% 70%, rgba(255,255,255,0.1) 0%, transparent 40%);
}

.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 44px 36px 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45);
  position: relative;
  animation: popIn 0.3s ease;
  border-top: 4px solid var(--accent);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.login-back {
  position: absolute;
  top: 14px; right: 16px;
  background: none;
  border: none;
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 600;
}
.login-back:hover { color: var(--primary); }

.login-icon {
  font-size: 2.6rem;
  background: linear-gradient(135deg, var(--primary-light), #d4e3ed);
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  box-shadow: 0 8px 20px rgba(13,77,112,0.15);
}

.login-card h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.login-card .subtitle {
  color: var(--text-soft);
  font-size: 0.92rem;
  margin-bottom: 24px;
}

.login-card input {
  width: 100%;
  padding: 13px 18px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  text-align: center;
  outline: none;
  margin-bottom: 14px;
  transition: all 0.2s;
}
.login-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,77,112,0.1);
}

.login-error {
  margin-top: 14px;
  background: var(--red-light);
  color: var(--red);
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* ════════════════════════════════════════════════════
   تبويبات لوحة المعلم
════════════════════════════════════════════════════ */
.admin-tabs {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.admin-tab {
  background: none;
  border: none;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s;
}
.admin-tab:hover { background: var(--bg); color: var(--text); }
.admin-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 3px 8px rgba(13,77,112,0.3);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeInUp 0.3s ease; }

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

/* ════════════════════════════════════════════════════
   البطاقات (نماذج / محتوى)
════════════════════════════════════════════════════ */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.panel .panel-desc {
  color: var(--text-soft);
  font-size: 0.92rem;
  margin-bottom: 22px;
}

.panel-section {
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.panel-section:last-child { margin-bottom: 0; }

.panel-section h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.94rem;
  background: #fff;
  outline: none;
  transition: all 0.2s;
  color: var(--text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,77,112,0.08);
}
.form-group textarea {
  resize: vertical;
  min-height: 75px;
  font-family: var(--font);
}

.hint {
  background: linear-gradient(135deg, var(--accent-light), #fef9e8);
  border-right: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 7px;
  font-size: 0.88rem;
  color: var(--accent-dark);
  margin-bottom: 14px;
  line-height: 1.7;
}
.hint code {
  background: rgba(0,0,0,0.08);
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* رفع ملف */
.file-drop {
  border: 2.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  background: var(--bg);
  transition: all 0.25s;
  cursor: pointer;
}
.file-drop:hover, .file-drop.drag {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.01);
}
.file-drop-icon { font-size: 2.5rem; margin-bottom: 10px; }
.file-drop-text { font-weight: 700; color: var(--text); margin-bottom: 5px; }
.file-drop-sub  { font-size: 0.85rem; color: var(--text-soft); }
.file-drop input[type="file"] { display: none; }

.file-info {
  margin-top: 14px;
  background: linear-gradient(135deg, var(--green-light), #ecfccb);
  border-right: 3px solid var(--green-soft);
  padding: 11px 16px;
  border-radius: 7px;
  font-size: 0.9rem;
  color: var(--green);
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 0.86rem;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.preview-table th {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 10px 13px;
  text-align: right;
  font-weight: 700;
}
.preview-table td {
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
}
.preview-table tr:last-child td { border-bottom: none; }
.preview-table tr:hover td { background: var(--bg); }

.msg {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  margin-top: 14px;
}
.msg.success { background: var(--green-light); color: #064e3b; }
.msg.error   { background: var(--red-light);   color: #991b1b; }

/* ════════════════════════════════════════════════════
   Modals
════════════════════════════════════════════════════ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(3px);
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 540px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalPopIn 0.3s ease;
  box-shadow: var(--shadow-xl);
}
.modal.small { max-width: 400px; text-align: center; }

@keyframes modalPopIn {
  from { opacity: 0; transform: scale(0.92) translateY(-15px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px; left: 14px;
  background: var(--bg);
  border: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 0.92rem;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--border); color: var(--text); transform: rotate(90deg); }

.modal h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

/* تفاصيل كتاب — تصميم احترافي */
.detail-cover {
  width: 110px;
  height: 150px;
  background: var(--cover-general);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 3rem;
  position: relative;
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
  overflow: hidden;
}
.detail-cover.religious  { background: linear-gradient(135deg, #1e6091, #0d4d70); }
.detail-cover.history    { background: linear-gradient(135deg, #8b4513, #654321); }
.detail-cover.science    { background: linear-gradient(135deg, #047857, #065f46); }
.detail-cover.literature { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.detail-cover.stories    { background: linear-gradient(135deg, #c2410c, #9a3412); }
.detail-cover.language   { background: linear-gradient(135deg, #db2777, #9d174d); }
.detail-cover.general    { background: linear-gradient(135deg, #4b5563, #374151); }
.detail-cover.encycl     { background: linear-gradient(135deg, #0891b2, #155e75); }
.detail-cover.palestine  { background: linear-gradient(135deg, #b91c1c, #7f1d1d); }
.detail-cover.nature     { background: linear-gradient(135deg, #15803d, #14532d); }

.detail-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(255,255,255,0.07) 12px, rgba(255,255,255,0.07) 24px);
}
.detail-cover::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 6px;
  background: rgba(0,0,0,0.3);
}
.detail-cover-icon {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.detail-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.4;
}
.detail-author {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.95rem;
  margin-bottom: 18px;
}
.detail-tags {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.detail-tag {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
}
.detail-tag.available { background: var(--green-light); color: var(--green-soft); }
.detail-tag.borrowed  { background: var(--red-light); color: var(--red); }

.detail-summary {
  background: linear-gradient(135deg, var(--bg), #f0f4f8);
  padding: 16px 18px;
  border-radius: 10px;
  border-right: 4px solid var(--primary);
  line-height: 1.85;
  margin-bottom: 16px;
  color: var(--text);
  font-size: 0.95rem;
  position: relative;
}
.detail-summary::before {
  content: '"';
  font-family: var(--font-display);
  position: absolute;
  top: -10px;
  right: 14px;
  font-size: 3rem;
  color: var(--primary);
  opacity: 0.2;
  line-height: 1;
}

.detail-summary-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg);
  border-radius: 7px;
  margin-bottom: 8px;
  font-size: 0.92rem;
}
.detail-row span:first-child { color: var(--text-soft); }
.detail-row span:last-child { font-weight: 700; }

/* ════════════════════════════════════════════════════
   Toast
════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  padding: 13px 24px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 999;
  animation: toastIn 0.3s ease;
  white-space: nowrap;
  max-width: 90vw;
  border: 1px solid rgba(255,255,255,0.1);
}
.toast.success { background: linear-gradient(135deg, var(--green-soft), var(--green)); }
.toast.error   { background: linear-gradient(135deg, var(--red), #991b1b); }
@keyframes toastIn {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ════════════════════════════════════════════════════
   Footer
════════════════════════════════════════════════════ */
.footer {
  text-align: center;
  padding: 24px 20px;
  color: var(--text-soft);
  font-size: 0.88rem;
  margin-top: 50px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.footer strong { color: var(--primary); }
.footer .footer-divider { color: var(--accent); margin: 0 6px; }

/* ════════════════════════════════════════════════════
   Responsive
════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .topbar { padding: 12px 16px; gap: 12px; }
  .topbar-titles h1 { font-size: 1rem; }
  .topbar-titles p  { font-size: 0.72rem; }
  .topbar-teacher { display: none; }
  .topbar-action span:not(:first-child) { display: none; }
  .hero { padding: 36px 20px 50px; }
  .page { padding: 0 16px 16px; }
  .stats { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar select { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .books-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════
   بطاقات التصنيفات (الصفحة الرئيسية)
════════════════════════════════════════════════════ */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.category-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
  animation: cardFadeUp 0.4s ease-out backwards;
  display: flex;
  flex-direction: column;
}

.category-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.category-card:hover .cat-banner {
  transform: scale(1.05);
}

.category-card:hover .cat-arrow {
  transform: translateX(-6px);
  opacity: 1;
}

/* البانر الملون لكل تصنيف */
.cat-banner {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.4s ease;
}

.cat-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, transparent, transparent 14px, rgba(255,255,255,0.07) 14px, rgba(255,255,255,0.07) 28px);
}

.cat-banner::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: -20px;
  right: -20px;
  height: 50px;
  background: var(--card);
  border-radius: 50% 50% 0 0;
}

/* ألوان البانرات حسب التصنيف */
.cat-banner.religious  { background: linear-gradient(135deg, #1e6091, #0d4d70); }
.cat-banner.history    { background: linear-gradient(135deg, #8b4513, #654321); }
.cat-banner.science    { background: linear-gradient(135deg, #047857, #065f46); }
.cat-banner.literature { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.cat-banner.stories    { background: linear-gradient(135deg, #c2410c, #9a3412); }
.cat-banner.language   { background: linear-gradient(135deg, #db2777, #9d174d); }
.cat-banner.encycl     { background: linear-gradient(135deg, #0891b2, #155e75); }
.cat-banner.palestine  { background: linear-gradient(135deg, #b91c1c, #7f1d1d); }
.cat-banner.nature     { background: linear-gradient(135deg, #15803d, #14532d); }
.cat-banner.general    { background: linear-gradient(135deg, #4b5563, #374151); }

.cat-icon {
  font-size: 4rem;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
  position: relative;
  z-index: 1;
  animation: subtleFloat 3.5s ease-in-out infinite;
}

/* محتوى البطاقة */
.cat-body {
  padding: 18px 20px 20px;
  text-align: center;
  position: relative;
  z-index: 2;
  margin-top: -10px;
  background: var(--card);
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cat-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.3px;
}

.cat-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

.cat-arrow {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  opacity: 0.7;
  transition: all 0.3s ease;
}

/* ════════════════════════════════════════════════════
   عنوان التصنيف (أعلى صفحة الكتب)
════════════════════════════════════════════════════ */
.category-header {
  background: linear-gradient(135deg, var(--card), var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  border-right: 4px solid var(--primary);
  animation: fadeInUp 0.3s ease;
}

.cat-header-icon {
  font-size: 2.4rem;
  background: var(--primary-light);
  width: 64px; height: 64px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cat-header-text h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.cat-header-text p {
  color: var(--text-soft);
  font-size: 0.92rem;
}


/* ════════════════════════════════════════════════════
   شريط البحث الرئيسي في Hero
════════════════════════════════════════════════════ */
.hero-search {
  margin: 26px auto 0;
  max-width: 600px;
  background: #fff;
  border-radius: 14px;
  padding: 6px 6px 6px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  position: relative;
  z-index: 2;
  border: 2px solid rgba(255,255,255,0.3);
}

.hero-search-icon {
  font-size: 1.2rem;
  color: var(--primary);
  flex-shrink: 0;
}

.hero-search input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 1rem;
  padding: 12px 4px;
  color: var(--text);
  background: transparent;
  direction: rtl;
}

.hero-search input::placeholder {
  color: var(--text-muted);
}

.hero-search-clear {
  display: none;
  background: var(--bg);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 0.95rem;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.hero-search-clear:hover {
  background: var(--red-light);
  color: var(--red);
}

/* ════════════════════════════════════════════════════
   ألوان أغلفة جديدة (أطفال + إنجليزي)
════════════════════════════════════════════════════ */
.cat-banner.children   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.cat-banner.english    { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); }

.book-cover.children   { background: linear-gradient(135deg, #f59e0b, #d97706); }
.book-cover.english    { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); }

.detail-cover.children { background: linear-gradient(135deg, #f59e0b, #d97706); }
.detail-cover.english  { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); }
