@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&family=Amiri:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  /* Core Brand Colors */
  --royal-gold: #D4A64F;
  --soft-gold: #F4D27A;
  --accent-cyan: #58C4DD;

  /* Theme Semantic Variables (Dark Mode Default) */
  --bg-main: #071326;
  --bg-secondary: #0A1E3A;
  --text-primary: #FAFAFA;
  --text-secondary: rgba(250, 250, 250, 0.8);
  --text-muted: rgba(250, 250, 250, 0.5);
  --card-bg: rgba(10, 30, 58, 0.4);
  --border-color: rgba(212, 166, 79, 0.3);
  --shadow-color: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

  /* Legacy variable mappings (for backward compatibility) */
  --primary-navy: var(--bg-main);
  --secondary-navy: var(--bg-secondary);
  --soft-white: var(--text-primary);
  --glass-bg: var(--card-bg);
  --glass-border: var(--border-color);
  --glass-glow: var(--shadow-color);
  --luxury-black: #0D0D0D;
  --warm-brown: #2A1A12;
  --light-cream: #F7F3EB;

  /* Typography */
  --font-main: 'Cairo', sans-serif;
  --font-serif: 'Amiri', serif;

  /* Transitions */
  --transition-smooth: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Light Mode Overrides */
body.light-mode {
  --bg-main: #FBF8F1; /* Soft Premium Papyrus Cream */
  --bg-secondary: #FFFFFF;
  --text-primary: #1A2639; /* Deep Royal Navy for high contrast & luxury */
  --text-secondary: #3A4F6C; /* Elegant Slate Blue */
  --text-muted: #788B9E;
  --card-bg: #FFFFFF;
  --border-color: #E6DFD3;
  --shadow-color: 0 8px 30px rgba(26, 38, 57, 0.08);

  /* Antique Gold for Light Mode (More legible than bright gold) */
  --royal-gold: #A67C00;
  --soft-gold: #C59B27;
  --accent-cyan: #2A9D8F; /* Premium earthy teal */

  /* Legacy variable mappings for Light Mode */
  --primary-navy: var(--bg-main);
  --secondary-navy: var(--bg-secondary);
  --soft-white: var(--text-primary);
  --glass-bg: var(--card-bg);
  --glass-border: var(--border-color);
  --glass-glow: var(--shadow-color);
  --luxury-black: var(--text-primary);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  direction: rtl;
}

body {
  font-family: var(--font-main);
  background-color: var(--primary-navy);
  color: var(--soft-white);
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Global Background Effects */
.bg-effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-effects::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(212, 166, 79, 0.15) 0%, transparent 70%);
  filter: blur(80px);
}

.bg-effects::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(88, 196, 221, 0.1) 0%, transparent 70%);
  filter: blur(80px);
}

.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(var(--soft-gold) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.03;
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-glow);
  border-radius: 20px;
}

/* Typography Classes */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.3;
}

.text-gold {
  color: var(--royal-gold);
}

.text-cyan {
  color: var(--accent-cyan);
}

.font-serif {
  font-family: var(--font-serif);
}

.heading-luxury {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  color: var(--royal-gold);
  text-shadow: 0 4px 15px rgba(212, 166, 79, 0.5);
  font-weight: bold;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border-radius: 50px;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
  border: none;
  position: relative;
  overflow: hidden;
}

.btn-gold {
  background: linear-gradient(135deg, var(--royal-gold), #b88a3a);
  color: var(--luxury-black);
  box-shadow: 0 4px 15px rgba(212, 166, 79, 0.4);
}

.btn-gold:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(212, 166, 79, 0.6);
}

.btn-gold::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-25deg);
  animation: shine 3s infinite;
}

.btn-outline {
  background: transparent;
  color: var(--soft-white);
  border: 1px solid var(--royal-gold);
}

.btn-outline:hover {
  background: rgba(212, 166, 79, 0.1);
  box-shadow: 0 0 15px rgba(212, 166, 79, 0.3);
}

@keyframes shine {
  0% {
    left: -100%;
  }

  20% {
    left: 200%;
  }

  100% {
    left: 200%;
  }
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 1rem 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  transition: var(--transition-smooth);
  border-bottom: 1px solid transparent;
}

.navbar.scrolled {
  background: rgba(7, 19, 38, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  padding: 0.8rem 5%;
}

body.light-mode .navbar.scrolled {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(142, 132, 111, 0.18);
  box-shadow: 0 6px 24px rgba(37, 55, 76, 0.12);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 15px;
  text-decoration: none;
}

.logo-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--royal-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(212, 166, 79, 0.4);
  background: var(--secondary-navy);
  color: var(--royal-gold);
  font-weight: bold;
  font-size: 1.5rem;
  overflow: hidden; /* Clipping mask for owner avatar */
}

