/* ================================================================
   PALEDU PRO — Design System v3
   Modern Academic Library Theme
   Fonts: Tajawal (Arabic) + system display
================================================================ */

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

/* ── Custom Properties ─────────────────────────────────── */
:root {
  /* Brand */
  --brand-h:        214;
  --brand-s:        60%;
  --brand-l:        22%;
  --brand:          hsl(var(--brand-h),var(--brand-s),var(--brand-l));
  --brand-light:    hsl(var(--brand-h),var(--brand-s),94%);
  --brand-dark:     hsl(var(--brand-h),var(--brand-s),14%);

  /* Accent */
  --accent:         #f59e0b;
  --accent-2:       #ef4444;
  --accent-green:   #10b981;
  --accent-purple:  #8b5cf6;

  /* Surfaces - Light */
  --bg:             #f0f4f8;
  --surface-0:      #ffffff;
  --surface-1:      #f8fafc;
  --surface-2:      #f1f5f9;
  --surface-3:      #e8edf2;
  --glass:          rgba(255,255,255,0.72);
  --glass-border:   rgba(255,255,255,0.5);

  /* Text */
  --text-1:         #0f172a;
  --text-2:         #334155;
  --text-3:         #64748b;
  --text-4:         #94a3b8;

  /* Borders */
  --border-1:       rgba(0,0,0,0.06);
  --border-2:       rgba(0,0,0,0.10);
  --border-3:       rgba(0,0,0,0.16);

  /* Shadows */
  --shadow-xs:      0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 20px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 40px rgba(0,0,0,0.14);
  --shadow-xl:      0 20px 60px rgba(0,0,0,0.18);

  /* Radii */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   18px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* Transitions */
  --ease:           cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:       cubic-bezier(0, 0, 0.2, 1);
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:         150ms var(--ease);
  --t-base:         220ms var(--ease);
  --t-slow:         380ms var(--ease);

  /* Layout */
  --max-w:          1380px;
  --hdr-h:          62px;
}

/* ── Dark Mode ─────────────────────────────────────────── */
[data-mode="dark"],
@media (prefers-color-scheme: dark) { [data-mode="auto"] {
  --bg:             #080e1a;
  --surface-0:      #0f1825;
  --surface-1:      #141f30;
  --surface-2:      #1a2840;
  --surface-3:      #1f3050;
  --glass:          rgba(15,24,37,0.80);
  --glass-border:   rgba(255,255,255,0.08);
  --text-1:         #f0f6ff;
  --text-2:         #c8d8f0;
  --text-3:         #7a9ab8;
  --text-4:         #3a5a78;
  --border-1:       rgba(255,255,255,0.04);
  --border-2:       rgba(255,255,255,0.08);
  --border-3:       rgba(255,255,255,0.13);
  --shadow-xs:      0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:      0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:      0 8px 40px rgba(0,0,0,0.6);
  --shadow-xl:      0 20px 60px rgba(0,0,0,0.7);
} }

/* Theme Overrides */
[data-theme="ocean"]  { --brand-h:214; --brand-s:70%; }
[data-theme="forest"] { --brand-h:142; --brand-s:60%; --accent:#f59e0b; }
[data-theme="sunset"] { --brand-h:20;  --brand-s:75%; --accent:#fbbf24; }
[data-theme="violet"] { --brand-h:265; --brand-s:65%; --accent:#ec4899; }
[data-theme="rose"]   { --brand-h:340; --brand-s:70%; --accent:#f59e0b; }
[data-theme="slate"]  { --brand-h:215; --brand-s:30%; --accent:#0ea5e9; }

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Tajawal', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.7;
  font-size: 15px;
}
img { max-width: 100%; display: block; }
a  { text-decoration: none; color: inherit; }

/* ── Background Pattern ─────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, hsla(var(--brand-h),60%,60%,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, hsla(var(--brand-h),60%,40%,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

/* ── Glass Card ─────────────────────────────────────────── */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px) saturate(1.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
}

/* ── HEADER ────────────────────────────────────────────── */
.site-header {
  height: var(--hdr-h);
  background: var(--glass);
  border-bottom: 1px solid var(--border-1);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  position: sticky;
  top: 0;
  z-index: 500;
  box-shadow: 0 1px 0 var(--border-1), var(--shadow-sm);
}
[data-mode="dark"] .site-header { background: rgba(8,14,26,0.85); }

.hdr {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Logo */
.logo-a {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-mark {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--brand), hsl(var(--brand-h),var(--brand-s),35%));
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  box-shadow: 0 4px 12px hsla(var(--brand-h),var(--brand-s),35%,0.35);
  flex-shrink: 0;
}
.logo-img { height: 36px; border-radius: var(--r-sm); }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-name { font-size: 15px; font-weight: 800; color: var(--text-1); }
.logo-tag  { font-size: 10px; color: var(--text-3); font-weight: 500; }

/* Back btn */
#back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-3);
  cursor: pointer;
  transition: var(--t-fast);
  flex-shrink: 0;
}
#back-btn:hover { background: var(--brand-light); color: var(--brand); border-color: transparent; }

/* Search */
.hdr-search { flex: 1; max-width: 380px; }
.hdr-search form {
  position: relative;
  display: flex;
  align-items: center;
}
.hdr-search i {
  position: absolute;
  right: 12px;
  color: var(--text-4);
  font-size: 13px;
  pointer-events: none;
  transition: color var(--t-fast);
}
.hdr-search input {
  width: 100%;
  padding: 9px 36px 9px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-full);
  color: var(--text-1);
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: var(--t-base);
}
.hdr-search input::placeholder { color: var(--text-4); }
.hdr-search input:focus {
  background: var(--surface-0);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.12);
}
.hdr-search input:focus ~ i { color: var(--brand); }

