/* ═══════════════════════════════════════════════════
   المنصة العراقية للدراسة - CSS الرئيسي
   نظام ألوان: Coffee Bean / Black Cherry / Racing Red / Alabaster Grey
═══════════════════════════════════════════════════ */

/* ── متغيرات الألوان ─────────────────────────── */
:root {
  /* الخلفيات الغامقة */
  --coffee:   #1A0706;   /* الخلفية الأساسية لكل الموقع */
  --coffee-2: #230A08;   /* سطح مرتفع قليلا (هيدر / فوتر / لوحة التحكم) */
  --coffee-3: #2C0D0A;

  /* أسطح البطاقات */
  --cherry:   #55100D;   /* خلفية البطاقات والأقسام */
  --cherry-2: #6B1512;   /* حدود وتدرجات */
  --cherry-3: #82201B;   /* هوفر */

  /* اللون المميز */
  --red:      #DD0200;
  --red-2:    #FF3823;   /* فاتح - هوفر / تمييز */
  --red-dark: #A60300;   /* غامق - تدرجات / ضغط */
  --red-glow: rgba(221,2,0,.4);

  /* النصوص والأسطح الفاتحة */
  --alabaster:     #D9D9D9;
  --alabaster-dim: #B6ADAB;
  --alabaster-2:   #EFEFEE;
  --white:         #FFFFFF;

  --line:        rgba(217,217,217,.14);
  --line-strong: rgba(217,217,217,.28);

  --shadow-sm: 0 2px 8px rgba(0,0,0,.35);
  --shadow-md: 0 8px 20px rgba(0,0,0,.4);
  --shadow-lg: 0 18px 40px rgba(0,0,0,.48);
  --shadow-xl: 0 30px 65px rgba(0,0,0,.55);
  --glow:      0 10px 26px var(--red-glow);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition: .22s cubic-bezier(.4,0,.2,1);
  --font: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}

/* ── ريست وأساسيات ──────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  color: var(--alabaster);
  background: var(--coffee);
  direction: rtl;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--red-2); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--red); }
ul  { list-style: none; }
::selection { background: var(--red); color: var(--white); }
::placeholder { color: var(--alabaster-dim); opacity: .55; }

/* ── Container ──────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── شريط علوي ──────────────────────────────── */
.top-bar {
  background: var(--coffee-2);
  color: var(--alabaster);
  font-size: .85rem;
  text-align: center;
  padding: .45rem 0;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}

/* ── الهيدر ─────────────────────────────────── */
.header {
  background: var(--coffee-2);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: .85rem 0;
}

/* الشعار */
.logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: inherit;
  text-decoration: none;
}

.logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 900;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px var(--red-glow);
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-main {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--white);
}

.logo-sub {
  font-size: .82rem;
  color: var(--red-2);
  font-weight: 600;
}

/* القائمة */
.nav { display: flex; }

.nav-list {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.nav-link, .nav-btn {
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 600;
  color: var(--alabaster-dim);
  padding: .5rem .9rem;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: .3rem;
}

.nav-link:hover, .nav-btn:hover {
  color: var(--white);
  background: rgba(221,2,0,.14);
}

.nav-link.active {
  color: var(--white);
  background: var(--red);
}

/* Dropdown */
.nav-dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  background: var(--coffee-3);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--line-strong);
  min-width: 225px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition);
  z-index: 100;
  overflow: hidden;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li a {
  display: block;
  padding: .7rem 1.1rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--alabaster);
  transition: all var(--transition);
  border-bottom: 1px solid var(--line);
}

.dropdown-menu li:last-child a { border-bottom: none; }

.dropdown-menu li a:hover {
  background: rgba(221,2,0,.16);
  color: var(--white);
  padding-right: 1.4rem;
}

.arrow { font-size: .7rem; transition: transform var(--transition); }
.nav-dropdown:hover .arrow { transform: rotate(180deg); }

/* همبرجر */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
}

.hamburger span {
  width: 26px;
  height: 2.5px;
  background: var(--alabaster);
  border-radius: var(--radius-full);
  transition: all var(--transition);
  display: block;
}

