/* ==============================================
   BLANKDIGI 2026 - MODERN DESIGN SYSTEM
   Bento Grid + Smart Dark/Light Mode
   ============================================== */

/* ============================================== 
   CSS VARIABLES - 2026 PALETTE
   ============================================== */
:root {
  /* === DARK MODE (DEFAULT) === */
  
  /* Backgrounds - Bleu TRÈS désaturé (presque gris) */
  --bg-primary: #0F0F11;
  --bg-secondary: #1A1A1D;
  --bg-tertiary: #25252A;
  --bg-glass: rgba(30, 30, 35, 0.6);
  
  /* Accent Colors - Bleu saturé UNIQUEMENT pour accents */
  --accent-primary: #3B82F6;
  --accent-hover: #2563EB;
  --accent-light: rgba(59, 130, 246, 0.1);
  
  /* Success/Warning */
  --success: #10B981;
  --warning: #F59E0B;
  
  /* Text Colors */
  --text-primary: #F9FAFB;
  --text-secondary: #D1D5DB;
  --text-muted: #9CA3AF;
  
  /* Glass Effects - Subtil, pas neon */
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --glass-hover: rgba(255, 255, 255, 0.04);
  
  /* Blur */
  --blur: 20px;
}

/* === LIGHT MODE === */
[data-theme="light"] {
  /* Backgrounds - Clean whites */
  --bg-primary: #FAFAFA;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F3F4F6;
  --bg-glass: rgba(255, 255, 255, 0.8);
  
  /* Accent - Same blue */
  --accent-primary: #3B82F6;
  --accent-hover: #2563EB;
  --accent-light: rgba(59, 130, 246, 0.1);
  
  /* Text Colors */
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6B7280;
  
  /* Light Mode - IMPORTANT: Subtle border + shadow */
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 
                  0 1px 2px rgba(0, 0, 0, 0.04);
  --glass-hover: rgba(0, 0, 0, 0.02);
  
  --blur: 10px;
}

/* Spacing Scale */
:root {
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;
  --space-3xl: 96px;
}

/* Transitions */
:root {
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.6;
  transition: background-color var(--transition-base),
              color var(--transition-base);
}

/* Subtle animated gradient - Pas neon */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at 20% 20%, 
    rgba(59, 130, 246, 0.03) 0%, 
    transparent 50%
  ),
  radial-gradient(
    circle at 80% 80%, 
    rgba(16, 185, 129, 0.02) 0%, 
    transparent 50%
  );
  z-index: -1;
  opacity: 0.6;
  pointer-events: none;
}

[data-theme="light"] body::before {
  background: radial-gradient(
    circle at 20% 20%, 
    rgba(59, 130, 246, 0.02) 0%, 
    transparent 50%
  );
}

/* ============================================== 
   TYPOGRAPHY 
   ============================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.1;
}

h2 {
  font-size: clamp(32px, 4vw, 48px);
}

h3 {
  font-size: clamp(24px, 3vw, 36px);
}

h4 {
  font-size: 24px;
  font-weight: 700;
}

p {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.7;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-primary), var(--success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================== 
   CONTAINER & LAYOUT 
   ============================================== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

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

/* ============================================== 
   GLASS CARD COMPONENT
   ============================================== */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: var(--space-lg);
  transition: all var(--transition-base);
  box-shadow: var(--glass-shadow);
}

.glass-card:hover {
  background: var(--glass-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .glass-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08),
              0 2px 6px rgba(0, 0, 0, 0.04);
}

/* ============================================== 
   BUTTONS 
   ============================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 10px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: var(--glass-hover);
  transform: translateY(-2px);
}

/* ============================================== 
   NAVIGATION 
   ============================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-bottom: 1px solid var(--glass-border);
  transition: all var(--transition-base);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  max-width: 1280px;
  margin: 0 auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 20px;
}

.nav-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-primary), var(--success));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  font-size: 20px;
}

.nav-links {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.nav-links a:hover {
  color: var(--accent-primary);
}

/* Nav Actions Container - IMPORTANT: Toujours visible */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Theme Toggle - Toujours visible sur tous les écrans */
.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
  font-size: 20px;
  flex-shrink: 0; /* Ne se réduit jamais */
}