.logo-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: high-quality;
}

.nav-brand-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--soft-white);
}

.nav-links {
  display: flex;
  gap: 30px;
  list-style: none;
}

.nav-links a {
  color: var(--soft-white);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  transition: var(--transition-smooth);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--royal-gold);
  transition: var(--transition-smooth);
}

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

.nav-links a:hover,
.nav-links a.active {
  color: var(--royal-gold);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.mobile-menu-btn {
  display: none;
  font-size: 1.5rem;
  color: var(--royal-gold);
  cursor: pointer;
}

/* Footer */
footer {
  background: var(--secondary-navy);
  border-top: 1px solid var(--glass-border);
  padding: 3rem 5% 1rem;
  margin-top: 5rem;
  position: relative;
  z-index: 10;
}

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

.footer-col h3 {
  color: var(--royal-gold);
  margin-bottom: 1.5rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 0.8rem;
}

.footer-col ul a {
  color: var(--soft-white);
  text-decoration: none;
  transition: var(--transition-smooth);
}

.footer-col ul a:hover {
  color: var(--royal-gold);
  padding-right: 5px;
}

.social-icons {
  display: flex;
  gap: 15px;
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-navy);
  color: var(--royal-gold);
  text-decoration: none;
  transition: var(--transition-smooth);
  border: 1px solid var(--glass-border);
}

.social-icons a:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(212, 166, 79, 0.4);
  background: var(--royal-gold);
  color: var(--primary-navy);
}

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

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Utilities */
.text-center {
  text-align: center;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

.mb-3 {
  margin-bottom: 3rem;
}

.mt-1 {
  margin-top: 1rem;
}

.mt-2 {
  margin-top: 2rem;
}

.mt-3 {
  margin-top: 3rem;
}

/* ==========================================================================
   TRUE RESPONSIVE & MOBILE EXPERIENCE UPGRADE
   ========================================================================== */

/* Global Fluid Typography & Spacing */
html {
  font-size: clamp(14px, 1.5vw, 16px);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(15px, 5vw, 30px);
}

/* Modals & Forms Responsiveness */
.modal-overlay {
  padding: clamp(10px, 3vw, 20px);
  overflow-y: auto;
}
.modal-content {
  width: 100%;
  max-width: 500px;
  margin: auto;
  padding: clamp(20px, 5vw, 40px);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

/* Images & Media */
img, video {
  max-width: 100%;
  height: auto;
}

/* Form Groups */
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Base Responsive */
@media (max-width: 992px) {
  /* Navbar / Drawer Menu */
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: clamp(250px, 75vw, 320px);
    height: 100vh;
    background: var(--secondary-navy);
    flex-direction: column;
    padding: 100px 30px;
    transition: all 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    border-left: 1px solid var(--glass-border);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 999;
    overflow-y: auto;
  }
  .nav-links.active {
    right: 0;
  }
  .mobile-menu-btn {
    display: block;
    z-index: 1000;
  }
  .navbar {
    padding: 0.8rem clamp(15px, 5vw, 30px);
  }
}

@media (max-width: 768px) {
  /* Navbar Actions */
  .nav-actions {
    gap: 8px;
  }
  .nav-actions .btn {
    padding: 6px 12px;
    font-size: 0.9rem;
  }
  /* Hide extra buttons on mobile to keep navbar premium; they will be moved to drawer via JS */
  .nav-actions .btn:not(.mobile-menu-btn):not(#themeToggle) {
    display: none !important;
  }
  
  .logo-circle {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  /* Hide brand text on smaller screens to keep nav clean and premium */
  .nav-brand-text {
    display: none;
  }

  /* Footers */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  .social-icons {
    justify-content: center;
  }
  
  /* Fix any existing fixed width grids */
  .courses-grid, .features-grid, .stats-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  /* Ultra small screens (320px - 425px) */
  .btn:not(.nav-actions .btn):not(.close-modal) {
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
  }
  .nav-actions .btn {
    width: auto;
    margin-bottom: 0;
  }
  .nav-actions {
    gap: 5px;
  }
  /* Typography tweaks */
  .heading-luxury {
    font-size: clamp(2rem, 8vw, 2.5rem);
  }
  h2 {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }
  h3 {
    font-size: clamp(1.2rem, 5vw, 1.5rem);
  }
  /* Modals */
  .modal-content {
    padding: 20px 15px;
  }
}