/* ==========================================
   GLOBAL STYLES - ATI NAWALAPITIYA
   Variables, Typography, Navbar, Footer, Base Buttons
   Linked in ALL HTML files
   ========================================== */

/* ========== CSS VARIABLES ========== */
:root {
  /* Primitive color tokens */
  --color-black: #000000;
  --color-white: #ffffff;
  --color-slate-900: #0f172a;
  --color-slate-600: #475569;
  --color-gray-800: #1f2937;

  /* Typography tokens */
  --font-size-sm: 0.8125rem; /* 13px */
  --font-size-md: 1rem;      /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */

  /* Spacing tokens */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */

  /* Size tokens */
  --size-40: 40px;
  --size-42: 42px;
  --size-45: 45px;
  --size-50: 50px;

  /* Pixel utility tokens */
  --px-3: 3px;
  --px-5: 5px;

  /* Radius tokens */
  --radius-sm: 0.5rem;   /* 8px */
  --radius-md: 0.75rem;  /* 12px */
  --radius-lg: 1rem;     /* 16px */

  /* Dynamic theme palette (defaults; overridden at runtime by site theme state) */
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --primary-light: #60a5fa;
  --primary-dark: #1e3a8a;
  --primary-bg: #dbeafe;

  /* Legacy aliases used by existing page styles */
  --primary-color: var(--primary);
  --primary-blue: var(--primary);
  --primary-purple: var(--primary);
  --dark-blue: var(--primary-dark);
  --accent-blue: var(--primary-light);
  --accent-purple: var(--primary-hover);
  --light-bg: var(--color-white);
  --white: var(--color-white);
  /* Light mode text (Tailwind slate equivalents) */
  --text-dark: var(--color-slate-900); /* slate-900 */
  --text-gray: var(--color-gray-800); /* gray-800 */
  --text-light: var(--color-slate-600); /* slate-600 */

  /* Surface tokens (used across pages) */
  --bg-body: var(--light-bg);
  --bg-card: var(--white);
  --border-color: rgba(15, 23, 42, 0.14);
  --surface-muted: var(--primary-bg);
  --card-shadow: var(--shadow-md);
  --card-shadow-hover: var(--shadow-lg);

  /* Semantic status tokens */
  --status-success: #16a34a;
  --status-success-rgb: 22, 163, 74;
  --status-error: #dc2626;
  --status-error-rgb: 220, 38, 38;
  --status-info: #2563eb;
  --status-info-rgb: 37, 99, 235;
  --status-warning: #d97706;
  --status-warning-rgb: 217, 119, 6;

  /* Overlay/modal tokens */
  --overlay-backdrop: rgba(2, 6, 23, 0.72);
  --overlay-surface: var(--bg-card);
  --overlay-border: rgba(148, 163, 184, 0.28);
  --overlay-text: #ffffff;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  --gradient-overlay: linear-gradient(135deg, color-mix(in srgb, var(--primary-dark) 92%, black 8%) 0%, color-mix(in srgb, var(--primary) 90%, black 10%) 100%);
  
  /* Spacing */
  --section-padding: 80px 0;
  --container-max-width: 80rem; /* Tailwind: max-w-7xl */

  /* Sticky header offset (Navbar + optional maintenance banner) */
  --header-offset: 90px;
  
  /* Shadows */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.10);
  --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.18);
  
  /* Transitions */
  --transition-speed: 0.3s;
}