.theme-toggle:hover {
  background: var(--glass-hover);
  transform: scale(1.05);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .nav-inner {
    gap: 12px;
  }
  
  .nav-links {
    display: none;
  }
  
  .nav-actions {
    display: flex;
    gap: 8px;
  }
}

/* Petit mobile - CTA plus compact */
@media (max-width: 480px) {
  .nav-actions .btn {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

    display: none;
  }
}

/* ============================================== 
   HERO SECTION 
   ============================================== */
.hero {
  padding: calc(160px + var(--space-3xl)) 0 var(--space-3xl);
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 10px 20px;
  background: var(--accent-light);
  color: var(--accent-primary);
  border-radius: 50px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: var(--space-lg);
  border: 1px solid var(--glass-border);
}

.hero-title {
  margin-bottom: var(--space-md);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.hero-subtitle {
  font-size: 20px;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto var(--space-xl);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-2xl);
}

.hero-stats {
  margin-top: var(--space-xl);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  max-width: 800px;
  margin: 0 auto;
}

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

.hero-stat-value {
  display: block;
  font-size: 48px;
  font-weight: 900;
  color: var(--accent-primary);
  margin-bottom: var(--space-xs);
}

.hero-stat-label {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================================== 
   BENTO GRID SECTION 
   ============================================== */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-3xl);
}

.bento-item {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: var(--space-xl);
  transition: all var(--transition-base);
  box-shadow: var(--glass-shadow);
}

.bento-item:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .bento-item:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.bento-large {
  grid-column: span 8;
}

.bento-medium {
  grid-column: span 6;
}

.bento-small {
  grid-column: span 4;
}

@media (max-width: 1024px) {
  .bento-large,
  .bento-medium,
  .bento-small {
    grid-column: span 12;
  }
}

/* ============================================== 
   SERVICES SECTION 
   ============================================== */
.services {
  padding: var(--space-3xl) 0;
}

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

.section-subtitle {
  color: var(--accent-primary);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.service-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: var(--space-xl);
  transition: all var(--transition-base);
  box-shadow: var(--glass-shadow);
}

.service-card:hover {
  transform: translateY(-6px) scale(1.02);
}

.service-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: var(--space-md);
}

.service-card h3 {
  margin-bottom: var(--space-sm);
}

.service-card ul {
  list-style: none;
  margin-top: var(--space-md);
}

.service-card li {
  padding: var(--space-xs) 0;
  padding-left: 28px;
  position: relative;
  color: var(--text-secondary);
}

.service-card li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

/* ============================================== 
   PRICING 
   ============================================== */
.pricing {
  padding: var(--space-3xl) 0;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-xl);
  margin-top: var(--space-2xl);
}

.pricing-card {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: var(--space-xl);
  box-shadow: var(--glass-shadow);
  transition: all var(--transition-base);
  position: relative;
}

.pricing-card.featured {
  border: 2px solid var(--accent-primary);
  transform: scale(1.05);
}

.pricing-card:hover {
  transform: translateY(-8px) scale(1.02);
}

.pricing-card.featured:hover {
  transform: translateY(-8px) scale(1.07);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  right: 24px;
  background: var(--accent-primary);
  color: white;
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.pricing-name {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.pricing-price {
  font-size: 48px;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.pricing-period {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: var(--space-lg);
}

.pricing-features {
  list-style: none;
  margin: var(--space-lg) 0;
}

.pricing-features li {
  padding: var(--space-sm) 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-secondary);
}

.pricing-features li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================== 
   FOOTER 
   ============================================== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--glass-border);
  padding: var(--space-2xl) 0;
  margin-top: var(--space-3xl);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.footer-section h4 {
  font-size: 16px;
  margin-bottom: var(--space-md);
}

.footer-links {
  list-style: none;
}

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

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

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

.footer-bottom {
  text-align: center;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 14px;
}

/* ============================================== 
   UTILITIES 
   ============================================== */
.text-center {
  text-align: center;
}

.mb-xl {
  margin-bottom: var(--space-xl);
}

.mt-xl {
  margin-top: var(--space-xl);
}

/* ============================================== 
   NAV ACTIONS - Theme Toggle + CTA
   ============================================== */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
}

