/* =========================================================
   Elmnoor & Shihab Complete Styles (Unified)
   ========================================================= */

/* --- 1. Variables & Base --- */
:root {
  /* --- Main Theme Colors --- */
  --color-primary: #00A99D;
  --color-secondary: #fbbf24;
  --color-dark: #2C3E50;
  --color-beige: #FDFCF5;
  --color-white: #FFFFFF;
  
  /* --- Shihab Tool Colors (Aliases for Study Page) --- */
  --shihab-dark-blue: #2C3E50;
  --shihab-turquoise: #00A99D;
  --shihab-cream: #FDFCF5;
  --shihab-white: #FFFFFF;
  --shihab-comic-black: #000000;

  /* --- FONTS --- */
  --font-comic: 'Bangers', cursive;
  --font-comic-ar: 'Changa', cursive;
  --font-body: 'Comic Neue', 'Noto Sans Arabic', sans-serif;
  --font-sans-ar: 'Tajawal', 'Almarai', 'Noto Sans Arabic', sans-serif;
  --font-sans-en: 'Noto Sans', sans-serif;
  
  /* --- SHADOWS & BORDERS --- */
  --shadow-hard: 6px 6px 0 0 #000;
  --shadow-hard-hover: 10px 10px 0 0 #000;
  --border-std: 4px solid #000;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Prevent horizontal scrolling */
html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

/* Help prevent image-related CLS by reserving space */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Font Awesome is loaded from CDN, no need for @font-face here */

body {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--color-dark);
  background-color: var(--color-beige);
}

html[lang="ar"] body { font-family: var(--font-sans-ar); }
html[lang="en"] body { font-family: var(--font-sans-en); }

