@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

/* =========================================
   1. Variables & Root
   ========================================= */
:root {
  /* Colors */
  --color-brand: #2980b9;
  --color-brand-dark: #1a5276;
  --color-highlight: #ff7f50;
  --color-success: #48bb78;
  --color-success-dark: #218838;
  --color-error: #dc3545;
  --color-text-main: #2c3e50;
  --color-text-muted: #6c757d;
  --color-text-inverted: #f0f2f5;
  --color-text-subtle: #a8b2c1;
  --color-white: #ffffff;
  --color-bg-light: #f0f2f5;
  --color-bg-white: #ffffff;
  --color-bg-dark: #121212;
  --color-bg-dark-alt: #1e1e1e;
  
  /* Borders */
  --border-light: #e9ecef;
  --border-dark: #30363d;
  
  /* Spacing & Layout */
  --radius-sm: 8px;
  --radius-md: 12px;
  --container-width: 1200px;
  --header-height: 70px;
  --card-width: 220px;
  
  /* Transitions */
  --transition-base: 0.3s ease;
}

/* =========================================
   2. Reset & Base Styles
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  direction: rtl;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  padding-top: var(--header-height);
  font-family: 'Tajawal', Tahoma, Arial, sans-serif;
  line-height: 1.6;
  color: var(--color-text-main);
  background-color: var(--color-bg-light);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

/* Scrollbar */
html::-webkit-scrollbar { width: 10px; }
html::-webkit-scrollbar-track { background: var(--color-bg-light); }
html::-webkit-scrollbar-thumb { background-color: var(--color-brand); border-radius: 0; }
html::-webkit-scrollbar-thumb:hover { background-color: var(--color-brand-dark); }
body { scrollbar-width: thin; scrollbar-color: var(--color-brand) var(--color-bg-light); }

/* =========================================
   3. Layout Utilities
   ========================================= */
.main { flex: 1; }

.container {
  max-width: var(--container-width);
  margin-inline: auto;
  padding: 0 20px;
}

.section { padding: 4rem 0; }
.section-title { 
  font-size: 2.5rem; 
  margin-bottom: 3rem; 
  text-align: center; 
  font-weight: 600; 
  color: var(--color-text-main); 
}

.grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}
.grid--institutions {
  display: grid;
  gap: 0.75rem;
  width: 100%;
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 767px) {
  .grid--institutions { grid-template-columns: 1fr; }
}

/* =========================================
   4. Shared Components
   ========================================= */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-white);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn--primary { background: var(--color-brand); }
.btn--primary:hover { background: var(--color-brand-dark); }

.btn--success { background: var(--color-success); }
.btn--success:hover { background: var(--color-success-dark); }

.btn--sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn i { font-size: 0.9em; }

/* --- Unified Social System --- */
.social-links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.hero-socials { justify-content: center; }
.footer-social, .developer-socials { justify-content: flex-start; }

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  text-decoration: none;
  color: var(--color-text-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  background-color: rgba(58, 134, 255, 0.05);
  font-size: 1rem;
}
.social-link:hover { 
  color: var(--color-brand); 
  background-color: rgba(58, 134, 255, 0.15);
}

/* --- Icon Box --- */
.icon-box { 
  width: 50px; 
  height: 50px; 
  min-width: 50px; 
  min-height: 50px;
  border-radius: var(--radius-sm); 
  background-color: var(--color-bg-light); 
  border: 1px solid var(--border-light); 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  overflow: hidden;
  flex-shrink: 0;
  padding: 0;
  margin: 0 auto;
}

.icon-box-icon { font-size: 1.5rem; color: var(--color-brand); opacity: 0.85; }
.icon-box-icon--number { font-size: 1.3rem; font-weight: 700; }
.icon-box-image { width: 100%; height: 100%; object-fit: contain; padding: 2px; }

/* --- Card Content Helpers --- */
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin: 0.25rem 0;
  white-space: normal;
  width: 100%;
  flex-grow: 1;
}