@media (max-width: 768px) {
  .nav-actions {
    gap: var(--space-sm);
  }
  
  /* On mobile, show toggle but maybe hide text on CTA */
  .nav-actions .btn-primary {
    padding: 14px 20px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  /* Very small screens - keep toggle visible */
  .theme-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 18px;
  }
}

/* ============================================== 
   RTL SUPPORT (Arabic/Darija)
   ============================================== */
html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .nav-inner {
  flex-direction: row-reverse;
}

html[dir="rtl"] .nav-links {
  flex-direction: row-reverse;
}

html[dir="rtl"] .nav-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .hero-content {
  text-align: right;
}

html[dir="rtl"] .hero-actions {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

html[dir="rtl"] .hero-stats {
  margin-top: var(--space-xl);
  flex-direction: row-reverse;
}

html[dir="rtl"] .grid,
html[dir="rtl"] .grid-2,
html[dir="rtl"] .pricing-grid {
  direction: rtl;
}

html[dir="rtl"] .glass-card,
html[dir="rtl"] .glass-card-elevated {
  text-align: right;
}

html[dir="rtl"] .service-features li::before {
  margin-left: 8px;
  margin-right: 0;
}

html[dir="rtl"] .process-step {
  flex-direction: row-reverse;
  text-align: right;
}

html[dir="rtl"] .process-content {
  text-align: right;
}

html[dir="rtl"] .footer-grid {
  direction: rtl;
}

html[dir="rtl"] .footer-col {
  text-align: right;
}

html[dir="rtl"] .footer-links {
  text-align: right;
}

html[dir="rtl"] .cta-section {
  text-align: right;
}

html[dir="rtl"] .cta-actions {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

html[dir="rtl"] .text-center {
  text-align: center !important;
}

html[dir="rtl"] .testimonial-card {
  text-align: right;
}

html[dir="rtl"] .testimonial-author {
  flex-direction: row-reverse;
}

/* Keep LTR for specific elements */
html[dir="rtl"] .nav-logo,
html[dir="rtl"] .hero-stat-value,
html[dir="rtl"] .pricing-price {
  direction: ltr;
}

/* ============================================== 
   FLOATING WHATSAPP BUTTON
   ============================================== */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  z-index: 9999;
  transition: all 0.3s ease;
  text-decoration: none;
}

.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
}

.whatsapp-float svg {
  width: 32px;
  height: 32px;
  fill: white;
}

