/* ============================================================
   Landing / Home Page — Responsive Layout
   ============================================================ */

/* ─── Navbar — single source of truth (base + scroll at file end) ── */
.navbar,
nav#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1rem 2rem;
  transition: background 0.3s ease-in-out, box-shadow 0.3s ease-in-out, color 0.3s ease-in-out;
  color: #ffffff;
}

.nav-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 800;
}

.logo i {
  color: #f59e0b;
  font-size: 2rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s;
  position: relative;
}

.nav-links a:hover {
  color: #f59e0b;
}

/*
 * RTL-aware underline animation.
 * `right: 0` pins the pseudo-element to the physical RIGHT edge — the
 * start of Arabic text in RTL flow. Growing `width` toward 100% expands
 * the underline LEFT-ward, matching where the eye reads Arabic: right → left.
 * This is the opposite of the typical LTR `left: 0` pattern.
 * Colour: --sky accent (Phase 1 addition) on the dark navbar.
 * On scrolled white navbar, landing.css's GOD-MODE overrides links
 * to dark; the underline uses gold there (via the non-scoped default).
 */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--sky-on-dark, #7DD3FC);
  border-radius: 2px;
  transition: width 0.28s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* Scrolled navbar: links turn dark, underline switches to gold for contrast */
nav#navbar.scrolled-nav-active .nav-links a::after {
  background: var(--gold, #f59e0b);
}

.nav-auth {
  display: flex;
  gap: 1rem;
}

.nav-auth .btn {
  padding: 0.6rem 1.5rem;
  font-size: 0.95rem;
}

#navbar .login-btn {
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.35);
}

#navbar .login-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
}

/* ─── Auth modal: isolate from OS/browser dark theme ──────── */
#authModalOverlay,
#authModalOverlay .auth-modal {
  color-scheme: light;
}

#authModalOverlay input,
#authModalOverlay select,
#authModalOverlay textarea {
  color-scheme: light;
  background-color: #ffffff !important;
  color: #1a202c !important;
  border: 1.5px solid var(--input-border, #CBD5E0) !important;
  caret-color: #1a202c;
  -webkit-text-fill-color: #1a202c;
}

#authModalOverlay input::placeholder,
#authModalOverlay textarea::placeholder {
  color: #718096 !important;
  opacity: 1;
}

#authModalOverlay input:focus,
#authModalOverlay select:focus,
#authModalOverlay textarea:focus {
  outline: none;
  border-color: var(--primary, #1a2b4c) !important;
  box-shadow: 0 0 0 3px rgba(26, 43, 76, 0.12);
}

#authModalOverlay select option {
  background-color: #ffffff;
  color: #1a202c;
}

#authModalOverlay input:-webkit-autofill,
#authModalOverlay input:-webkit-autofill:hover,
#authModalOverlay input:-webkit-autofill:focus,
#authModalOverlay select:-webkit-autofill,
#authModalOverlay textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #1a202c !important;
  caret-color: #1a202c;
  border-color: var(--input-border, #CBD5E0) !important;
  transition: background-color 9999s ease-out 0s;
}

#authModalOverlay .auth-field label,
#authModalOverlay .form-label {
  color: var(--text, #2D3748) !important;
}

#authModalOverlay .auth-modal-title {
  color: var(--text, #2D3748);
}

#authModalOverlay .auth-modal-sub,
#authModalOverlay .text-muted {
  color: var(--text-light, #718096) !important;
}

:root {
  --landing-nav-height: 72px;
}

html {
  overflow-x: hidden;
}

/* ─── Features & Courses — nuclear height reset ───────────── */
section#features,
section#courses {
  min-height: auto !important;
  height: auto !important;
  padding: 5rem 10% !important;
  margin: 0 !important;
  display: block !important;
  background-color: #ffffff;
}

section#courses {
  background-color: #f8f9fa !important;
}

section#features .section-header,
section#courses .section-header {
  margin-bottom: 0;
}