.hamburger.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ── بطل الصفحة الرئيسية ──────────────────── */
.hero {
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(221,2,0,.22), transparent 60%),
    linear-gradient(160deg, var(--coffee) 0%, var(--cherry) 100%);
  color: var(--white);
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.035'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 780px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: rgba(221,2,0,.15);
  border: 1px solid rgba(221,2,0,.4);
  color: var(--red-2);
  padding: .4rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 1.25rem;
}

.hero h1 .highlight {
  color: var(--red-2);
  position: relative;
}

.hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,.82);
  max-width: 620px;
  margin: 0 auto 2.5rem;
  line-height: 1.8;
}

/* إحصاءات البطل */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 2.5rem;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 900;
  color: var(--red-2);
  line-height: 1;
}

.stat-label {
  font-size: .8rem;
  color: rgba(255,255,255,.65);
  margin-top: .25rem;
}

/* ── أزرار الأقسام الرئيسية ──────────────────── */
.sections {
  padding: 4rem 0;
}

.section-title {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-title h2 {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: .5rem;
}

.section-title p {
  color: var(--alabaster-dim);
  font-size: 1rem;
}

.section-title .line {
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--red), var(--cherry-2));
  border-radius: var(--radius-full);
  margin: .8rem auto 0;
}

/* ══════════════════════════════════════════════
   المراحل الدراسية (الصفحة الرئيسية)
══════════════════════════════════════════════ */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.stage-card {
  background: var(--cherry);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  text-align: center;
  transition: all .3s ease;
  position: relative;
  overflow: hidden;
  display: block;
  color: inherit;
}

.stage-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(221,2,0,.1), transparent 55%);
  opacity: 0;
  transition: opacity var(--transition);
}

.stage-card:hover {
  transform: translateY(-6px);
  border-color: var(--red);
  box-shadow: var(--shadow-xl), var(--glow);
}

.stage-card:hover::before { opacity: 1; }

.stage-icon {
  font-size: 2.75rem;
  margin-bottom: .75rem;
  position: relative;
}

.stage-card h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: .4rem;
  position: relative;
}

.stage-card p {
  font-size: .85rem;
  color: var(--alabaster-dim);
  line-height: 1.6;
  position: relative;
}

.stage-count {
  display: inline-block;
  margin-top: 1rem;
  background: rgba(221,2,0,.15);
  color: var(--red-2);
  border: 1px solid rgba(221,2,0,.35);
  padding: .3rem .9rem;
  border-radius: var(--radius-full);
  font-size: .78rem;
  font-weight: 700;
  position: relative;
}

/* شبكة الصفوف داخل مرحلة */
.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.grade-card {
  background: var(--cherry);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.6rem 1rem;
  text-align: center;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--alabaster);
  transition: all var(--transition);
  display: block;
}

.grade-card:hover {
  border-color: var(--red);
  background: var(--cherry-3);
  color: var(--white);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.grade-card .grade-sub {
  display: block;
  font-size: .76rem;
  font-weight: 500;
  color: var(--alabaster-dim);
  margin-top: .3rem;
}

/* شبكة اختيار الفرع */
.branch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.25rem;
}

.branch-pick-card {
  background: var(--cherry);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.9rem 1.25rem;
  text-align: center;
  transition: all var(--transition);
  display: block;
}