/* Nav links */
.hdr-nav { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.nav-a {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--t-fast);
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  position: relative;
}
.nav-a:hover {
  background: var(--surface-2);
  color: var(--brand);
}
.nav-a i { font-size: 13px; }
.nav-btn {
  background: linear-gradient(135deg, var(--brand), hsl(var(--brand-h),var(--brand-s),32%)) !important;
  color: #fff !important;
  font-weight: 700;
  margin-right: 4px;
  box-shadow: 0 2px 8px hsla(var(--brand-h),var(--brand-s),35%,0.30);
}
.nav-btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 14px hsla(var(--brand-h),var(--brand-s),35%,0.38) !important; }

/* Burger */
.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
}
.burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-2);
  border-radius: 2px;
  transition: var(--t-base);
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile Nav */
.mob-nav {
  display: none;
  flex-direction: column;
  padding: 8px 16px 14px;
  background: var(--surface-0);
  border-top: 1px solid var(--border-1);
  gap: 2px;
}
.mob-nav.open { display: flex; }
.mob-nav .nav-a { color: var(--text-2); font-size: 14px; padding: 10px 12px; }
.mob-nav .nav-a:hover { background: var(--surface-2); color: var(--brand); }
.mob-lbl {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 8px 12px 2px;
}
.mob-sep { height: 1px; background: var(--border-1); margin: 4px 0; }

/* ── Dropdown ──────────────────────────────────────────── */
.has-dd { position: relative; }
.dd-menu {
  position: absolute;
  top: calc(100% + 10px);
  min-width: 220px;
  background: var(--surface-0);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top right;
  transition: opacity var(--t-base), transform var(--t-base), visibility var(--t-base);
}
.dd-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.dd-r { right: 0; left: auto; }
.dd-l { left: 0; right: auto; }

.dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: var(--t-fast);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  font-family: 'Tajawal', sans-serif;
  text-align: right;
  text-decoration: none;
}
.dd-item i {
  width: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-4);
  flex-shrink: 0;
}
.dd-item:hover {
  background: var(--surface-2);
  color: var(--brand);
}
.dd-item:hover i { color: var(--brand); }
.dd-head {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.dd-sep { height: 1px; background: var(--border-1); margin: 6px 0; }
.dd-cnt {
  font-size: 10px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-3);
  padding: 2px 8px;
  border-radius: var(--r-full);
  margin-right: auto;
}
.dd-danger { color: #dc2626 !important; }
.dd-danger:hover { background: #fef2f2 !important; }
.dd-chev {
  font-size: 9px;
  color: var(--text-4);
  transition: transform var(--t-base);
}
.has-dd.open .dd-chev { transform: rotate(180deg); }

/* User Button */
.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-full);
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  transition: var(--t-base);
  white-space: nowrap;
}
.user-btn:hover {
  background: var(--brand-light);
  border-color: transparent;
  color: var(--brand);
}
.user-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.user-nm {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Grades Btn */
.grades-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: var(--t-fast);
}
.grades-btn:hover { background: var(--brand-light); color: var(--brand); border-color: transparent; }
.dd-grades { min-width: 240px; max-height: 380px; overflow-y: auto; }
.dd-grades::-webkit-scrollbar { width: 4px; }
.dd-grades::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* Notif btn */
.notif-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  cursor: pointer;
  transition: var(--t-fast);
  font-size: 15px;
}
.notif-btn:hover { background: var(--brand-light); color: var(--brand); border-color: transparent; }
.notif-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: var(--accent-2);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--bg);
}