.container { max-width: 1200px; margin: 0 auto; padding-left: 20px; padding-right: 20px; width: 100%; overflow-x: hidden; box-sizing: border-box; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* --- 2. Typography & Titles --- */
html[lang="ar"] .logo, 
html[lang="ar"] .hero-title, 
html[lang="ar"] .section-title, 
html[lang="ar"] .cta-title, 
html[lang="ar"] .offer-title, 
html[lang="ar"] .card-title,
html[lang="ar"] .btn-offer,
html[lang="ar"] .major-title,
html[lang="ar"] .service-title,
html[lang="ar"] .stat-value,
html[lang="ar"] .control-btn.primary,
html[lang="ar"] .gpa-header h2,
html[lang="ar"] .gpa-box h3,
html[lang="ar"] .celebration-title {
  font-family: var(--font-comic-ar) !important; font-weight: 700;
}

html[lang="en"] .logo, 
html[lang="en"] .hero-title, 
html[lang="en"] .section-title, 
html[lang="en"] .cta-title, 
html[lang="en"] .offer-title, 
html[lang="en"] .card-title,
html[lang="en"] .btn-offer {
  font-family: var(--font-comic) !important; font-weight: 400;
}

/* Base Title Style */
.hero-title, .section-title, .cta-title, .offer-title {
  font-size: 3.2rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

/* Titles on DARK Backgrounds */
.hero-title, .cta-title, .offer-title {
  color: var(--color-beige) !important; 
  text-shadow: none !important;
}

/* Titles on LIGHT Backgrounds */
.section-title {
  color: var(--color-dark) !important;
  text-shadow: none !important;
}

/* Subtitles */
.section-subtitle, .hero-subtitle, .cta-subtitle {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  line-height: 1.5;
  display: block;
}
.section-subtitle { color: #4b5563; }
.hero-subtitle, .cta-subtitle { color: var(--color-beige); opacity: 0.9; }

.section-header { text-align: center; margin-bottom: 3rem; }

/* --- 3. Buttons --- */
.btn {
  display: inline-block; padding: 1rem 2rem; font-size: 1.1rem; font-weight: bold;
  text-decoration: none; border: var(--border-std); border-radius: 12px;
  box-shadow: 4px 4px 0 0 #000; transition: transform 0.2s ease, box-shadow 0.2s ease; cursor: pointer;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 0 #000; }
.btn:hover { transform: translateY(-3px); box-shadow: 0 6px 12px rgba(0,0,0,0.15), 6px 6px 0 0 #000; }

.btn-primary { background: var(--color-primary); color: var(--color-white); }
.btn-primary:hover { background: #009185; }
.btn-secondary { background: transparent; color: var(--color-beige); border-color: var(--color-beige); }
.btn-secondary:hover { background: var(--color-beige); color: var(--color-dark); }

/* --- 4. Navigation --- */
.navbar { background: var(--color-dark); border-bottom: 5px solid #000; position: sticky; top: 0; z-index: 1000; box-shadow: 0 5px 0 0 #000; width: 100%; max-width: 100%; overflow-x: hidden; }
.nav-content { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; gap: 1rem; max-width: 1200px; margin: 0 auto; padding-left: 20px; padding-right: 20px; width: 100%; box-sizing: border-box; }
.logo { display: flex; align-items: center; gap: .5rem; font-size: 1.5rem; color: var(--color-beige); text-decoration: none; white-space: nowrap; }
.nav-links { display: flex; gap: 1rem; flex-wrap: nowrap; align-items: center; }
.nav-link { color: var(--color-beige); text-decoration: none; font-weight: bold; padding: 0.5rem 0.75rem; border-radius: 8px; transition: all .3s; white-space: nowrap; }
.nav-link:hover, .nav-link.active { color: var(--color-primary); background: rgba(0,169,157,0.1); }
.nav-link-featured { color: var(--color-primary) !important; font-weight: bold !important; }
.lang-btn, .mobile-menu-btn { background: transparent; border: 3px solid var(--color-beige); border-radius: 8px; color: var(--color-beige); cursor: pointer; transition: all .3s; }
.lang-btn { padding: .5rem 1rem; font-weight: bold; display: flex; align-items: center; gap: .5rem; }
.lang-btn:hover { background: var(--color-primary); transform: translate(-2px,-2px); box-shadow: 4px 4px 0 0 #000; border-color: var(--color-primary); }
.mobile-menu-btn { display: none; padding: .5rem; font-size: 1.5rem; min-width: 44px; min-height: 44px; }

/* --- 5. Hero Section --- */
.hero {
  background-color: var(--color-dark);
  background-image: radial-gradient(rgba(253,252,245,0.1) 1px, transparent 0);
  background-size: 12px 12px; color: var(--color-beige);
  padding: 6rem 0; min-height: calc(100vh - 80px);
  display: flex; align-items: center; position: relative; overflow: visible;
}
/* Simplify background on mobile for better performance */
@media (max-width: 768px) {
  .hero {
    background-image: none; /* Remove pattern on mobile */
  }
}
/* Simplify background on mobile for better performance */
@media (max-width: 768px) {
  .hero {
    background-image: none; /* Remove pattern on mobile */
  }
}
.hero-content { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: center; position: relative; z-index: 0; max-width: 100%; width: 100%; margin: 0 auto; overflow: visible; }
.hero-text { min-height: clamp(180px, 28vh, 260px); text-align: right; }
html[lang="en"] .hero-text { text-align: left; }

.hero-title { 
    font-size: 4rem; 
    margin-bottom: 0.5rem; 
    text-shadow: 4px 4px 0 #000 !important;
} 

.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: flex-end; }
html[lang="en"] .hero-buttons { justify-content: flex-start; }
.hero-image-wrapper {
  position: relative; width: 100%; display: flex; justify-content: center; align-items: center;
  overflow: visible; /* Allow bubble to move freely outside */
  border: none;
  background: transparent;
  box-shadow: none;
}
.hero-image {
  position: relative; display: flex; justify-content: center; align-items: center;
  width: clamp(240px, 50vw, 560px); aspect-ratio: 3/2; margin: 0 auto; overflow: visible;
  padding: 8px;
  background: linear-gradient(135deg, rgba(44, 62, 80, 0.8) 0%, rgba(26, 35, 41, 0.9) 100%);
  border-radius: 20px;
  border: 3px solid #000;
  box-shadow: 6px 6px 0 0 rgba(0, 0, 0, 0.4);
}
/* Video styles - replaces guide-character and speech-bubble */
.hero-video {
  width: 100%; 
  height: 100%; 
  object-fit: contain; 
  position: relative; 
  z-index: 2;
  display: block;
  /* Prevent controls on mobile */
  pointer-events: none;
  /* Soft Brutalism styling to match site design */
  border: 4px solid #000;
  border-radius: 16px;
  box-shadow: 8px 8px 0 0 #000;
  background: #2C3E50;
  padding: 4px;
}

/* --- 6. Sections (Majors, Services, Universities) --- */
.majors-section, .services-section, .special-offer-section, .universities-section {
  padding: 4rem 0 7rem 0; background-color: var(--color-beige);
  background-image: radial-gradient(rgba(44,62,80,0.08) 1px, transparent 0);
  background-size: 12px 12px; position: relative;
  overflow: visible;
}
/* Simplify background patterns on mobile */
@media (max-width: 768px) {
  .majors-section, .services-section, .special-offer-section, .universities-section {
    background-image: none; /* Remove pattern on mobile */
  }
}

/* BIGGER UNIVERSITIES TITLE */
.universities-section .section-title {
  font-size: 4.5rem !important; 
  margin-bottom: 1rem;
}

.majors-grid, .services-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
  gap: 1.5rem; 
  justify-items: stretch;
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  overflow: visible;
  padding-bottom: 2rem; /* Extra space for box-shadow and hover effect */
}

.major-card, .service-card {
  background: var(--color-beige); padding: 2rem 2rem 2.5rem 2rem; border: var(--border-std); border-radius: 16px;
  box-shadow: var(--shadow-hard); transition: transform 0.2s ease, box-shadow 0.2s ease; cursor: pointer;
  text-align: center; width: 100%; max-width: 100%; box-sizing: border-box;
  overflow: visible; min-height: fit-content; 
  margin-bottom: 1.5rem; /* Extra space for box-shadow (6px) + hover transform (5px) + buffer */
  position: relative;
}
.major-card:hover, .service-card:hover { 
  transform: translateY(-5px); 
  box-shadow: 0 10px 20px rgba(0,0,0,0.15), var(--shadow-hard-hover); 
  z-index: 1; /* Ensure hover card appears above others */
}
/* Remove contain to prevent content clipping */

.major-icon, .service-icon, .card-icon {
  width: 64px; height: 64px; background: var(--color-primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem auto; border: 3px solid #000;
}
.major-icon i, .service-icon i, .card-icon i { font-size: 2rem; color: var(--color-white); }
.major-title, .service-title, .card-title { font-size: 1.3rem; font-weight: bold; margin-bottom: .75rem; line-height: 1.4; }
.major-desc, .service-desc, .card-desc { font-size: .95rem; color: #4b5563; line-height: 1.6; margin-bottom: 0; }

/* Featured Service Card */
.service-card-featured {
  border-color: var(--color-primary) !important;
  box-shadow: 6px 6px 0 0 #000 !important;
}
.service-icon-featured {
  background: var(--color-primary) !important;
}
.btn-service-featured {
  margin-top: 1rem;
  display: inline-block;
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
}

/* --- 7. Offers & CTA --- */
.cta-section { background: linear-gradient(135deg, var(--color-dark), var(--color-primary)); color: var(--color-beige); padding: 4rem 0; text-align: center; width: 100%; max-width: 100%; overflow-x: hidden; }
.cta-buttons-group { display: flex; justify-content: center; align-items: stretch; gap: 2.5rem; flex-wrap: wrap; margin-bottom: 3rem; }
.cta-btn-main, .cta-btn-secondary {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 280px; padding: 1rem 2rem; font-size: 1.2rem; font-weight: bold; text-decoration: none;
  border-radius: 16px; border: 4px solid #000; box-shadow: 6px 6px 0 0 #000; transition: all 0.3s;
}
.cta-btn-main { background: var(--color-primary); color: var(--color-white); }
.cta-btn-secondary { background: var(--color-beige); color: var(--color-dark); }
.cta-btn-main:hover, .cta-btn-secondary:hover { transform: translateY(-4px); box-shadow: 0 8px 16px rgba(0,0,0,0.15), 8px 8px 0 0 #000; }

.offer-card {
  background: linear-gradient(135deg, var(--color-primary), #009185);
  border: 6px solid var(--color-dark); border-radius: 24px; padding: 2.5rem;
  box-shadow: 0 15px 30px rgba(0,0,0,0.2), var(--shadow-hard-hover);
  display: flex; align-items: center; gap: 2rem; position: relative; overflow: visible;
  margin: 0 auto; max-width: 100%; box-sizing: border-box;
  margin-bottom: 2rem; /* Extra space for box-shadow */
}
.offer-badge {
  position: absolute; top: 2.5rem; right: 1rem; background: var(--color-beige); color: var(--color-primary);
  padding: 0.5rem 1rem; border-radius: 20px; font-weight: bold; border: 3px solid var(--color-dark); z-index: 2;
}
html[lang="en"] .offer-badge { right: auto; left: 1rem; }
.offer-content { flex: 1; text-align: center; z-index: 2; color: var(--color-white); }
.offer-description { margin-bottom: 1.5rem; font-size: 1.1rem; line-height: 1.6; opacity: 0.95; }
.btn-offer { background: var(--color-white) !important; color: var(--color-primary) !important; border: 4px solid #000; text-transform: uppercase; display: inline-block; padding: 1rem 2rem; font-size: 1.2rem; font-weight: bold; text-decoration: none; border-radius: 12px; box-shadow: 4px 4px 0 0 #000; transition: all 0.3s; }
.btn-offer:hover { color: #009185 !important; transform: translateY(-3px); box-shadow: 0 6px 12px rgba(0,0,0,0.15), 6px 6px 0 0 #000; }
.offer-icon { font-size: 6rem; color: rgba(255,255,255,0.3); position: relative; z-index: 1; animation: float 3s ease-in-out infinite; }

/* --- 8. Footer --- */
.footer { background: #1f2937; color: #fff; padding: 2rem 0; text-align: center; }
.social-links { display: flex; justify-content: center; gap: 1.5rem; margin-top: 1.5rem; }
.social-link {
  width: 50px; height: 50px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.1); border: 3px solid rgba(255,255,255,0.2); border-radius: 50%;
  color: #fff; font-size: 1.5rem; transition: all 0.3s;
}
.social-link:hover { background: var(--color-primary); transform: translateY(-3px); }

/* =========================================================
   STUDY PAGE & TOOLS SPECIFIC STYLES
   (This section handles the Dashboard, Timer, To-Do, Flashcards)
   ========================================================= */

.study-page {
    background-color: var(--shihab-cream);
    background-image: radial-gradient(rgba(44,62,80,0.08) 1px, transparent 0);
    background-size: 12px 12px;
    min-height: 100vh;
}
/* Remove background pattern on mobile */
@media (max-width: 768px) {
  .study-page {
    background-image: none;
  }
}
.study-container { max-width: 1600px; margin: 0 auto; padding: 2rem 1rem; position: relative; z-index: 1; width: 100%; overflow-x: hidden; }
.study-header { text-align: center; margin-bottom: 2rem; }
.study-header h1 { font-size: 2.5rem; color: var(--shihab-dark-blue); margin-bottom: 0.5rem; text-shadow: 3px 3px 0 rgba(0,0,0,0.2); }
.study-main { display: grid; grid-template-columns: 1fr 1.2fr; gap: 2rem; width: 100%; max-width: 100%; overflow-x: hidden; align-items: start; justify-items: center; }

/* Character Area */
.character-card { background: var(--shihab-cream); border: 6px solid var(--shihab-dark-blue); border-radius: 20px; padding: 2rem; box-shadow: 10px 10px 0 0 var(--shihab-comic-black); height: fit-content; width: 100%; max-width: 100%; overflow: visible; margin: 0 auto; position: relative; }
.character-interactive-area { position: static; min-height: 400px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; background: var(--shihab-cream); border-radius: 16px; border: 5px solid var(--shihab-dark-blue); padding: 2rem 1rem 1rem 1rem; overflow: visible; }
.shihab-character { position: relative; width: 200px; height: auto; z-index: 10; margin-bottom: 20px; pointer-events: none; }
.shihab-character img { width: 100%; height: auto; display: block; filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3)); }
.speech-bubble-shihab { 
    position: absolute; top: -100px; left: 50%; transform: translateX(-50%);
    background: var(--shihab-cream); color: var(--shihab-comic-black);
    padding: 1rem 1.5rem; border-radius: 25px; border: 5px solid var(--shihab-comic-black);
    max-width: calc(100% - 4rem); min-width: 150px; min-height: 50px; font-size: 1rem; font-weight: bold; box-shadow: 8px 8px 0 0 var(--shihab-comic-black);
    z-index: 30; text-align: center; line-height: 1.5; pointer-events: none; 
    /* Use visibility instead of display to prevent CLS */
    visibility: hidden; opacity: 0; transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow: visible; /* Ensure bubble content is not clipped */
    box-sizing: border-box;
    animation: bubbleFloatShihab 5s ease-in-out infinite;
}
@keyframes bubbleFloatShihab {
  0%, 100% { transform: translateX(-50%) translateY(0) translateX(0); }
  25% { transform: translateX(-50%) translateY(-10px) translateX(6px); }
  50% { transform: translateX(-50%) translateY(-15px) translateX(0); }
  75% { transform: translateX(-50%) translateY(-10px) translateX(-6px); }
}
.speech-bubble-shihab.show { visibility: visible; opacity: 1; }

/* Timer Card */
.timer-card { background: var(--shihab-cream); border: 6px solid var(--shihab-dark-blue); border-radius: 20px; padding: 2rem; box-shadow: 10px 10px 0 0 var(--shihab-comic-black); text-align: center; width: 100%; max-width: 100%; overflow-x: hidden; margin: 0 auto; }
.circular-timer { position: relative; width: 220px; height: 220px; margin: 1.5rem auto; }
.timer-svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.timer-circle-bg { fill: none; stroke: #e5e7eb; stroke-width: 12; }
.timer-circle-progress { fill: none; stroke: var(--shihab-turquoise); stroke-width: 12; stroke-linecap: round; stroke-dasharray: 942; stroke-dashoffset: 942; transition: stroke-dashoffset 0.5s, stroke 0.3s; }
.timer-inner { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.timer-time { font-family: var(--font-comic); font-size: 3rem; color: var(--shihab-dark-blue); line-height: 1; margin-bottom: 0.25rem; text-shadow: 3px 3px 0 rgba(0,0,0,0.2); }
.timer-label { font-size: 1rem; color: var(--shihab-dark-blue); font-weight: bold; }

/* Controls & Tools */
.controls-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin: 0.75rem 0; }
.control-btn { padding: 0.75rem; font-size: 0.95rem; font-weight: bold; border: 4px solid var(--shihab-comic-black); border-radius: 14px; cursor: pointer; transition: all 0.3s; box-shadow: 0 6px 0 0 var(--shihab-comic-black); position: relative; overflow: hidden; }
.control-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 0 var(--shihab-comic-black); }
.control-btn.primary { background: var(--shihab-turquoise); color: var(--shihab-white); grid-column: 1 / -1; font-size: 1.1rem; padding: 1rem; font-weight: 900; }
.control-btn.secondary { background: var(--shihab-cream); color: var(--shihab-dark-blue); border-color: var(--shihab-dark-blue); }

.tools-section { margin-top: 0.75rem; background: var(--shihab-cream); border: 4px solid var(--shihab-dark-blue); border-radius: 14px; padding: 0.75rem; }
.tools-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; border-bottom: 4px solid var(--shihab-dark-blue); overflow-x: auto; }
.tool-tab { flex: 1; padding: 0.75rem; background: transparent; border: none; cursor: pointer; font-weight: bold; font-size: 0.9rem; color: var(--shihab-dark-blue); transition: all 0.3s; position: relative; white-space: nowrap; }
.tool-tab.active { color: var(--shihab-turquoise); font-weight: 900; }
.tool-tab.active::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 100%; height: 5px; background: var(--shihab-turquoise); }
.tool-content { display: none; }
.tool-content.active { display: block; }

/* To-Do List Styles */
.todo-list { max-height: 140px; overflow-y: auto; margin-bottom: 0.6rem; }
.todo-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--shihab-cream); border: 3px solid var(--shihab-dark-blue); border-radius: 10px; margin-bottom: 0.5rem; }
.todo-item.completed { opacity: 0.6; text-decoration: line-through; filter: brightness(0.95); }
.todo-checkbox { width: 24px; height: 24px; cursor: pointer; border: 3px solid var(--shihab-dark-blue); border-radius: 6px; appearance: none; position: relative; }
.todo-checkbox:checked { background: var(--shihab-turquoise); border-color: var(--shihab-turquoise); }
.todo-checkbox:checked::after { content: '✓'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--shihab-white); font-weight: bold; font-size: 1.2rem; }
.todo-input-group { display: flex; gap: 0.75rem; }
.todo-input, .notes-textarea { flex: 1; padding: 0.75rem; border: 3px solid var(--shihab-dark-blue); border-radius: 10px; font-size: 0.9rem; background: var(--shihab-cream); }
.notes-textarea { width: 100%; min-height: 120px; resize: vertical; }
.btn-add-todo { padding: 0.75rem 1rem; background: var(--shihab-turquoise); color: var(--shihab-white); border: 3px solid var(--shihab-comic-black); border-radius: 10px; cursor: pointer; font-weight: 900; box-shadow: 0 4px 0 0 var(--shihab-comic-black); }

/* Sound Settings & Stats */
.sound-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.sound-btn { padding: 1rem; background: var(--shihab-cream); border: 3px solid var(--shihab-dark-blue); border-radius: 12px; cursor: pointer; font-size: 1.5rem; text-align: center; box-shadow: 0 4px 0 0 var(--shihab-comic-black); }
.sound-btn.active { background: var(--shihab-turquoise); color: var(--shihab-white); border-color: var(--shihab-turquoise); }
.settings-compact { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; margin-top: 0.75rem; }
.setting-card { background: var(--shihab-cream); border: 3px solid var(--shihab-dark-blue); border-radius: 10px; padding: 0.75rem; }
.setting-input { width: 100%; padding: 0.6rem; background: var(--shihab-cream); border: 3px solid var(--shihab-dark-blue); border-radius: 8px; }
.preset-buttons { display: flex; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }
.preset-btn { flex: 1; min-width: 50px; padding: 0.5rem; background: var(--shihab-cream); border: 3px solid var(--shihab-dark-blue); border-radius: 8px; cursor: pointer; }
.preset-btn.active { background: var(--shihab-turquoise); color: var(--shihab-white); }
.stats-section { display: flex; justify-content: center; gap: 2rem; margin-top: 2rem; padding-top: 2rem; border-top: 5px solid var(--shihab-dark-blue); flex-wrap: wrap; }
.stat-card { background: var(--shihab-cream); border: 5px solid var(--shihab-dark-blue); border-radius: 16px; padding: 1.5rem 2rem; text-align: center; box-shadow: 8px 8px 0 0 var(--shihab-comic-black); min-width: 150px; }
.stat-value { font-size: 2.5rem; color: var(--shihab-dark-blue); line-height: 1; }

/* --- FLASHCARDS STYLES (UPDATED & RESPONSIVE) --- */

/* 1. Layout Container (Laptop vs Mobile) */
.flashcard-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
}

/* 2. Card Container */
.card-container {
    perspective: 1000px;
    width: 100%;
    max-width: 600px; /* Larger for Laptop */
    height: 400px;    /* Taller for Laptop */
    cursor: pointer;
    flex: 2;
    transform: translateX(-40px); /* Slight left shift */
}

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 20px;
    box-shadow: 8px 8px 0 0 var(--shihab-comic-black);
    border: 4px solid var(--shihab-dark-blue);
}

/* 3. Rotating Faces */
.card.is-flipped { transform: rotateY(180deg); }

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari support */
    backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    font-size: 2rem; /* Big font for Laptop */
    font-weight: bold;
    border-radius: 16px;
    box-sizing: border-box;
    overflow-y: auto;
    background-color: var(--shihab-cream);
}

.card-front { background-color: var(--shihab-white); color: var(--shihab-dark-blue); }
.card-back { 
    background-color: var(--shihab-turquoise); 
    color: var(--shihab-white); 
    transform: rotateY(180deg); 
    text-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

/* 4. Mini Shihab (Laptop Only) */
.mini-shihab-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-left: 20px;
}

.mini-shihab-img {
    max-width: 250px;
    height: auto;
    filter: drop-shadow(5px 5px 0 #000);
    animation: float 3s ease-in-out infinite;
}
/* Only use will-change when animation is actually running */
@media (prefers-reduced-motion: no-preference) {
  .mini-shihab-img { will-change: transform; }
}

/* 5. Inputs & Buttons */
.flashcard-input-group { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.add-btn { background: var(--shihab-turquoise); color: var(--shihab-white); border: 3px solid var(--shihab-comic-black); padding: 1rem 1.5rem; border-radius: 10px; cursor: pointer; font-weight: 900; box-shadow: 0 4px 0 0 var(--shihab-comic-black); display: flex; align-items: center; justify-content: center; gap: 0.5rem; }

/* 6. New Control Buttons (Edit, Delete, Reset) */
#resetDeckBtn { background-color: #ef4444 !important; border-color: #7f1d1d !important; }
#editCardBtn, #deleteCardBtn { padding: 0.5rem 1rem; border-radius: 8px; font-size: 0.9rem; transition: all 0.2s ease; display: flex; align-items: center; gap: 0.4rem; }
#editCardBtn:hover { background-color: rgba(44, 62, 80, 0.1) !important; }
#deleteCardBtn:hover { background-color: rgba(239, 68, 68, 0.1) !important; }
#backToCreatorBtn { margin-top: 1rem; border: 2px dashed var(--shihab-dark-blue); }

/* 7. Hide Main Character when Flashcards Active */
body.hide-main-character .character-card { display: none; }
body.hide-main-character .study-main { grid-template-columns: 1fr; }


/* --- GPA CALCULATOR SIDEBAR --- */
#gpa-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9998; display: none; opacity: 0; transition: opacity 0.3s ease; }
#gpa-overlay.show { display: block; opacity: 1; }
#gpa-sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: 0; max-width: 450px; background: var(--shihab-cream); z-index: 9999; overflow-x: hidden; overflow-y: auto; transition: width 0.4s ease; box-shadow: 5px 0 15px rgba(0,0,0,0.3); direction: rtl; }
html[lang="en"] #gpa-sidebar { direction: ltr; }
#gpa-sidebar.open { width: 100%; max-width: 450px; }
.gpa-header { background: var(--shihab-dark-blue); color: var(--shihab-cream); padding: 1.5rem; border-bottom: 5px solid var(--shihab-comic-black); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
.gpa-header h2 { font-size: 1.8rem; margin: 0; }
.close-btn { background: transparent; border: 3px solid var(--shihab-cream); color: var(--shihab-cream); padding: 0.6rem 1rem; border-radius: 10px; cursor: pointer; font-weight: bold; display: flex; align-items: center; gap: 0.5rem; }
.gpa-content { padding: 1.5rem; background: var(--shihab-cream); }
.gpa-box { background: var(--shihab-cream); border: 5px solid var(--shihab-dark-blue); border-radius: 16px; padding: 1.5rem; box-shadow: 8px 8px 0 0 var(--shihab-comic-black); margin-bottom: 1.5rem; }
.table-container { width: 100%; overflow-x: auto; margin-bottom: 1rem; -webkit-overflow-scrolling: touch; }
#courses-table { width: 100%; min-width: 500px; border-collapse: collapse; background: var(--shihab-cream); border: 3px solid var(--shihab-dark-blue); border-radius: 12px; overflow: hidden; }
#courses-table th, #courses-table td { padding: 0.75rem; text-align: center; border-bottom: 3px solid var(--shihab-dark-blue); font-size: 0.9rem; }
#courses-table th { background: var(--shihab-turquoise); color: var(--shihab-white); font-weight: 900; }
.gpa-input, .gpa-select { width: 100%; padding: 0.75rem; border: 3px solid var(--shihab-dark-blue); border-radius: 10px; font-weight: bold; background: var(--shihab-cream); }
.delete-btn { background: #ef4444; color: white; border: 3px solid var(--shihab-comic-black); padding: 0.6rem 1rem; border-radius: 8px; cursor: pointer; box-shadow: 0 3px 0 0 var(--shihab-comic-black); }
.results-area { background: var(--shihab-dark-blue); padding: 1.5rem; border-radius: 16px; text-align: center; border: 5px solid var(--shihab-comic-black); box-shadow: 6px 6px 0 0 var(--shihab-comic-black); }
.results-area p { color: var(--shihab-cream); font-weight: bold; margin: 0.75rem 0; }
.gpa-result { color: var(--shihab-turquoise); font-size: 2.5rem; font-weight: 900; display: block; }
#shahab-message { margin-top: 1rem; border-right: 5px solid var(--shihab-turquoise); padding: 1rem; background: rgba(0,169,157,0.1); border-radius: 12px; font-weight: bold; }

/* Celebration Overlay */
.celebration-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 9999; display: none; align-items: center; justify-content: center; }
.celebration-overlay.show { display: flex; }
.celebration-content { background: var(--shihab-cream); border: 6px solid var(--shihab-dark-blue); border-radius: 30px; padding: 3rem; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,0.5), 15px 15px 0 0 var(--shihab-comic-black); max-width: 500px; }
.celebration-icon { font-size: 5rem; margin-bottom: 1rem; }
.celebration-title { font-size: 2.5rem; color: var(--shihab-dark-blue); margin-bottom: 1rem; }

/* Respect users who prefer reduced motion and reduce animation work on low-end mobiles */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .offer-icon,
  .mini-shihab-img,
  .speech-bubble-shihab {
    animation: none !important;
  }
}

/* Disable animations on mobile for better performance */
@media (max-width: 768px) {
  .offer-icon,
  .mini-shihab-img,
  .speech-bubble-shihab {
    animation: none !important;
  }
  /* Disable transitions on mobile for better performance */
  * {
    transition-duration: 0.1s !important;
  }
  /* Optimize font rendering on mobile */
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
  }
}

/* Pause animations when page is not visible (Page Visibility API) */
@media (prefers-reduced-motion: no-preference) {
  html:not([data-visible="true"]) .offer-icon,
  html:not([data-visible="true"]) .mini-shihab-img,
  html:not([data-visible="true"]) .speech-bubble-shihab {
    animation-play-state: paused;
  }
}

/* --- 9. Responsive (Mobile) --- */
@media (max-width: 968px) {
  .study-main { grid-template-columns: 1fr; gap: 1.5rem; width: 100%; max-width: 100%; overflow-x: hidden; align-items: start; justify-items: center; }
  .offer-card { 
    flex-direction: column; 
    text-align: center;
    gap: 1.5rem;
  }
  .offer-badge {
    position: static;
    display: inline-block;
    margin-bottom: 1rem;
    top: auto;
    left: auto;
  }
  .offer-icon {
    font-size: 5rem;
  }
}

@media (max-width: 768px) {
  .navbar { z-index: 9998; }
  .mobile-menu-btn { display: flex !important; z-index: 10000; }
  .nav-links { display: none; position: fixed; top: 70px; left: 0; right: 0; flex-direction: column; background: var(--color-dark); padding: 1rem; border-top: 5px solid #000; z-index: 9997; }
  .nav-links.active { display: flex; }
  .nav-link { width: 100%; text-align: center; margin-bottom: 0.5rem; }

  .hero { padding: 3rem 0 4rem; display: flex; align-items: center; justify-content: center; }
  .hero-content { grid-template-columns: 1fr; text-align: center; gap: 2rem; width: 100%; max-width: 100%; margin: 0 auto; justify-items: center; align-items: center; }
  .hero-text { text-align: center !important; width: 100%; max-width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
  .hero-title { font-size: 2.8rem; margin-bottom: 1rem; text-align: center !important; width: 100%; margin-left: auto; margin-right: auto; }
  .hero-subtitle { text-align: center !important; width: 100%; margin-left: auto; margin-right: auto; }
  .hero-buttons { flex-direction: column; gap: 0.5rem; width: 100%; max-width: 100%; margin: 0 auto 2rem auto; justify-content: center !important; align-items: center; }
  .hero-buttons .btn { width: 100%; max-width: 100%; text-align: center; margin: 0 auto; }
  .hero-image-wrapper { width: 100%; display: flex; justify-content: center; align-items: center; margin: 0 auto; position: relative; overflow: visible; }
  .hero-image { 
    width: min(360px, 85vw) !important; 
    margin: 0 auto !important; 
    display: flex !important;
    visibility: visible !important;
    padding: 6px !important;
    border-radius: 16px !important;
  }
  .hero-image-wrapper {
    display: flex !important;
    visibility: visible !important;
  }
  .hero-video {
    width: 100% !important;
    height: auto !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
    visibility: visible !important;
  }
  
  /* UNIFIED MOBILE TITLES */
  .section-title, .cta-title, .offer-title, .hero-title { font-size: 2.2rem !important; text-align: center !important; }
  /* UNIVERSITIES TITLE MOBILE OVERRIDE */
  .universities-section .section-title { font-size: 3rem !important; text-align: center !important; }
  .section-header { text-align: center !important; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 auto; }
  .section-subtitle { text-align: center !important; width: 100%; margin: 0 auto; }
  .majors-grid, .services-grid { justify-items: center; width: 100%; max-width: 100%; margin: 0 auto; }
  .major-card, .service-card { width: 100%; max-width: 100%; margin: 0 auto 1.5rem auto; }

  /* Study Tools Mobile */
  .study-container { padding: 1rem 0.75rem; width: 100%; max-width: 100%; overflow-x: hidden; }
  .study-main { width: 100%; max-width: 100%; overflow-x: hidden; }
  .character-card { width: 100%; max-width: 100%; overflow: visible; margin: 0 auto; }
  .timer-card { width: 100%; max-width: 100%; overflow-x: hidden; margin: 0 auto; }
  .character-interactive-area { min-height: 350px; width: 100%; max-width: 100%; overflow: visible; position: static; }
  .speech-bubble-shihab { top: -90px; max-width: 90%; }
  .circular-timer { width: 180px; height: 180px; }
  .timer-time { font-size: 2rem; }
  .stats-section { flex-direction: column; align-items: center; width: 100%; max-width: 100%; overflow-x: hidden; }
  .stat-card { width: 100%; max-width: 250px; }

  .cta-buttons-group { flex-direction: column; gap: 1.5rem; align-items: center; justify-content: center; width: 100%; margin: 0 auto 3rem auto; }
  .cta-btn-main, .cta-btn-secondary { width: 100%; max-width: 100%; margin: 0 auto; }
  .cta-section { text-align: center !important; display: flex; flex-direction: column; align-items: center; }
  .cta-title, .cta-subtitle { text-align: center !important; width: 100%; margin: 0 auto; }
  
  /* Fix offer-card mobile layout */
  .offer-card { 
    padding: 1.5rem 1rem; 
    flex-direction: column; 
    gap: 1.5rem;
    min-height: auto;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
  }
  .offer-badge {
    position: static;
    display: inline-block;
    margin-bottom: 1rem;
    top: auto;
    left: auto;
  }
  .offer-content {
    order: 1;
    padding-top: 0;
  }
  .offer-icon {
    order: 2;
    font-size: 4rem;
    margin-top: 0.5rem;
  }
  .offer-title {
    margin-bottom: 1rem;
  }
  .offer-description {
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
  }
  
  /* GPA Mobile */
  #gpa-sidebar.open { width: 95%; max-width: 95%; }
  .gpa-header h2 { font-size: 1.4rem; }
  #courses-table th, #courses-table td { padding: 0.5rem 0.4rem; font-size: 0.8rem; }
  .table-container { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #courses-table { min-width: 400px; }

  /* --- Flashcards Mobile (Reverting to Compact) --- */
  .flashcard-layout {
      flex-direction: column-reverse; /* Stack vertically */
      gap: 1rem;
      margin: 1rem 0;
  }
  .card-container {
      height: 220px; /* Smaller height */
      max-width: 100%;
      transform: none; /* Reset translation for mobile */
  }
  .card-face {
      font-size: 1.3rem; /* Smaller font */
      padding: 1rem;
  }
  .mini-shihab-container {
      display: none; /* Hide extra Shihab on mobile */
  }
}

@media (max-width: 480px) {
  .container { padding-left: 12px; padding-right: 12px; }
  .hero-title { font-size: 2.5rem; }
  .hero-image {
    width: 100%;
    max-width: 320px;
    min-height: 213px;
  }
  #gpa-sidebar.open { width: 100%; }
}

/* =========================================================
   Back to Top Button
   ========================================================= */
.back-to-top {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 55px;
  height: 55px;
  background: var(--color-primary);
  color: var(--color-white);
  border: 4px solid #000;
  border-radius: 50%;
  box-shadow: 6px 6px 0 0 #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  transform: translateY(20px);
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #009185;
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 0 #000;
}

.back-to-top:active {
  transform: translate(2px, 2px);
  box-shadow: 4px 4px 0 0 #000;
}

html[lang="en"] .back-to-top {
  left: auto;
  right: 30px;
}

@media (max-width: 768px) {
  .back-to-top {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    bottom: 20px;
    left: 20px;
  }
  html[lang="en"] .back-to-top {
    left: auto;
    right: 20px;
  }
}

/* =========================================================
   Smooth Scroll
   ========================================================= */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* =========================================================
   Scroll Animations (Fade In)
   ========================================================= */
.fade-in-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.fade-in-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .fade-in-section {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* =========================================================
   Progress Bar (Scroll Progress Indicator)
   ========================================================= */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  z-index: 10000;
  transform-origin: right;
  transform: scaleX(0);
  will-change: transform;
}

.scroll-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, #009185 100%);
  width: 100%;
  box-shadow: 0 0 10px rgba(0, 169, 157, 0.5);
}

html[lang="en"] .scroll-progress-bar {
  transform-origin: left;
}

/* =========================================================
   Enhanced Card Hover Effects (Improvements)
   ========================================================= */
.major-icon,
.service-icon {
  transition: transform 0.2s ease;
}

.major-card:hover .major-icon,
.service-card:hover .service-icon {
  transform: scale(1.1) rotate(5deg);
}

.major-title,
.service-title {
  transition: color 0.2s ease;
}

.major-card:hover .major-title,
.service-card:hover .service-title {
  color: var(--color-primary);
}