.modern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.container.text-center {
  text-align: center;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Mobile nav toggle (hidden on desktop) ─────────────── */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.55);
}

.nav-panel {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

/* ─── Hero: clear fixed navbar ──────────────────────────── */
.hero {
  padding-top: calc(var(--landing-nav-height) + 1.5rem);
  padding-bottom: 3rem;
  min-height: auto;
  position: relative;
  z-index: 0;
  overflow: visible !important;
}

.hero-content {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: center;
  gap: 3rem;
  min-height: 80vh;
}

.hero-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.hero-text .badge {
  width: max-content;
  max-width: 100%;
}

.hero-image {
  width: 100%;
  max-width: 100%;
  overflow: visible !important;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  height: 100%;
}

.hero-cutout-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  height: 100%;
  width: 100%;
  max-width: 500px;
  margin-inline: auto;
  overflow: visible !important;
}

.hero-cutout-img {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 500px;
  object-fit: contain;
  object-position: bottom;
  transform: scale(1.15);
  transform-origin: bottom center;
  filter: drop-shadow(0 35px 35px rgba(0, 0, 0, 0.6)) drop-shadow(0 10px 15px rgba(0, 0, 0, 0.4));
}

/* ─── Tablet (≤1024px) ─────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-content {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    min-height: auto;
    text-align: center;
  }

  .hero-text {
    align-items: center;
  }

  .hero-text .badge {
    margin-inline: auto;
  }

  .hero-text h1 {
    font-size: clamp(2rem, 5vw, 2.75rem);
  }

  .hero-text .subtitle {
    font-size: clamp(1.1rem, 3vw, 1.35rem);
  }

  .hero-text p {
    font-size: 1.05rem;
  }

  .hero-image {
    order: -1;
    min-height: auto;
  }

  .hero-cutout-wrapper {
    max-width: min(320px, 88vw);
  }

  .hero-cutout-img {
    max-width: min(320px, 88vw);
    transform: scale(1.08);
    transform-origin: bottom center;
  }

  .hero-buttons {
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .section-header h2 {
    font-size: 2rem;
  }

  .section-header p {
    font-size: 1.05rem;
  }
}

/* ─── Mobile (≤768px) ───────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --landing-nav-height: 64px;
  }

  .navbar {
    padding: 0.65rem 1rem;
  }

  .nav-content {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .logo {
    font-size: 1.15rem;
    flex: 1;
    min-width: 0;
  }

  .logo span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .logo i {
    font-size: 1.5rem;
    flex-shrink: 0;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-panel {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    order: 3;
    gap: 0;
    background: rgba(26, 43, 76, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 0.75rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    transition: background 0.3s ease-in-out, border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
  }

  nav#navbar.scrolled-nav-active .nav-panel {
    background: #ffffff !important;
    border-color: var(--border, #E2E8F0) !important;
    box-shadow: 0 16px 40px rgba(26, 43, 76, 0.12);
  }

  nav#navbar.scrolled-nav-active .nav-links a:hover {
    background: var(--hover-bg, #EDF2F7);
  }

  nav#navbar.scrolled-nav-active .nav-auth {
    border-top-color: var(--border, #E2E8F0);
  }

  .navbar.nav-open .nav-panel {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 0.85rem 1rem;
    border-radius: 10px;
  }

  .nav-links a:hover {
    background: rgba(255, 255, 255, 0.08);
  }

  .nav-auth {
    flex-direction: column;
    width: 100%;
    gap: 0.65rem;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .nav-auth .btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }

  body.nav-open {
    overflow: hidden;
  }

  .hero {
    padding-top: calc(var(--landing-nav-height) + 1rem);
    padding-bottom: 2rem;
  }

  .hero-content {
    padding: 1.25rem 1rem;
    gap: 2rem;
  }

  .hero-text h1 {
    font-size: clamp(1.75rem, 7vw, 2.25rem);
    line-height: 1.25;
  }

  .hero-text .badge {
    font-size: 0.95rem;
    padding: 0.45rem 1.1rem;
    margin-bottom: 1.25rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .hero-buttons .btn {
    width: 100%;
    justify-content: center;
    padding: 0.9rem 1.25rem;
    font-size: 1rem;
  }

  .hero-cutout-wrapper {
    max-width: min(280px, 92vw);
  }

  .hero-cutout-img {
    max-width: min(280px, 92vw);
    transform: scale(1);
    transform-origin: bottom center;
  }

  .stats {
    margin-top: 0;
    padding: 2rem 1rem;
    border-radius: 24px 24px 0 0;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
  }

  .stat-card {
    padding: 1.25rem 0.85rem;
  }

  .stat-card i {
    font-size: 2rem;
    margin-bottom: 0.65rem;
  }

  .stat-card .number {
    font-size: 1.85rem;
  }

  section#features,
  section#courses {
    padding: 3rem 5% !important;
  }

  .modern-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 2rem;
  }

  .feature-card {
    padding: 1.75rem;
  }

  .section-header {
    margin-bottom: 2.5rem;
  }

  .section-header h2 {
    font-size: 1.65rem;
  }

  .section-header p {
    font-size: 0.95rem;
    padding-inline: 0.5rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    margin-bottom: 2rem;
  }

  footer {
    padding: 2.5rem 1rem 1rem;
  }

  .auth-modal {
    padding: 1.5rem 1.25rem;
    max-height: 88vh;
  }
}

/* ─── Small phones (≤480px) ───────────────────────────── */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-text p br {
    display: none;
  }
}