/* Ann Dropdown */
.dd-anns { min-width: 300px; padding: 10px; }
.ann-dd-card {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  margin-bottom: 6px;
  background: var(--surface-2);
  border-right: 3px solid var(--brand);
  transition: var(--t-fast);
}
.ann-dd-card:hover { background: var(--brand-light); }
.ann-dd-title { font-size: 13px; font-weight: 800; color: var(--brand); margin-bottom: 3px; }
.ann-dd-body  { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.ann-dd-link  { font-size: 12px; font-weight: 700; color: var(--brand); display: inline-block; margin-top: 4px; }

@media (max-width: 768px) {
  .burger { display: flex; }
  .hdr-nav { display: none; }
  .hdr-search { max-width: none; flex: 1; }
  .logo-tag { display: none; }
}
/*@media (max-width: 480px) {
  .hdr-search { display: none; }
}*/

/* ── HERO ──────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 20px 96px;
  text-align: center;
  background: linear-gradient(
    160deg,
    hsl(var(--brand-h),var(--brand-s),12%) 0%,
    hsl(var(--brand-h),var(--brand-s),20%) 50%,
    hsl(var(--brand-h),var(--brand-s),16%) 100%
  );
}
.hero-bg-decoration {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 50%, hsla(var(--brand-h),80%,65%,0.18) 0%, transparent 50%),
    radial-gradient(circle at 85% 50%, hsla(44,100%,65%,0.12) 0%, transparent 45%),
    radial-gradient(circle at 50% 100%, hsla(var(--brand-h),60%,30%,0.3) 0%, transparent 50%);
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  margin-bottom: 20px;
  backdrop-filter: blur(8px);
}
.hero-badge span { color: var(--accent); }
.hero-title {
  font-size: clamp(28px, 6vw, 56px);
  font-weight: 900;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}
.hero-title mark {
  background: linear-gradient(135deg, var(--accent), #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 17px;
  color: rgba(255,255,255,0.72);
  margin-bottom: 36px;
  line-height: 1.7;
  font-weight: 400;
}
.hero-search {
  max-width: 540px;
  margin: 0 auto 28px;
}
.hero-search-box {
  display: flex;
  background: rgba(255,255,255,0.95);
  border-radius: var(--r-full);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.3);
  backdrop-filter: blur(8px);
}
.hero-search-box input {
  flex: 1;
  padding: 16px 22px;
  background: none;
  border: none;
  font-family: 'Tajawal', sans-serif;
  font-size: 15px;
  color: var(--text-1);
  outline: none;
  font-weight: 500;
}
.hero-search-box input::placeholder { color: var(--text-3); }
.hero-search-box button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 24px;
  margin: 6px;
  background: linear-gradient(135deg, var(--brand), hsl(var(--brand-h),var(--brand-s),32%));
  color: #fff;
  border: none;
  border-radius: var(--r-full);
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--t-base);
  box-shadow: 0 4px 14px hsla(var(--brand-h),var(--brand-s),35%,0.4);
}
.hero-search-box button:hover { transform: scale(1.03); }
.hero-chips {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-chip {
  padding: 5px 13px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  transition: var(--t-fast);
  backdrop-filter: blur(4px);
}
.hero-chip:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* ── STATS ─────────────────────────────────────────────── */
.stats-ribbon {
  background: var(--surface-0);
  border-bottom: 1px solid var(--border-1);
}
.stats-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
}
.stat-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 28px;
  border-left: 1px solid var(--border-1);
  flex: 1;
  justify-content: center;
}
.stat-pill:last-child { border-left: none; }
.stat-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-num {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-1);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-lbl { font-size: 11px; color: var(--text-3); font-weight: 600; margin-top: 2px; }

/* ── SECTIONS ──────────────────────────────────────────── */
.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 20px 20px;
}
.sec-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.sec-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sec-title-dot {
  width: 5px;
  height: 22px;
  background: linear-gradient(180deg, var(--brand), var(--accent));
  border-radius: 3px;
  flex-shrink: 0;
}
.view-all {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  transition: var(--t-fast);
}
.view-all:hover {
  background: var(--brand-light);
  border-color: transparent;
}