.card-description { color: var(--color-text-muted); font-size: 1rem; }
.card-year { font-size: 1rem; color: var(--color-text-muted); margin-top: -0.25rem; }

.card-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* --- Navigation Card (Unified) --- */
.card-nav {
  display: flex;
  flex-direction: column;
  align-items: center; /* Center content horizontally */
  text-align: center;
  background: var(--color-bg-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  transition: all var(--transition-base);
  width: var(--card-width);
  flex-shrink: 0;
  padding: 1.5rem;
  gap: 0.75rem;
  justify-content: space-between;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  color: inherit;
  text-decoration: none;
  min-height: 240px;
}

.card-nav:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: var(--color-brand);
}

/* Disabled State */
.card-nav--disabled { 
  opacity: 1;
  cursor: not-allowed !important; 
  background-color: #e9ecef;
  color: #adb5bd;
  border-color: #dee2e6;
  box-shadow: none;
}
.card-nav--disabled:hover {
  transform: none;
  box-shadow: none;
  border-color: #dee2e6;
}
.card-nav--disabled .icon-box {
  background-color: #dee2e6;
  opacity: 0.5;
  filter: grayscale(100%);
}
.card-nav--disabled .btn {
  pointer-events: none;
  background-color: #ced4da;
  color: #fff;
}

/* --- Exam File Card --- */
.card-exam-file {
  display: flex;
  flex-direction: column;
  text-align: center;
  background: var(--color-bg-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  transition: all var(--transition-base);
  width: 180px;
  flex-shrink: 0;
  padding: 1.5rem;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
  min-height: 240px;
}
.card-exam-file .card-title { margin-bottom: 0; }

/* --- Book Item --- */
.book-item {
  display: flex;
  flex-direction: column;
  text-align: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  width: 180px;
}
.book-item-cover-wrapper { 
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.book-item-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-item-placeholder { 
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
  background: var(--color-bg-light); 
  display: none; 
  align-items: center; justify-content: center; 
  font-size: 2.5rem; 
  color: var(--color-text-muted); 
}
.book-item-cover-wrapper.has-error .book-item-placeholder { display: flex; }
.book-item-cover-wrapper.has-error .book-item-cover { display: none; }

.book-item-loading {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--color-bg-light);
  display: none;
  align-items: center; justify-content: center;
  font-size: 2rem;
  color: var(--color-brand);
}

canvas.book-item-cover {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-item-placeholder--file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: var(--color-bg-white);
  padding: 3.5rem 1rem 0.5rem 1rem;
  gap: 0.25rem;
}

.book-item-title { 
  font-size: 0.9rem; 
  font-weight: 600; 
  padding: 0.5rem 0.25rem 0 0.25rem;
  overflow: hidden;
  position: relative;
}
.book-item-title span {
  display: inline-block;
  white-space: nowrap;
  animation: marquee 8s linear infinite;
  animation-play-state: running;
}
.book-item-title span:not(.is-long) {
  animation: none;
}

.book-item-description { 
  font-size: 0.8rem; 
  color: var(--color-text-muted); 
  padding: 0 0.25rem; 
  margin-top: -0.25rem;
  overflow: hidden;
  position: relative;
}
.book-item-description span {
  display: inline-block;
  white-space: nowrap;
  animation: marquee 8s linear infinite;
  animation-play-state: running;
}
.book-item-description span:not(.is-long) {
  animation: none;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  10% { transform: translateX(0); }
  90% { transform: translateX(calc(100% - 150px)); }
  100% { transform: translateX(calc(100% - 150px)); }
}
.book-item-actions { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 0.5rem; }

/* Unified Button Classes */
.btn-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  width: auto; /* Appropriate size for word size */
  min-width: 80px; /* Ensure minimum clickable area */
  border-radius: var(--radius-sm);
  background: var(--color-brand);
  color: white;
  text-align: center;
  text-decoration: none !important;
  transition: background-color 0.2s ease;
  border: none;
  cursor: pointer;
}
.btn-nav:hover { background: var(--color-brand-dark); }