/* ========== DARK THEME (Tailwind-style via .dark) ========== */
html.dark {
  --primary-blue: var(--primary-light);
  --primary-purple: var(--primary-light);
  --accent-blue: var(--primary-light);
  --accent-purple: var(--primary-light);
  --gradient-primary: linear-gradient(135deg, color-mix(in srgb, var(--primary) 75%, black 25%) 0%, color-mix(in srgb, var(--primary-hover) 75%, black 25%) 100%);
  --gradient-secondary: linear-gradient(135deg, color-mix(in srgb, var(--primary-dark) 72%, black 28%) 0%, color-mix(in srgb, var(--primary) 72%, black 28%) 100%);
  --gradient-overlay: linear-gradient(135deg, color-mix(in srgb, var(--primary-dark) 84%, black 16%) 0%, color-mix(in srgb, var(--primary) 84%, black 16%) 100%);
  --bg-body: #000000;
  --bg-card: rgba(255, 255, 255, 0.04);
  --border-color: rgba(226, 232, 240, 0.14);
  --surface-muted: color-mix(in srgb, var(--primary-bg) 18%, transparent);
  --light-bg: #000000;

  /* Text (Tailwind slate equivalents) */
  --text-dark: #f1f5f9; /* slate-100 */
  --text-gray: #cbd5e1; /* slate-300 */
  --text-light: #94a3b8; /* slate-400 */

  --status-success: #22c55e;
  --status-success-rgb: 34, 197, 94;
  --status-error: #ef4444;
  --status-error-rgb: 239, 68, 68;
  --status-info: #60a5fa;
  --status-info-rgb: 96, 165, 250;
  --status-warning: #f59e0b;
  --status-warning-rgb: 245, 158, 11;

  --overlay-backdrop: rgba(0, 0, 0, 0.8);
  --overlay-surface: rgba(15, 23, 42, 0.92);
  --overlay-border: rgba(148, 163, 184, 0.22);
  --overlay-text: #f8fafc;
}

/* ========== RESET & BASE STYLES ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: var(--font-size-md);
  background-color: var(--color-white);
  color: var(--color-slate-900);
  transition: background-color 0.3s ease, color 0.3s ease;
}

html.dark {
  background-color: var(--color-black);
  color: #f1f5f9;
}

body {
  font-family: 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--color-white);
  background-color: var(--bg-body);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

html.dark body {
  background-color: var(--color-black);
  color: #f1f5f9;
}

body.has-maintenance {
  --header-offset: 120px;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 2.75rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

p {
  margin-bottom: 1rem;
  color: var(--text-gray);
  line-height: 1.8;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-speed) ease;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 70%, white 30%);
  outline-offset: 3px;
}

/* ========== LOADING (shared) ========== */
.loading {
  text-align: center;
  padding: 3rem;
  display: none;
}