/* ── GRADE CARDS ───────────────────────────────────────── */
.grades-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.grade-card {
  background: var(--surface-0);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 20px 14px;
  text-align: center;
  text-decoration: none;
  color: var(--text-1);
  transition: var(--t-base);
  display: block;
  position: relative;
  overflow: hidden;
}
.grade-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.05), transparent);
  opacity: 0;
  transition: opacity var(--t-base);
}
.grade-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand);
}
.grade-card:hover::before { opacity: 1; }
.grade-ic { font-size: 28px; display: block; margin-bottom: 8px; }
.grade-lvl-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: var(--r-full);
  margin-bottom: 7px;
  color: #fff;
}
.grade-name { font-size: 13px; font-weight: 700; margin-bottom: 6px; line-height: 1.4; }
.grade-cnt  { font-size: 11px; color: var(--text-3); font-weight: 600; }
.grade-cnt strong { color: var(--accent); font-weight: 800; }

/* ── FILE CARDS ─────────────────────────────────────────── */
.pdf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.pdf-card {
  background: var(--surface-0);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: var(--t-base);
  text-decoration: none;
  color: var(--text-1);
  display: flex;
  flex-direction: column;
  position: relative;
}
.pdf-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-2);
}
.pdf-thumb {
  height: 145px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.pdf-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform var(--t-slow); }
.pdf-card:hover .pdf-thumb img { transform: scale(1.04); }
.pdf-thumb-ph { font-size: 44px; opacity: 0.22; }
.pdf-stripe { height: 3px; }
.pdf-body { padding: 14px; flex: 1; }
.pdf-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--r-full);
  color: #fff;
  letter-spacing: 0.02em;
}
.pdf-title {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-1);
}
.pdf-meta {
  font-size: 11px;
  color: var(--text-4);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 500;
}
.pdf-meta span { display: flex; align-items: center; gap: 3px; }
.pdf-foot {
  padding: 10px 14px;
  background: var(--surface-1);
  border-top: 1px solid var(--border-1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pdf-stats {
  font-size: 10px;
  color: var(--text-4);
  display: flex;
  gap: 12px;
  font-weight: 600;
}
.pdf-btn {
  background: var(--brand);
  color: #fff !important;
  padding: 5px 13px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
  transition: var(--t-fast);
  letter-spacing: 0.02em;
}
.pdf-card:hover .pdf-btn {
  background: linear-gradient(135deg, var(--accent), #fb923c);
}

/* Badges */
.badge-new {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--r-full);
  animation: pulse 2.5s infinite;
  letter-spacing: 0.03em;
}
.badge-imp {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--r-full);
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
  50%      { box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}

/* ── ANNOUNCEMENTS ─────────────────────────────────────── */
.ann-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.ann-body { flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ann-body strong { font-weight: 800; }

/* ── BROWSE LAYOUT ─────────────────────────────────────── */
.browse-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}
@media(max-width:900px){ .browse-wrap{ grid-template-columns:1fr; } }

.sidebar {
  background: var(--surface-0);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  overflow: hidden;
  position: sticky;
  top: calc(var(--hdr-h) + 12px);
  box-shadow: var(--shadow-xs);
}
.sb-sec { padding: 14px; }
.sb-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-1);
}
.sb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: var(--t-fast);
  margin-bottom: 2px;
}
.sb-item:hover { background: var(--surface-2); color: var(--brand); }
.sb-item.on {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 700;
}
.sb-cnt {
  font-size: 10px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-3);
  padding: 2px 8px;
  border-radius: var(--r-full);
}
.sb-item.on .sb-cnt { background: var(--brand); color: #fff; }
.sb-lvl {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 6px 10px 2px;
  margin-top: 5px;
}
.sb-sep { height: 1px; background: var(--border-1); margin: 8px 0; }
.mob-sb-toggle {
  display: none;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--surface-0);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  margin-bottom: 12px;
  width: 100%;
  transition: var(--t-fast);
}
.mob-sb-toggle:hover { background: var(--brand-light); color: var(--brand); }
@media(max-width:900px){
  .mob-sb-toggle { display: flex; }
  .sidebar { display: none; position: static; }
  .sidebar.open { display: block; }
}