.btn-action {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  flex: 1 1 auto;
  min-width: 60px;
  max-width: 100px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: white;
  text-decoration: none !important;
  transition: opacity 0.2s;
  border: none;
  cursor: pointer;
}
.btn-action:hover { opacity: 0.9; }

.btn-action--view { background: var(--color-brand); }
.btn-action--download { background: var(--color-success); }

.book-item-actions { margin-top: auto; display: flex; flex-wrap: nowrap; justify-content: center; width: 100%; gap: 0.35rem; }

/* حجم الملف - شارة بسيطة */
.badge-size {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  z-index: 1;
}

/* --- Institution Item --- */
.institution {
  background: var(--color-bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.institution-number { color: var(--color-text-muted); font-weight: 600; }

.institution-placeholder { display: none; font-size: 2rem; color: var(--color-text-muted); }
.icon-box.has-error .institution-placeholder { display: flex; }
.icon-box.has-error .icon-box-image { display: none; }



.institution-info { flex-grow: 1; overflow: hidden; }
.institution-name { 
  font-size: 1rem; 
  font-weight: 600; 
  margin-bottom: 0.25rem; 
  overflow: hidden;
  position: relative;
}
.institution-name span {
  display: inline-block;
  white-space: nowrap;
  animation: marquee 8s linear infinite;
}
.institution-name span:not(.is-long) {
  animation: none;
}
.institution-meta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.institution-location { font-size: 0.85rem; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.institution-link { 
  display: inline-flex; align-items: center; gap: 0.4rem; 
  text-decoration: none; color: var(--color-brand); 
  font-size: 0.85rem; font-weight: 600; 
  white-space: nowrap;
}
.institution-link:hover { color: var(--color-brand-dark); }

/* =========================================
   5. Header & Navigation
   ========================================= */
.header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 15px rgba(0,0,0,0.05);
  backdrop-filter: blur(10px);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.logo-img { width: 40px; height: auto; }
.logo-text { font-size: 1.5rem; font-weight: 800; color: var(--color-brand-dark); }



/* Hamburger */
.hamburger { 
  display: none; 
  width: 44px; 
  height: 44px; 
  padding: 10px; 
  cursor: pointer; 
  background: transparent; 
  border: none; 
  border: none; 
  z-index: 10003; 
  position: relative; 
}
.hamburger-box { display: block; width: 100%; height: 100%; position: relative; }
.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after { 
  width: 24px; 
  height: 2px; 
  background-color: var(--color-text-main); 
  border-radius: 4px; 
  position: absolute; 
  transition: transform 0.2s ease-in-out, top 0.2s ease-in-out; 
  right: 0; 
}
.hamburger-inner { top: 50%; transform: translateY(-50%); }
.hamburger-inner::before { content: ''; top: -8px; }
.hamburger-inner::after { content: ''; top: 8px; width: 16px; }
.hamburger.is-active .hamburger-inner { transform: rotate(45deg); }
.hamburger.is-active .hamburger-inner::before, .hamburger.is-active .hamburger-inner::after { top: 0; transform: rotate(90deg); width: 24px; }

/* Navigation Menu */
.nav { display: flex; height: 100%; }
.nav-list { display: flex; height: 100%; gap: 0; list-style: none; }
.nav-item { 
  display: flex; 
  align-items: center; 
  height: 100%;
  position: relative; 
  padding: 0 1rem;
}
.nav-link { 
  display: flex; 
  align-items: center; 
  height: 100%; 
  font-size: 1rem; 
  color: var(--color-text-main);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}
.nav-link:hover, .nav-item.is-active > .nav-link { color: var(--color-brand); }

/* Submenu */
.nav-item--has-submenu i { transition: transform 0.3s ease; }
.nav-item--has-submenu:hover i { transform: rotate(180deg); }

.submenu-toggle {
  display: flex;
  align-items: center;
  height: 100%;
  cursor: pointer;
  padding: 0 0.5rem;
}

.submenu { 
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: var(--color-bg-white);
  border: 1px solid var(--border-light);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  list-style: none;
  display: block;
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}
.nav-item--has-submenu:hover > .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.submenu-item { border: none; }
.submenu-item:last-child { padding-bottom: 0.5rem; }
.submenu-link {
  display: block;
  padding: 0.75rem 1rem;
  white-space: nowrap;
  text-align: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-main);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
} 
.submenu-link:hover { background-color: var(--color-bg-light); color: var(--color-brand); }
.submenu-link.is-active { color: var(--color-brand); background-color: transparent; }

/* Disabled State */
.nav-item.is-disabled, .submenu-item.is-disabled {
  cursor: not-allowed;
}

.nav-item.is-disabled > .nav-link, .submenu-item.is-disabled > .submenu-link {
  color: var(--color-text-muted) !important;
  pointer-events: none;
}

.nav-item.is-disabled > .nav-link:hover,
.submenu-item.is-disabled > .submenu-link:hover { background-color: transparent !important; }

/* Breadcrumb */
.breadcrumb { 
  display: inline-flex; 
  flex-wrap: nowrap; 
  overflow-x: auto; 
  max-width: 100%; 
  align-items: center; 
  font-size: 0.9rem; 
  margin-top: 1rem; 
  white-space: nowrap; 
  padding: 0 1rem; 
  justify-content: center; 
}
.breadcrumb::-webkit-scrollbar { display: none; }
.breadcrumb { -ms-overflow-style: none; scrollbar-width: none; }
.breadcrumb a { text-decoration: none; transition: color 0.2s ease; color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-brand); }
.breadcrumb > .active { font-weight: 600; color: var(--color-brand-dark); }
.breadcrumb > *:not(:first-child)::before { content: '›'; margin: 0 0.75rem; color: var(--color-text-muted); }

/* =========================================
   6. Hero Section
   ========================================= */
.hero { 
  text-align: center; 
  padding: calc(var(--header-height) + 2rem) 0 4rem 0; 
  position: relative; 
  overflow: hidden; 
  background-image: url('../img/hero/hero-bg.png');
  background-size: cover;
  background-position: center;
  color: var(--color-text-main);
}

.hero--home {
  min-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background-attachment: scroll;
  padding-bottom: 6rem;
}

.hero--internal {
  padding-bottom: 6rem;
}

.hero--internal .hero-content {
  flex-direction: column;
  text-align: center;
}

.hero--internal .hero-text {
  align-items: center;
  text-align: center;
  max-width: 100%;
}

.hero--home .container {
  max-width: 100%;
  padding-right: 5%;
  padding-left: 5%;
  margin: 0;
}

.hero-content {
  display: flex;
  width: 100%;
  align-items: center;
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 1.5rem; 
  align-items: flex-start;
  text-align: right;
  max-width: 600px;
  background: transparent;
}

.hero-title {
  color: var(--color-brand-dark);
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}
.hero--internal .hero-title {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-align: center;
  width: 100%;
}

.hero-description {
  color: var(--color-text-main);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.8;
}
.hero-description span { font-weight: 600; opacity: 0.9; }

.hero-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  line-height: 0;
  transform: rotate(180deg);
}
.hero-wave svg {
  position: relative;
  display: block;
  width: calc(100% + 1.3px);
  height: 100px;
}
.hero-wave .shape-fill { fill: var(--color-bg-light); }

