/* ============================================
   LAYOUT.CSS - Nav, Hero, Sections, Footer, Grid
   InterSystems IRIS Arabic Academy
   ============================================ */

/* Navigation */
.main-nav {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: var(--z-sticky);
  background: rgba(6, 11, 24, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--transition-base);
}

.main-nav.scrolled {
  background: rgba(6, 11, 24, 0.95);
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .main-nav {
  background: rgba(248, 249, 252, 0.85);
}

[data-theme="light"] .main-nav.scrolled {
  background: rgba(248, 249, 252, 0.95);
}

.nav-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--text-lg);
  color: var(--text-heading);
  flex-shrink: 0;
}

.nav-logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  border-radius: var(--radius-md);
  font-size: var(--text-lg);
  color: var(--bg-deep);
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.nav-link.active {
  color: var(--teal);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Search bar */
.nav-search {
  position: relative;
  display: none;
}

.nav-search.active {
  display: block;
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  padding: var(--space-md);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  box-shadow: var(--shadow-md);
}

.nav-search .input {
  max-width: 600px;
  margin: 0 auto;
  display: block;
}

.search-results {
  max-width: 600px;
  margin: var(--space-sm) auto 0;
  max-height: 300px;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: var(--space-sm) var(--space-md);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  font-size: var(--text-sm);
}

.search-result-item:hover, .search-result-item:focus {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.search-result-title {
  font-weight: 600;
  color: var(--text-primary);
}

.search-result-path {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Mobile menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: var(--space-sm);
  font-size: var(--text-xl);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 70px;
  right: 0;
  left: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: var(--z-overlay);
  padding: var(--space-xl);
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

.mobile-menu.active {
  display: block;
}

.mobile-menu .nav-link {
  display: block;
  padding: var(--space-md);
  font-size: var(--text-lg);
  border-bottom: 1px solid var(--border-subtle);
}

/* Theme toggle */
.theme-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--text-lg);
}

.theme-toggle:hover {
  background: var(--bg-card);
  color: var(--gold);
  border-color: var(--border-strong);
}

/* Scroll progress */
.scroll-progress {
  position: fixed;
  top: 70px;
  right: 0;
  left: 0;
  height: 3px;
  z-index: var(--z-sticky);
  background: transparent;
}

.scroll-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--teal));
  width: 0%;
  transition: width 100ms linear;
}

/* Hero section */
.hero {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 100px 0 var(--space-4xl);
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.hero-bg canvas {
  width: 100%;
  height: 100%;
}

.hero-content {
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--container-padding);
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  background: rgba(212, 168, 67, 0.1);
  border: 1px solid rgba(212, 168, 67, 0.3);
  border-radius: var(--radius-full);
  color: var(--gold);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-xl);
  animation: fadeDown 0.6s ease forwards;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  color: var(--text-heading);
  line-height: 1.2;
  margin-bottom: var(--space-lg);
  animation: fadeUp 0.8s ease forwards;
}

.hero-title .highlight {
  background: linear-gradient(135deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto var(--space-2xl);
  animation: fadeUp 1s ease forwards;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-3xl);
  margin-top: var(--space-3xl);
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
  animation: fadeUp 1.2s ease forwards;
}

.hero-stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
}

.hero-stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  animation: fadeUp 1s ease forwards;
}

/* Sections */
.section {
  padding: var(--space-4xl) 0;
  position: relative;
}

.section-alt {
  background: var(--bg-surface);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: rgba(46, 196, 182, 0.1);
  border: 1px solid rgba(46, 196, 182, 0.2);
  border-radius: var(--radius-full);
  color: var(--teal);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  color: var(--text-heading);
  font-weight: 800;
  margin-bottom: var(--space-md);
}

.section-desc {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Grid layouts */
.grid {
  display: grid;
  gap: var(--space-xl);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

.grid-auto {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid-sidebar {
  grid-template-columns: 1fr 280px;
  gap: var(--space-2xl);
  align-items: start;
}

.grid-sidebar-reverse {
  grid-template-columns: 280px 1fr;
  gap: var(--space-2xl);
  align-items: start;
}

/* Path cards */
.path-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.path-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
}

.path-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.path-card-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-lg);
}

.path-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  color: var(--text-heading);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.path-card-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.path-card-courses {
  list-style: none;
  padding: 0;
  margin: 0;
}

.path-card-courses li {
  padding: var(--space-xs) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.path-card-courses li::before {
  content: '›';
  color: var(--text-muted);
  font-weight: bold;
}

/* Features grid */
.feature-card {
  text-align: center;
  padding: var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-default);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  border-radius: var(--radius-lg);
  font-size: var(--text-3xl);
  background: var(--bg-elevated);
}

.feature-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  color: var(--text-heading);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.feature-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* CTA section */
.cta-section {
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-elevated));
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-4xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(212, 168, 67, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.cta-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  color: var(--text-heading);
  font-weight: 800;
  margin-bottom: var(--space-md);
  position: relative;
}

.cta-desc {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-xl);
  position: relative;
}

/* Footer */
.main-footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.footer-brand p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 300px;
}

.footer-col-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  color: var(--text-heading);
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--teal);
}

.footer-bottom {
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Page layout (for course pages) */
.page-wrapper {
  padding-top: 70px;
  min-height: 100vh;
}

.page-header {
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-surface));
  padding: var(--space-3xl) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.page-header-content {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.page-body {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-2xl) var(--container-padding);
}

/* Lab layout */
.lab-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 70px);
  overflow: hidden;
}

.lab-editor {
  border-left: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
}

.lab-output {
  display: flex;
  flex-direction: column;
}

.lab-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}

/* Responsive */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
  .grid-sidebar, .grid-sidebar-reverse {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .hero {
    min-height: 80vh;
    padding: 80px 0 var(--space-2xl);
  }

  .hero-stats {
    gap: var(--space-xl);
  }

  .hero-stat-value {
    font-size: var(--text-3xl);
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }

  .section {
    padding: var(--space-2xl) 0;
  }

  .section-title {
    font-size: var(--text-2xl);
  }

  .cta-section {
    padding: var(--space-2xl);
  }

  .cta-title {
    font-size: var(--text-2xl);
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }

  .lab-split {
    grid-template-columns: 1fr;
    height: auto;
  }

  .lab-editor, .lab-output {
    height: 50vh;
  }
}

@media (max-width: 480px) {
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-stats {
    flex-direction: column;
    gap: var(--space-lg);
  }
}