.branch-pick-card:hover {
  border-color: var(--red);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.bp-icon { font-size: 2.1rem; margin-bottom: .6rem; }

.branch-pick-card h4 {
  color: var(--white);
  font-size: 1.05rem;
  font-weight: 800;
}

.branch-pick-card p {
  font-size: .8rem;
  color: var(--alabaster-dim);
  margin-top: .3rem;
}

/* شارات مسار التصفح (المرحلة / الصف / الفرع) */
.crumb-pills {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.crumb-pill {
  background: var(--cherry);
  border: 1px solid var(--line);
  color: var(--alabaster-dim);
  padding: .4rem 1rem;
  border-radius: var(--radius-full);
  font-size: .82rem;
  font-weight: 600;
}

.crumb-pill.current {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

/* بطاقات الأقسام (وزاريات/ملفات لكل فرع) */
.branch-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.branch-card {
  background: var(--cherry);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all .3s ease;
  border: 1px solid var(--line);
  position: relative;
}

.branch-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl), var(--glow);
  border-color: var(--red-2);
}

.branch-card-header {
  background: linear-gradient(135deg, var(--coffee), var(--red-dark));
  padding: 2rem 1.5rem 1.5rem;
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.branch-card-header.grad-b { background: linear-gradient(135deg, var(--cherry), var(--red-dark)); }
.branch-card-header.grad-c { background: linear-gradient(135deg, var(--red-dark), var(--red)); }
.branch-card-header.grad-d { background: linear-gradient(135deg, var(--coffee-3), var(--cherry-2)); }

.branch-card-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 30px;
  background: var(--cherry);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.branch-icon {
  font-size: 2.5rem;
  margin-bottom: .5rem;
}

.branch-card-header h3 {
  font-size: 1.4rem;
  font-weight: 800;
}

.branch-card-header p {
  font-size: .85rem;
  opacity: .85;
  margin-top: .25rem;
}

.branch-card-body {
  padding: 1.5rem;
}

.branch-links {
  display: flex;
  flex-direction: column;
  gap: .7rem;
}

.branch-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.1rem;
  background: var(--coffee-2);
  border-radius: var(--radius-md);
  color: var(--alabaster);
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid var(--line);
  transition: all var(--transition);
}

.branch-link:hover {
  background: rgba(221,2,0,.1);
  border-color: var(--red);
  color: var(--white);
  padding-right: 1.4rem;
}

.branch-link .link-arrow {
  color: var(--red-2);
  font-size: 1.1rem;
}

/* ── صفحة الاسئلة الوزارية ──────────────────── */
.page-header {
  background: linear-gradient(135deg, var(--coffee), var(--cherry));
  color: var(--white);
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--line);
}

.page-header h1 {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 800;
  margin-bottom: .5rem;
}

.page-header .breadcrumb,
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .88rem;
  color: rgba(255,255,255,.7);
  flex-wrap: wrap;
}

.page-header .breadcrumb a,
.breadcrumb a {
  color: var(--red-2);
}

/* شبكة مركز الاسئلة الوزارية */
.exam-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

/* فلتر الاسئلة */
.filter-section {
  background: var(--cherry);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  margin: 2rem 0;
  border: 1px solid var(--line);
}

.filter-section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* سنوات الفلتر */
.filter-years {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1.25rem;
}

.year-btn {
  padding: .5rem 1rem;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-full);
  background: none;
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  color: var(--alabaster-dim);
  cursor: pointer;
  transition: all var(--transition);
}

.year-btn:hover, .year-btn.active {
  border-color: var(--red);
  background: var(--red);
  color: var(--white);
}

/* ادوار الفلتر */
.filter-sessions {
  display: none;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 1.25rem;
  animation: fadeIn .3s ease;
}

.filter-sessions.visible { display: flex; }

.session-btn {
  padding: .5rem 1.1rem;
  border: 2px solid rgba(221,2,0,.4);
  border-radius: var(--radius-full);
  background: rgba(221,2,0,.08);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  color: var(--red-2);
  cursor: pointer;
  transition: all var(--transition);
}

.session-btn:hover, .session-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

/* مواد الفلتر */
.filter-subjects {
  display: none;
  flex-direction: column;
  gap: .5rem;
  animation: fadeIn .3s ease;
}

.filter-subjects.visible { display: flex; }

.subject-item {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  overflow: hidden;
}

.subject-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.1rem;
  background: var(--coffee-2);
  cursor: pointer;
  font-weight: 700;
  color: var(--alabaster);
  transition: all var(--transition);
  border: none;
  width: 100%;
  font-family: var(--font);
  font-size: .95rem;
}

.subject-header:hover {
  background: rgba(221,2,0,.12);
  color: var(--white);
}

.subject-header.open {
  background: var(--red);
  color: var(--white);
}

.subject-links {
  display: none;
  padding: .75rem;
  background: var(--coffee);
  flex-direction: column;
  gap: .5rem;
}

.subject-links.visible { display: flex; }

.question-link-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--cherry);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  color: var(--alabaster);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.question-link-item:hover {
  border-color: var(--red);
  color: var(--white);
  background: var(--cherry-3);
}

.question-link-item .ql-year {
  font-size: .78rem;
  color: var(--alabaster-dim);
  font-weight: 400;
}

/* ── بطاقة السؤال المنفرد ──────────────────── */
.question-page {
  padding: 2rem 0 3rem;
}

.question-card {
  background: var(--cherry);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin-bottom: 2rem;
  border: 1px solid var(--line);
}