/* ─── Large screens — restore full hero height ─────────── */
@media (min-width: 1025px) {
  .hero {
    min-height: 100vh;
    padding-top: calc(var(--landing-nav-height) + 2rem);
  }
}

/* =========================================
   THE UNBREAKABLE NAVBAR SCROLL STATE
   ========================================= */
body nav.scrolled-nav-active,
body header.scrolled-nav-active,
body #navbar.scrolled-nav-active,
body .navbar.scrolled-nav-active {
    background-color: #ffffff !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1) !important;
}

body .scrolled-nav-active .subscribe-btn,
body #navbar.scrolled-nav-active .subscribe-btn {
    background-color: #f6ad55 !important;
    border: none !important;
}

/* =========================================
   GOD MODE: DEEP DESCENDANT COLOR OVERRIDE
   ========================================= */
body #navbar.scrolled-nav-active a:not(.subscribe-btn),
body #navbar.scrolled-nav-active a:not(.subscribe-btn) *,
body .navbar.scrolled-nav-active a:not(.subscribe-btn),
body .navbar.scrolled-nav-active a:not(.subscribe-btn) * {
    color: #1a202c !important;
    text-shadow: none !important;
    fill: #1a202c !important;
    -webkit-text-fill-color: #1a202c !important;
}

body #navbar.scrolled-nav-active .login-btn,
body #navbar.scrolled-nav-active .login-btn *,
body .navbar.scrolled-nav-active .login-btn,
body .navbar.scrolled-nav-active .login-btn * {
    color: #1a202c !important;
    border-color: #1a202c !important;
}

body #navbar.scrolled-nav-active .subscribe-btn,
body #navbar.scrolled-nav-active .subscribe-btn * {
    color: #ffffff !important;
}

body #navbar.scrolled-nav-active .logo,
body #navbar.scrolled-nav-active .logo *,
body #navbar.scrolled-nav-active .nav-toggle,
body #navbar.scrolled-nav-active .nav-toggle * {
    color: #1a202c !important;
    text-shadow: none !important;
    fill: #1a202c !important;
    -webkit-text-fill-color: #1a202c !important;
}

body #navbar.scrolled-nav-active .logo i {
    color: #f59e0b !important;
    fill: #f59e0b !important;
    -webkit-text-fill-color: #f59e0b !important;
}