/* =========================================
   7. Page Sections
   ========================================= */

/* --- Developer Section --- */
.developer-section { background-color: var(--color-bg-light); }
.developer { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3rem; max-width: 900px; margin: 0 auto; }
.developer-img { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); }
.developer-name { font-size: 1.8rem; font-weight: 700; color: var(--color-text-main); margin-bottom: 0.25rem; }
.developer-title { font-size: 1rem; color: var(--color-brand); font-weight: 600; margin-bottom: 1rem; }
.developer-bio { font-size: 1rem; line-height: 1.7; color: var(--color-text-muted); margin-bottom: 1.5rem; }

@media (max-width: 768px) {
  .developer { grid-template-columns: 1fr; text-align: center; gap: 1.5rem; }
  .developer-img { margin: 0 auto; width: 150px; height: 150px; }
  .developer-socials { justify-content: center; }
}

/* --- Partners Section --- */
.partners { text-align: center; background-color: var(--color-bg-light); }
.partners-grid { 
  align-items: center; 
  gap: 2.5rem; 
  margin-top: 2rem; 
}
.partners-logo img { max-height: 80px; width: auto; max-width: 150px; filter: grayscale(100%); opacity: 0.7; transition: all 0.3s ease; }
.partners-logo img:hover { filter: grayscale(0); opacity: 1; transform: scale(1.05); }