.whatsapp-float .tooltip {
  position: absolute;
  right: 70px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  color: var(--foreground);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.whatsapp-float:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

/* RTL Support */
html[dir="rtl"] .whatsapp-float {
  right: auto;
  left: 24px;
}

html[dir="rtl"] .whatsapp-float .tooltip {
  right: auto;
  left: 70px;
}

/* Mobile */
@media (max-width: 768px) {
  .whatsapp-float {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  
  .whatsapp-float svg {
    width: 28px;
    height: 28px;
  }
  
  .whatsapp-float .tooltip {
    display: none;
  }
  
  html[dir="rtl"] .whatsapp-float {
    left: 16px;
  }
}

/* Pulse animation */
@keyframes whatsapp-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
  70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.whatsapp-float {
  animation: whatsapp-pulse 2s infinite;
}

.whatsapp-float:hover {
  animation: none;
}

/* ============================================== 
   LANGUAGE SWITCHER
   ============================================== */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 16px;
  padding: 4px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
}

.lang-switcher button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-switcher button:hover {
  color: var(--foreground);
  background: var(--glass-border);
}

.lang-switcher button.active {
  background: var(--primary);
  color: white;
}

html[dir="rtl"] .lang-switcher {
  margin-left: 0;
  margin-right: 16px;
}

@media (max-width: 768px) {
  .lang-switcher {
    margin-left: 8px;
    padding: 2px;
  }
  .lang-switcher button {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* ============================================== 
   ARABIC FONT
   ============================================== */
html[lang="ar"], 
html[dir="rtl"] {
  font-family: 'Noto Sans Arabic', 'Inter', sans-serif;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6 {
  font-family: 'Noto Sans Arabic', 'Inter', sans-serif;
  font-weight: 700;
}

/* ============================================== 
   BACK TO TOP BUTTON
   ============================================== */
.back-to-top {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 9998;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-3px);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  stroke: var(--foreground);
  transition: stroke 0.3s ease;
}

.back-to-top:hover svg {
  stroke: white;
}

html[dir="rtl"] .back-to-top {
  right: auto;
  left: 24px;
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 90px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
  html[dir="rtl"] .back-to-top {
    left: 16px;
  }
}

/* ============================================== 
   SMOOTH SCROLL
   ============================================== */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Scroll padding for fixed navbar */
html {
  scroll-padding-top: 120px;
}

/* ============================================== 
   COMMAND PALETTE (Ctrl+K / ⌘K)
   ============================================== */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.cmdk-overlay.open {
  opacity: 1;
  visibility: visible;
}

.cmdk-modal {
  width: min(640px, 100%);
  border-radius: 16px;
  background: rgba(18, 18, 24, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
  overflow: hidden;
  transform: scale(0.95) translateY(-20px);
  transition: transform 0.2s ease;
}

.cmdk-overlay.open .cmdk-modal {
  transform: scale(1) translateY(0);
}

.cmdk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cmdk-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.9);
}

.cmdk-hint {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.6;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 10px;
  border-radius: 8px;
  font-family: monospace;
}

.cmdk-input {
  width: 100%;
  padding: 16px 18px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cmdk-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.cmdk-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
}

.cmdk-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  padding: 12px 12px 6px;
}

.cmdk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}

.cmdk-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.cmdk-item[aria-selected="true"] {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}

.cmdk-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cmdk-item-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 16px;
}

.cmdk-item-title {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
}

.cmdk-item-hint {
  font-size: 12px;
  opacity: 0.5;
  font-family: monospace;
}

.cmdk-footer {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.cmdk-footer span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cmdk-footer kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
}

.cmdk-empty {
  padding: 40px 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
}

/* RTL Support */
html[dir="rtl"] .cmdk-item-left {
  flex-direction: row-reverse;
}

html[dir="rtl"] .cmdk-header {
  flex-direction: row-reverse;
}

/* ============================================== 
   MOBILE NAVIGATION FIX
   ============================================== */

/* Hamburger Menu Button */
.nav-hamburger {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px;
  flex-shrink: 0;
}

.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.nav-hamburger:hover {
  background: var(--glass-hover);
}

/* Mobile Menu Overlay */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 9998;
  padding: 100px 24px 40px;
  flex-direction: column;
  gap: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu a {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  padding: 16px 0;
  border-bottom: 1px solid var(--glass-border);
  transition: color 0.2s ease;
}

.mobile-menu a:hover {
  color: var(--primary);
}

.mobile-menu-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-primary);
}

.mobile-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: auto;
}

.mobile-menu-actions .lang-switcher {
  justify-content: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .nav-hamburger {
    display: flex;
  }
  
  .mobile-menu {
    display: flex;
  }
  
  /* Hide lang switcher in nav on mobile */
  .nav-actions .lang-switcher {
    display: none;
  }
  
  /* Keep theme toggle + CTA + hamburger in nav */
  .nav-actions {
    gap: 8px;
  }
  
  .nav-actions .btn-primary {
    padding: 10px 14px;
    font-size: 13px;
  }
  
  .theme-toggle {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }
}

@media (max-width: 480px) {
  /* Very small: hide CTA text, keep icon or hide completely */
  .nav-actions .btn-primary {
    padding: 10px 12px;
    font-size: 12px;
  }
  
  /* Safe area for iPhone notch */
  .nav {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  
  .mobile-menu {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
}

/* RTL Mobile Menu */
html[dir="rtl"] .mobile-menu-close {
  right: auto;
  left: 24px;
}

html[dir="rtl"] .mobile-menu a {
  text-align: right;
}