/* ── TOOLBAR ───────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar-q { flex: 1; min-width: 160px; position: relative; }
.toolbar-q i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-4); font-size: 13px; pointer-events: none; }
.toolbar-q input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface-0);
  color: var(--text-1);
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: var(--t-base);
}
.toolbar-q input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.10); }
.sort-sel {
  padding: 9px 13px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface-0);
  color: var(--text-2);
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: var(--t-fast);
}
.sort-sel:focus { border-color: var(--brand); }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-0);
  color: var(--text-3);
  border: 1px solid var(--border-2);
  text-decoration: none;
  transition: var(--t-fast);
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
}
.filter-chip:hover { background: var(--brand-light); color: var(--brand); border-color: transparent; }
.filter-chip.on { background: var(--brand); color: #fff; border-color: transparent; }
.clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 700;
  background: #fef2f2;
  color: #dc2626;
  border: none;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  text-decoration: none;
  transition: var(--t-fast);
}
.clear-btn:hover { background: #dc2626; color: #fff; }

/* ── FORMS ─────────────────────────────────────────────── */
.form-card {
  background: var(--surface-0);
  border-radius: var(--r-xl);
  padding: 36px;
  border: 1px solid var(--border-1);
  box-shadow: var(--shadow-md);
}
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--r-md);
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface-1);
  color: var(--text-1);
  outline: none;
  transition: var(--t-base);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand);
  background: var(--surface-0);
  box-shadow: 0 0 0 3px hsla(var(--brand-h),var(--brand-s),var(--brand-l),0.10);
}
.form-textarea { min-height: 100px; resize: vertical; line-height: 1.7; }