/* --- Footer --- */
.footer { 
  background-color: var(--color-bg-light); 
  padding: 1.25rem 0; 
  text-align: center; 
  border-top: 1px solid var(--border-light); 
  margin-top: auto; 
}
.footer-container { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1.5rem; width: 100%; }
.footer-copyright { text-align: left; flex-grow: 1; font-size: 0.9rem; color: var(--color-text-main); direction: ltr; margin: 0; }

/* =========================================
   8. Viewer
   ========================================= */
/* =========================================
   8. Viewer
   ========================================= */
.viewer { display: flex; flex-direction: column; height: 100vh; overflow: hidden; background-color: var(--color-bg-light); }

.header--viewer {
  position: relative;
  background-color: var(--color-bg-white);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  border-bottom: 1px solid var(--border-light);
}

.viewer-title {
  font-size: 1.2rem; font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--color-text-main);
  margin-right: 1rem;
}

.viewer-frame { flex: 1; border: none; width: 100%; height: 100%; background-color: #f5f5f5; }

body[data-page-type='viewer'] { 
  padding-top: 0; 
  height: 100vh; 
  overflow: hidden; 
}

/* =========================================
   9. Utilities
   ========================================= */
.back-to-top {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 36px;
  height: 36px;
  background-color: var(--color-brand); 
  color: var(--color-white);
  border-radius: 0;
  border: none;
  display: flex;
  align-items: center; 
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  z-index: 900;
  transition: opacity 0.3s, visibility 0.3s, background-color 0.2s;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; }
.back-to-top:hover { background-color: var(--color-brand-dark); }

.scroll-indicator { 
  position: absolute; 
  bottom: 40px; 
  left: 50%; 
  transform: translateX(-50%); 
  width: 24px; 
  height: 40px; 
  border: 2px solid var(--color-text-main); 
  border-radius: 50px; 
  opacity: 0.7; 
  z-index: 2; 
}
.scroll-indicator::before { 
  content: ''; 
  position: absolute; 
  top: 8px; 
  left: 50%; 
  width: 4px; 
  height: 8px; 
  background: var(--color-text-main); 
  border-radius: 4px; 
  animation: scroll-anim 2s infinite; 
  transform: translateX(-50%); 
}
.scroll-indicator::after { 
  content: 'مرر للأسفل'; 
  position: absolute; 
  top: 100%; 
  margin-top: 10px; 
  left: 50%; 
  transform: translateX(-50%); 
  color: var(--color-text-main); 
  font-size: 0.8rem; 
  white-space: nowrap; 
}

@keyframes scroll-anim { 0% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(-50%, 15px); opacity: 0; } }

/* Swup Transition */
#swup {
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}
html.is-changing #swup {
    opacity: 0;
}

/* Initial Page Load Animation */
html.is-changing body {
    opacity: 0;
}
body {
    transition: opacity 0.5s ease-in-out;
}

/* =========================================
   10. Media Queries
   ========================================= */
@media (min-width: 992px) {
  .grid { max-width: calc(4 * var(--card-width) + 3 * 1.5rem); margin: 0 auto; }
  .grid--institutions { grid-template-columns: repeat(2, 1fr); }
  
  .nav { position: static; width: auto; background: none; padding: 0; overflow: visible; }
  .hamburger { display: none; }
}