.question-meta {
  background: linear-gradient(90deg, var(--coffee), var(--red-dark));
  color: var(--white);
  padding: 1.25rem 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: rgba(255,255,255,.15);
  padding: .3rem .8rem;
  border-radius: var(--radius-full);
  font-size: .82rem;
  font-weight: 600;
}

.meta-badge.gold {
  background: rgba(255,255,255,.25);
  color: var(--white);
}

.question-images {
  padding: 1.75rem;
}

.question-images h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--alabaster-dim);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.question-img {
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  max-width: 100%;
  cursor: zoom-in;
  transition: transform var(--transition);
}

.question-img:hover { transform: scale(1.01); }

/* أزرار الحلول */
.solution-btns {
  display: flex;
  gap: 1rem;
  padding: 0 1.75rem 1.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: var(--white);
  box-shadow: 0 4px 14px var(--red-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--red-glow);
  color: var(--white);
}

/* زر ثانوي فاتح (يستخدم اسم الكلاس القديم btn-gold للتوافق) */
.btn-gold {
  background: var(--alabaster);
  color: var(--coffee);
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  background: var(--white);
  color: var(--coffee);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--red);
  color: var(--red-2);
}

.btn-outline:hover {
  background: var(--red);
  color: var(--white);
}

/* ── صفحة الملفات ──────────────────────────── */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 2rem 0;
}

.subject-card {
  background: var(--cherry);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: all .3s ease;
}

.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--red-2);
}

.subject-card-header {
  background: var(--coffee-2);
  border-bottom: 3px solid var(--red);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.subject-emoji { font-size: 1.5rem; }

.subject-card-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--white);
}

.subject-card-body { padding: 1rem; }

.category-links { display: flex; flex-direction: column; gap: .5rem; }

.category-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem .9rem;
  background: var(--coffee-2);
  border-radius: var(--radius-sm);
  color: var(--alabaster);
  font-size: .9rem;
  font-weight: 600;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.category-link:hover {
  background: rgba(221,2,0,.12);
  border-color: var(--red-2);
  color: var(--white);
}

/* بطاقات الملفات */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.file-card {
  background: var(--cherry);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: all .3s ease;
}

.file-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-strong);
}

.file-card-img {
  height: 180px;
  background: var(--coffee-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.file-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-card-img .file-placeholder {
  font-size: 3.5rem;
  color: var(--alabaster-dim);
}

.file-type-badge {
  position: absolute;
  top: .75rem;
  left: .75rem;
  background: var(--red);
  color: var(--white);
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: var(--radius-full);
}

.file-card-body { padding: 1rem 1.1rem; }

.file-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: .5rem;
  line-height: 1.4;
}

.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .9rem;
}

.file-meta span {
  font-size: .78rem;
  color: var(--alabaster-dim);
  display: flex;
  align-items: center;
  gap: .25rem;
}

/* ── صفحة تحميل الملف ──────────────────────── */
.download-page {
  padding: 2.5rem 0;
}

.download-card {
  background: var(--cherry);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 280px 1fr;
  border: 1px solid var(--line);
}

.download-cover {
  background: var(--coffee-2);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  overflow: hidden;
}

.download-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.download-info {
  padding: 2rem;
}

.download-info h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 1rem;
  line-height: 1.35;
}

.download-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin: 1.25rem 0;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.detail-label {
  font-size: .78rem;
  color: var(--alabaster-dim);
  font-weight: 600;
  text-transform: uppercase;
}

.detail-value {
  font-size: .95rem;
  font-weight: 700;
  color: var(--alabaster);
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: var(--white);
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 800;
  margin-top: 1.5rem;
  box-shadow: 0 4px 16px var(--red-glow);
  transition: all var(--transition);
  text-align: center;
  width: 100%;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--red-glow);
  color: var(--white);
}

/* ── لوحة التحكم ────────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--coffee-2);
}

.admin-sidebar {
  background: var(--coffee);
  color: var(--white);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

.admin-logo {
  padding: 1rem 1.5rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 1rem;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.5rem;
  color: rgba(255,255,255,.75);
  font-weight: 600;
  font-size: .9rem;
  transition: all var(--transition);
  border-right: 3px solid transparent;
  text-decoration: none;
}

.admin-nav a:hover, .admin-nav a.active {
  background: rgba(255,255,255,.08);
  color: var(--red-2);
  border-right: 3px solid var(--red);
}

.admin-main {
  background: var(--coffee-2);
  padding: 2rem;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.admin-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
}

/* بطاقات احصاءات الداشبورد */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--cherry);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-card-icon.blue { background: rgba(221,2,0,.16); }
.stat-card-icon.gold { background: rgba(217,217,217,.14); }