.loading.active {
  display: block;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Skip link (a11y) */
.skip-link {
  position: absolute;
  left: var(--space-3);
  top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--text-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-140%);
  transition: transform var(--transition-speed) ease;
  z-index: 2000;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Ensure anchor links account for fixed navbar */
section,
[id] {
  scroll-margin-top: var(--header-offset);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========== RESPONSIVE SAFETY RAILS ========== */
#root {
  min-height: 100svh;
  overflow-x: clip;
}

main,
section,
.container {
  min-width: 0;
}

video,
canvas,
iframe,
svg {
  max-width: 100%;
}

:where(input, select, textarea, button) {
  font: inherit;
}

:where(button, .btn, .admin-btn, .filter-btn, .submit-btn, input[type='submit'], input[type='button'], [role='button']) {
  min-height: 44px;
}

.table-scroll,
.admin-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.table-scroll table,
.admin-table-scroll table {
  min-width: 680px;
}

@media (max-width: 768px) {
  :root {
    --section-padding: 56px 0;
    --header-offset: 84px;
  }

  body.has-maintenance {
    --header-offset: 116px;
  }

  .filter-buttons {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: var(--space-1);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .filter-buttons::-webkit-scrollbar {
    display: none;
  }

  .filter-buttons > * {
    flex: 0 0 auto;
  }
}

/* ========== UTILITIES ========== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
}

.section {
  padding: var(--section-padding);
}

.section-title {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

.section-title h2 {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.section-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  background: var(--gradient-secondary);
  margin: 1rem auto 0;
  border-radius: 2px;
}

/* Fade In Up Animation (Disabled globally until components use Framer Motion) */
.fade-in-up {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.active {
  opacity: 1;
  transform: translateY(0);
}

/* ========== NAVIGATION BAR ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Slight glass base improves readability on busy hero images */
  background: rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: none;
  z-index: 1000;
  transition: all var(--transition-speed) ease;
}

.navbar.scrolled {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: var(--shadow-md);
}

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

/* Split-logo navbar layout (ATI left, menu centered, SLIATE right) */
.nav-container.nav-split {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}

.nav-center {
  display: grid;
  /* Use minmax(0, 1fr) so actions don't shift the centered menu */
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
}

.nav-center .nav-menu {
  grid-column: 2;
  justify-self: center;
}

.nav-center .nav-actions {
  grid-column: 3;
  justify-self: end;
}

.nav-logo-left {
  justify-self: start;
}

.nav-logo-right {
  justify-self: end;
}

.nav-brand-text {
  display: inline-block;
  white-space: nowrap;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-white);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.navbar.scrolled .nav-logo {
  color: var(--primary-blue);
  text-shadow: none;
}

.nav-logo .logo-img {
  width: var(--size-50);
  height: var(--size-50);
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Override default circular avatar styling for the official logos */
.nav-logo-left .logo-img {
  height: clamp(34px, 4.5vw, 42px);
  width: auto;
  border-radius: 10px;
  object-fit: contain;
}

.nav-logo-left .logo-img.logo-img-brand {
  height: clamp(36px, 4.7vw, 46px);
  width: auto;
  border-radius: 12px;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.95);
  padding: 3px;
}

.nav-logo-right .logo-img {
  height: clamp(34px, 4.5vw, 42px);
  width: auto;
  border-radius: 0 !important;
  object-fit: contain;
  border: none !important;
  box-shadow: none !important;
}

/* Ensure SLIATE logo stays non-circular even when navbar is scrolled */
.navbar.scrolled .nav-logo-right .logo-img {
  border: none !important;
  box-shadow: none !important;
}

.navbar.scrolled .nav-logo .logo-img {
  border: 2px solid var(--primary-purple);
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.navbar.scrolled .nav-logo-left .logo-img.logo-img-brand {
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.nav-logo i {
  font-size: 1.75rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  color: var(--color-white);
  font-weight: 600;
  padding: 0.5rem 0;
  position: relative;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.navbar.scrolled .nav-link {
  color: var(--text-dark);
  text-shadow: none;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-white);
  transition: width var(--transition-speed) ease;
}

.navbar.scrolled .nav-link::after {
  background: var(--gradient-secondary);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  color: var(--color-white);
  font-weight: 600;
  padding: 0.5rem 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  background: none;
  border: none;
  font: inherit;
}

.navbar.scrolled .dropdown-toggle {
  color: var(--text-dark);
  text-shadow: none;
}

.dropdown-toggle i {
  font-size: 0.75rem;
  transition: transform var(--transition-speed) ease;
}

.dropdown:hover .dropdown-toggle i {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  min-width: 200px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-speed) ease;
  margin-top: 0.5rem;
  z-index: 100;
}

.dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Keyboard access: open dropdown when focused */
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 0.75rem 1.25rem;
  color: var(--text-dark);
  font-weight: 500;
  transition: all var(--transition-speed) ease;
}

.dropdown-menu a:first-child {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dropdown-menu a:last-child {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.dropdown-menu a:hover {
  background: var(--gradient-primary);
  color: var(--white);
}

.dropdown-menu a i {
  margin-right: 0.5rem;
  width: 16px;
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.5rem;
  z-index: 1001;
}

.hamburger span {
  width: 28px;
  height: var(--px-3);
  background: var(--color-white);
  transition: all var(--transition-speed) ease;
  border-radius: var(--px-3);
}

.navbar.scrolled .hamburger span {
  background: var(--primary-blue);
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 2rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  border: none;
  text-align: center;
  position: relative;
  overflow: hidden;
  max-width: 100%;
}

@media (max-width: 640px) {
  .btn {
    width: 100%;
  }
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.4);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--white);
  color: var(--primary-blue);
  border: 2px solid var(--primary-blue);
}

.btn-secondary:hover {
  background: var(--primary-blue);
  color: var(--white);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 2px solid var(--white);
}

.btn-outline:hover {
  background: var(--white);
  color: var(--primary-blue);
}

/* ========== FOOTER ========== */
.footer {
  background: var(--dark-blue);
  color: var(--white);
  padding: 3rem 0 1.5rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2.5rem;
  margin-bottom: 2rem;
}

/* Alternate footer markup used by some pages (e.g., news.html) */
.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2.5rem;
  max-width: var(--container-max-width);
  margin: 0 auto 2rem;
  padding-inline: clamp(16px, 3vw, 20px);
}

.footer-col h3 {
  color: var(--white);
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

.footer-col p,
.footer-col a {
  color: var(--text-light);
  margin-bottom: 0.75rem;
  display: block;
}

.footer-col a:hover {
  color: var(--accent-purple);
  padding-left: var(--px-5);
}

.footer-section h3 {
  color: var(--white);
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

.footer-section p,
.footer-section a {
  color: var(--text-light);
  margin-bottom: 0.75rem;
  display: block;
}

.footer-section a:hover {
  color: var(--accent-purple);
  padding-left: var(--px-5);
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--size-40);
  height: var(--size-40);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transition: all var(--transition-speed) ease;
}

.social-link:hover {
  background: var(--gradient-secondary);
  transform: translateY(-3px);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  font-size: 0.9rem;
}

.footer-credit {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  opacity: 0.85;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 991px) {
  /* Tablet + Mobile Navigation (prevents overflow of long menus) */
  /* Fix split-navbar alignment on small screens (actions were stuck in the middle column) */
  .nav-container {
    padding: 0.75rem 16px;
  }

  .nav-container.nav-split {
    display: flex;
    gap: 0.75rem;
  }

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

  .nav-actions {
    gap: 0.6rem;
  }

  .theme-toggle {
    width: 40px;
    height: 40px;
  }

  .hamburger {
    padding: 0.35rem;
  }

  .hamburger span {
    width: 26px;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(380px, 80vw);
    height: 100vh;
    background: var(--white);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.75rem;
    transition: right var(--transition-speed) ease;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  }

  .nav-menu.active {
    right: 0;
  }

  .hamburger {
    display: flex;
  }

  /* Keep split header compact on smaller screens */
  .nav-brand-text {
    display: none;
  }

  .nav-link,
  .dropdown-toggle {
    font-size: 1.15rem;
  }

  /* Fix contrast inside the slide-in menu */
  .nav-menu .nav-link,
  .nav-menu .dropdown-toggle {
    color: var(--text-dark);
    text-shadow: none;
  }

  html.dark .nav-menu .nav-link,
  html.dark .nav-menu .dropdown-toggle {
    color: var(--text-dark);
  }

  /* Dropdown behavior inside the slide-in menu */
  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: var(--light-bg);
    margin-top: 0.5rem;
    display: none;
  }

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

@media (max-width: 767px) {
  /* Sections */
  .section {
    padding: 50px 0;
  }
  
  /* Footer */
  .footer-content,
  .footer-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 1199px) {
  /* Slightly tighter spacing so the menu fits better on tablets */
  .nav-container.nav-split .nav-menu {
    gap: 1.25rem;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .footer-content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .footer-content {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .footer-container {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }
  
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
  
  .nav-logo {
    font-size: 1.1rem;
  }

  /* Avoid crowding on very small phones */
  .nav-logo-right {
    display: none;
  }

  .nav-logo-left .logo-img {
    height: 34px;
  }

  .nav-logo-left .logo-img.logo-img-brand {
    height: 36px;
  }
}

/* ========== THEME TOGGLE BUTTON ========== */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  width: var(--size-42);
  height: var(--size-42);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
  position: relative;
  backdrop-filter: blur(var(--px-5));
  -webkit-backdrop-filter: blur(var(--px-5));
}

.navbar.scrolled .theme-toggle {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-purple);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: var(--color-white);
  transform: scale(1.05);
}

.navbar.scrolled .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--primary-purple);
}