/* ── BUTTONS ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 22px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: var(--t-base);
  letter-spacing: 0.01em;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand), hsl(var(--brand-h),var(--brand-s),32%));
  color: #fff;
  box-shadow: 0 4px 14px hsla(var(--brand-h),var(--brand-s),35%,0.30);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px hsla(var(--brand-h),var(--brand-s),35%,0.38); }
.btn-accent  { background: linear-gradient(135deg, var(--accent), #fb923c); color: #fff; box-shadow: 0 4px 14px rgba(245,158,11,0.30); }
.btn-accent:hover { transform: translateY(-2px); }
.btn-ghost   { background: transparent; border: 1.5px solid var(--border-2); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-3); color: var(--text-1); }
.btn-sm   { padding: 7px 14px; font-size: 12px; border-radius: var(--r-sm); }
.btn-full { width: 100%; justify-content: center; }

/* ── ALERTS ────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }

/* ── TABLES ────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  background: var(--surface-2);
  padding: 11px 14px;
  text-align: right;
  font-weight: 700;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: 0.02em;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border-1); vertical-align: middle; color: var(--text-1); }
tr:hover td { background: var(--surface-1); }
tr:last-child td { border-bottom: none; }

/* ── STATUS ────────────────────────────────────────────── */
.s-ok  { background:#f0fdf4; color:#16a34a; border:1px solid #bbf7d0; font-size:10px; font-weight:700; padding:2px 9px; border-radius:var(--r-full); display:inline-block; }
.s-no  { background:#fef2f2; color:#dc2626; border:1px solid #fecaca; font-size:10px; font-weight:700; padding:2px 9px; border-radius:var(--r-full); display:inline-block; }
.s-inf { background:#eff6ff; color:#2563eb; border:1px solid #bfdbfe; font-size:10px; font-weight:700; padding:2px 9px; border-radius:var(--r-full); display:inline-block; }
.s-wrn { background:#fffbeb; color:#d97706; border:1px solid #fde68a; font-size:10px; font-weight:700; padding:2px 9px; border-radius:var(--r-full); display:inline-block; }

/* ── PAGINATION ────────────────────────────────────────── */
.pagination { display:flex; justify-content:center; gap:5px; margin-top:28px; flex-wrap:wrap; }
.page-btn {
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  background: var(--surface-0);
  color: var(--text-2);
  border: 1px solid var(--border-2);
  transition: var(--t-fast);
}
.page-btn:hover { background: var(--brand-light); color: var(--brand); border-color: transparent; }
.page-btn.active { background: var(--brand); color: #fff; border-color: transparent; }

/* ── EMPTY STATE ───────────────────────────────────────── */
.empty-state { text-align:center; padding:60px 20px; color:var(--text-4); }
.empty-state i { font-size:48px; display:block; margin-bottom:14px; opacity:0.35; }
.empty-state p { font-size:15px; font-weight:600; color:var(--text-3); }

/* ── SHARE BUTTONS ─────────────────────────────────────── */
.share-btns { display:flex; gap:8px; flex-wrap:wrap; }
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: var(--t-base);
  border: none;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
}
.share-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.sb-wa { background:#25d366; color:#fff; box-shadow:0 3px 10px rgba(37,211,102,.3); }
.sb-fb { background:#1877f2; color:#fff; box-shadow:0 3px 10px rgba(24,119,242,.3); }
.sb-tw { background:#1da1f2; color:#fff; box-shadow:0 3px 10px rgba(29,161,242,.3); }
.sb-sn { background:#fffc00; color:#333; box-shadow:0 3px 10px rgba(255,252,0,.3); }
.sb-ig { background:linear-gradient(135deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); color:#fff; }
.sb-cp { background:var(--surface-2); color:var(--text-2); border:1px solid var(--border-2); }

/* ── FOOTER ────────────────────────────────────────────── */
.site-footer {
  background: var(--text-1);
  padding: 40px 20px 24px;
  margin-top: 60px;
}
.footer-wrap { max-width:var(--max-w); margin:0 auto; }
.footer-top {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 40px;
  padding-bottom: 32px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-brand .logo-mark { margin-bottom: 12px; }
.footer-brand p { font-size: 13px; color: rgba(255,255,255,0.5); line-height: 1.7; margin-top: 10px; }
.footer-col h4 { font-size: 12px; font-weight: 800; color: rgba(255,255,255,0.9); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 14px; }
.footer-col a { display: block; font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 8px; text-decoration: none; transition: color var(--t-fast); font-weight: 500; }
.footer-col a:hover { color: rgba(255,255,255,0.9); }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-copy { font-size: 12px; color: rgba(255,255,255,0.35); font-weight: 500; }
.footer-links { display:flex; gap:16px; }
.footer-links a { font-size:12px; color:rgba(255,255,255,0.4); text-decoration:none; transition:color var(--t-fast); }
.footer-links a:hover { color:rgba(255,255,255,0.8); }
@media(max-width:768px){ .footer-top{ grid-template-columns:1fr; gap:28px; } }

/* ── TOAST ─────────────────────────────────────────────── */
.toast-wrap {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  min-width: 260px;
  max-width: 92vw;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  background: var(--surface-0);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xl);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  border: 1px solid var(--border-2);
  animation: slideUp .28s var(--ease-spring) both;
  pointer-events: auto;
}
.toast.hide { animation: fadeOut .22s var(--ease) forwards; }
@keyframes slideUp { from { opacity:0; transform:translateY(14px) scale(0.95); } }
@keyframes fadeOut { to   { opacity:0; transform:translateY(-4px) scale(0.97); } }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-success { border-right: 3px solid #10b981; }
.toast-error   { border-right: 3px solid #ef4444; }
.toast-warning { border-right: 3px solid #f59e0b; }
.toast-info    { border-right: 3px solid var(--brand); }

/* ── SCROLL + MISC ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }

.card-hover {
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes skeleton-wave { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .grades-grid { grid-template-columns: repeat(2,1fr); }
  .pdf-grid    { grid-template-columns: 1fr; }
  .stats-inner { flex-direction: column; gap: 0; }
  .stat-pill   { border-left: none; border-bottom: 1px solid var(--border-1); justify-content: flex-start; padding: 14px 20px; }
  .stat-pill:last-child { border-bottom: none; }
  .section     { padding: 32px 14px 16px; }
  .hero        { padding: 48px 16px 64px; }
  .footer-bottom { flex-direction: column; text-align: center; }
}
@media (max-width: 480px) {
  .grades-grid { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .form-card   { padding: 22px 16px; }
}

/* ── THEME TOGGLE FLOAT ─────────────────────────────────── */
.theme-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px hsla(var(--brand-h),var(--brand-s),35%,0.35);
  transition: var(--t-base);
  z-index: 400;
}
.theme-fab:hover { transform: scale(1.1) rotate(15deg); }

/* ── PWA Install Banner ─────────────────────────────────── */
.pwa-banner {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--surface-0);
  border-top: 1px solid var(--border-2);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.10);
  z-index: 800;
  animation: slideUp .35s var(--ease-out);
}
.pwa-banner h4 { font-size:14px; font-weight:800; color:var(--text-1); }
.pwa-banner p  { font-size:12px; color:var(--text-3); }

/* ✅ إصلاح: خاصية hidden كانت تُلغى بـ display:flex فيظهر مربع أحمر فارغ دائماً */
[hidden]{display:none!important}