@media (max-width: 991px) {
  .hamburger { display: block; }
  .nav {
    position: fixed;
    top: var(--header-height);
    right: -100%;
    width: 100%; 
    height: calc(100vh - var(--header-height));
    background-color: var(--color-bg-white);
    z-index: 10002;
    transition: right 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    display: block;
    overflow-y: auto;
    padding: 20px 0;
    border-top: 1px solid var(--border-light);
  }
  .nav.is-active { right: 0; }
  .nav-list { display: block; }
  .nav-item { display: flex; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--border-light); height: auto; padding: 0; }
  .nav-link { flex-grow: 1; padding: 15px 25px; font-size: 1.1rem; justify-content: space-between; }
  .nav-link i { margin-right: 0 !important; } /* Reset desktop margin */
  .nav-item--has-submenu .nav-link { padding-right: 25px; }
  .submenu-toggle { padding: 15px 20px; }
  .submenu { position: static; box-shadow: none; border: none; background-color: var(--color-bg-light); max-height: 0; overflow: hidden; transition: max-height 0.4s ease-in-out; padding: 0; opacity: 1; visibility: visible; transform: none; }
  .submenu-item { border-top: 1px solid var(--border-light); }
  .submenu-link { padding: 12px 20px 12px 45px; text-align: right; font-size: 1rem; opacity: 0.9; }
  .submenu-link::before { content: '- '; margin-left: 5px; opacity: 0.5; }
  
  .hero--home { min-height: auto; padding: 6rem 0 4rem 0; justify-content: center; }
  .hero--home .container { padding-right: 20px; padding-left: 20px; }
  .hero-content { flex-direction: column; gap: 2rem; }
  .hero-text { align-items: center; text-align: center; max-width: 100%; }
  .hero-title { font-size: 2.5rem; }
  
  .footer-bottom { flex-direction: column; gap: 1rem; }
  .footer-copyright { text-align: center; }
  .scroll-indicator { bottom: 20px; }
}

@media (min-width: 768px) and (max-width: 991px) {
  .grid { max-width: calc(3 * var(--card-width) + 2 * 1.5rem); margin: 0 auto; }
  .hero--home { padding: calc(var(--header-height) + 5rem) 0 5rem 0; }
}

@media (max-width: 767px) {
  .grid { gap: 1rem; padding: 0 1rem; }
  .card, .book-item, .card-nav { width: calc(50% - 0.5rem); }
  .card-title { font-size: 0.95rem; } 
  .card-description { font-size: 0.85rem; }
  
  .developer { grid-template-columns: 1fr; text-align: center; }
  .developer-img { margin: 0 auto; }
  
  .institution { padding: 0.5rem 0.75rem; gap: 0.75rem; }
  .institution-name { font-size: 0.9rem; }
  .institution-location, .institution-link { font-size: 0.75rem; }
  .icon-box { width: 45px; height: 45px; min-width: 45px; min-height: 45px; }
  
  .btn-action { padding: 0.3rem 0.5rem; font-size: 0.7rem; min-width: 50px; }
}

@media (max-width: 480px) {
  .hero--home { padding: 6rem 0 20rem 0; }
  .hero-title { font-size: 2rem; }
  .hero-description { font-size: 1rem; }
  .section-title { font-size: 1.8rem; }
  .scroll-indicator { bottom: 60px; }
  .hero-wave svg { height: 80px; } 
}

/* =========================================
   11. 404 Page
   ========================================= */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-image: url('../img/hero/hero-bg.png');
    background-size: cover;
    background-position: center;
    padding: 2rem;
}
.error-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
}
.error-code {
    font-size: 6rem;
    font-weight: 800;
    color: var(--color-brand);
    line-height: 1;
    margin-bottom: 1rem;
}
.error-message {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text-main);
}
.error-description {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}
body[data-page-type='404'] #app-header, 
body[data-page-type='404'] #app-footer { display: none !important; }
body[data-page-type='404'] {
    padding: 0 !important;
    margin: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
}