.theme-toggle .toggle-icon {
  font-size: 1.2rem;
  position: absolute;
  transition: all var(--transition-speed) ease;
}

.theme-toggle .icon-sun {
  color: #f3f4f6;
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

.theme-toggle .icon-moon {
  color: var(--color-white);
  opacity: 1;
  transform: rotate(0) scale(1);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.navbar.scrolled .theme-toggle .icon-moon {
  color: var(--primary-purple);
  text-shadow: none;
}

/* ========== DARK MODE STYLES ========== */
html.dark {
  --text-dark: #f1f5f9;
  --text-gray: #cbd5e1;
  --text-light: #94a3b8;
  --light-bg: var(--color-black);
  --white: var(--color-white);
  --bg-body: var(--color-black);
  --bg-card: rgba(255, 255, 255, 0.04);
  --border-color: rgba(255, 255, 255, 0.10);
  --card-shadow: 0 6px 24px rgba(0, 0, 0, 0.30);
  --card-shadow-hover: 0 10px 36px rgba(0, 0, 0, 0.40);
  background-color: var(--color-black);
  color: #f1f5f9;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Scroll-to-top button (was previously injected via JS) */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: var(--size-50);
  height: var(--size-50);
  background: var(--gradient-primary);
  color: var(--white);
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-speed) ease;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.4);
  z-index: 999;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.5);
}