.stat-card-num {
  font-size: 2rem;
  font-weight: 900;
  color: var(--white);
  line-height: 1;
}

.stat-card-label {
  font-size: .82rem;
  color: var(--alabaster-dim);
  font-weight: 500;
}

/* نماذج الادمن */
.admin-form {
  background: var(--cherry);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  border: 1px solid var(--line);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.form-group { display: flex; flex-direction: column; gap: .4rem; }

.form-group label {
  font-size: .88rem;
  font-weight: 700;
  color: var(--alabaster);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: .65rem .9rem;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .9rem;
  color: var(--alabaster);
  background: var(--coffee-2);
  transition: border-color var(--transition);
  outline: none;
  direction: rtl;
}

.form-group select { color-scheme: dark; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(221,2,0,.18);
}

/* منطقة رفع الصور */
.upload-zone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--coffee-2);
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--red);
  background: rgba(221,2,0,.06);
}

.upload-zone input[type="file"] { display: none; }

.upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1rem;
}

.upload-preview img {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
}

/* ── الفوتر ──────────────────────────────────── */
.footer {
  background: var(--coffee-2);
  color: rgba(217,217,217,.8);
  padding: 3.5rem 0 0;
  margin-top: auto;
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
}

.footer-desc {
  font-size: .9rem;
  line-height: 1.8;
  color: rgba(217,217,217,.6);
  margin-top: 1rem;
}

.footer h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--red-2);
  margin-bottom: 1rem;
}

.footer-links li { margin-bottom: .5rem; }

.footer-links a {
  color: rgba(217,217,217,.65);
  font-size: .88rem;
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--red-2); }

.footer-bottom {
  border-top: 1px solid rgba(217,217,217,.1);
  padding: 1.25rem 0;
  text-align: center;
  font-size: .85rem;
  color: rgba(217,217,217,.45);
}

/* ── مساعد: تنبيهات ─────────────────────────── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.alert-success { background: rgba(16,185,129,.14); color: #6ee7b7; border: 1px solid rgba(16,185,129,.4); }
.alert-error   { background: rgba(221,2,0,.14);    color: #ff9a90; border: 1px solid rgba(221,2,0,.4); }
.alert-info    { background: rgba(217,217,217,.1); color: var(--alabaster); border: 1px solid var(--line-strong); }

/* ── Loading ─────────────────────────────────── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--alabaster-dim);
  gap: .75rem;
  font-size: .95rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

/* ── Image Lightbox ──────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all .25s ease;
}

.lightbox.open { opacity: 1; visibility: visible; }

.lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(255,255,255,.15);
  color: var(--white);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition);
}

.lightbox-close:hover { background: rgba(255,255,255,.3); }

/* ── Keyframes ───────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

.animate-in { animation: slideUp .4s ease both; }

/* ── الاستجابة للشاشات الصغيرة ──────────────── */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .download-card { grid-template-columns: 1fr; }
  .download-cover { min-height: 200px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
}

@media (max-width: 768px) {
  .nav { display: none; }
  .nav.open { display: flex; position: fixed; inset: 0; top: 0; background: var(--coffee-2); z-index: 999; padding-top: 80px; flex-direction: column; overflow-y: auto; }
  .nav-list { flex-direction: column; width: 100%; padding: 1rem; gap: .25rem; }
  .nav-link, .nav-btn { width: 100%; justify-content: space-between; font-size: 1.1rem; padding: .9rem 1rem; }
  .dropdown-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: none; background: var(--coffee-3); margin: .25rem 0 .5rem; border-radius: var(--radius-md); }
  .hamburger { display: flex; }
  .hero { padding: 3rem 0 2.5rem; }
  .hero-stats { gap: 1.5rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .download-details { grid-template-columns: 1fr; }
  .branch-cards { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.65rem; }
  .section-title h2 { font-size: 1.5rem; }
  .page-header h1 { font-size: 1.35rem; }
  .stat-number { font-size: 1.6rem; }
}

/* ── Reduced Motion ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