@media (max-width: 767px) {
  .scroll-to-top {
    bottom: 20px;
    right: 20px;
    width: var(--size-45);
    height: var(--size-45);
    font-size: 1.1rem;
  }
}

html.dark .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

html.dark .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

html.dark .navbar {
  background: transparent;
}

html.dark .navbar.scrolled {
  background: rgba(15, 23, 42, 0.98);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

html.dark .nav-link {
  color: var(--color-white);
}

html.dark .navbar.scrolled .nav-link {
  color: #e2e8f0;
}

html.dark .nav-link:hover {
  color: var(--color-white);
}

html.dark .dropdown-menu {
  background: var(--color-black);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

html.dark .dropdown-menu a {
  color: #e2e8f0;
}

html.dark .dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.12);
}

html.dark h1,
html.dark h2,
html.dark h3,
html.dark h4,
html.dark h5,
html.dark h6 {
  color: #f1f5f9;
}

html.dark p {
  color: #cbd5e1;
}

html.dark .stat-card,
html.dark .course-card,
html.dark .why-card {
  background: var(--color-black);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

html.dark .about-section,
html.dark .courses-section,
html.dark .why-choose {
  background: var(--color-black);
}

html.dark .stats-section {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.04) 100%);
}

html.dark .footer {
  background: var(--color-black);
}

html.dark .contact-form-side,
html.dark .contact-info-side,
html.dark .form-content,
html.dark .info-content {
  background: var(--color-black);
}

html.dark input,
html.dark textarea,
html.dark select {
  background: var(--color-black);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
}

html.dark input:focus,
html.dark textarea:focus {
  border-color: var(--primary-purple);
}

html.dark .contact-item {
  background: rgba(255, 255, 255, 0.08);
}

html.dark .hero-badge,
html.dark .page-hero-badge {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-white);
}

html.dark .staff-card,
html.dark .event-card,
html.dark .news-card,
html.dark .gallery-item {
  background: var(--color-black);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

html.dark .theme-toggle {
  border-color: rgba(255, 255, 255, 0.3);
}

html.dark .theme-toggle:hover {
  border-color: var(--color-white);
}

/* Dark mode for specific page sections */
html.dark .contact-hero,
html.dark .page-hero,
html.dark .staff-hero,
html.dark .news-hero,
html.dark .events-hero,
html.dark .gallery-hero {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(20, 20, 20, 0.95) 100%);
}

html.dark .section-title h2 {
  background: linear-gradient(135deg, #ffffff 0%, #d1d5db 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

html.dark .map-container iframe {
  filter: invert(90%) hue-rotate(180deg);
}

html.dark .btn-outline {
  border-color: var(--color-white);
  color: var(--color-white);
}

html.dark .btn-outline:hover {
  background: var(--color-white);
  color: var(--color-black);
}

