/* =========================================
   AXIORA DUAL THEME VARIABLES
========================================= */
:root {
  /* DARK THEME (The Deep Space Look) */
  --bg-main: radial-gradient(circle at 50% 20%, #1f1f2b 0%, #0d0d15 100%);
  --bg-nav: linear-gradient(90deg, #0c0c20, #111122);
  --text-primary: white;
  --text-secondary: #ccc;
  --text-muted: #888;
  --space-opacity: 1;
  
  /* Dark Cards */
  --bg-card: #1c1c2d;
  --stat-box-bg: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.05);
  --card-shadow: 0 8px 20px rgba(127, 90, 240, 0.15);
  --card-hover-shadow: 0 12px 40px rgba(127, 90, 240, 0.25);
  --card-inner-glow: inset 0 0 0 transparent; /* No inner glow in dark mode */
  
  /* Chat */
  --bg-chat: #1c1c2d;
  --border-chat: rgba(127, 90, 240, 0.3);
  --chat-header-bg: rgba(0, 0, 0, 0.2);
  --chat-input-bg: #1f1f2b;
  --received-msg-bg: #2d2d3d;
  
  /* Hero Text */
  --hero-gradient: linear-gradient(to right, #ffffff, #bbaaff);
}

[data-theme="light"] {
  /* LIGHT THEME (Crisp, Premium Dashboard Look) */
  --bg-main: radial-gradient(circle at 50% -20%, #eef2ff 0%, #f8fafc 40%, #e2e8f0 100%);
  --bg-nav: linear-gradient(90deg, #ffffff, #f1f5f9);
  --text-primary: #0f172a; 
  --text-secondary: #475569;
  --text-muted: #64748b;
  --space-opacity: 0;
  
  /* CARDS: Added a slight frost and crisp structural borders */
  --bg-card: rgba(255, 255, 255, 0.9);
  --stat-box-bg: rgba(255, 255, 255, 0.9);
  
  /* THE FIX: Changed from invisible white to a crisp, subtle slate border */
  --border-color: rgba(15, 23, 42, 0.12); 
  
  /* Shadows: Deepened slightly to lift the cards off the page */
  --card-shadow: 0 10px 30px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  --card-hover-shadow: 0 20px 40px rgba(124, 58, 237, 0.15), 0 5px 10px rgba(0, 0, 0, 0.05);
  --card-inner-glow: inset 0 0 20px rgba(255, 255, 255, 0.8);
  
  /* Chat & Inputs: Giving form fields a faint background so they don't vanish */
  --bg-chat: rgba(255, 255, 255, 0.95);
  --border-chat: rgba(99, 102, 241, 0.3);
  --chat-header-bg: #f1f5f9;
  
  /* THE FIX: Input fields now have a faint slate background to stand out */
  --chat-input-bg: #f8fafc; 
  --received-msg-bg: #f1f5f9;
  
  /* Deep purple/indigo text gradient for the Hero */
  --hero-gradient: linear-gradient(to right, #4f46e5, #9333ea); 
}

/* =========================================
   BASE STYLES & TRANSITIONS
========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Be Vietnam Pro', sans-serif;
}

body {
  background: var(--bg-main);
  color: var(--text-primary);
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* =========================================
   SPACE ANIMATIONS (Fade out in light mode)
========================================= */
.stars, .orbit, .shooting-star, .iss {
  opacity: var(--space-opacity);
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.stars {
  position: fixed; width: 200%; height: 200%;
  background: transparent url('https://www.transparenttextures.com/patterns/stardust.png') repeat;
  animation: starsScroll 60s linear infinite;
}

.orbit {
  position: fixed; width: 100%; height: 100%;
  background-image: radial-gradient(circle, transparent 95%, rgba(255,255,255,0.1) 100%);
  animation: orbitSpin 80s linear infinite;
}

.iss::before {
  content: '\1F6F8'; font-size: 2rem; position: fixed;
  top: 10%; left: -10%; animation: issFly 45s linear infinite;
}

.shooting-star::before {
  content: ''; position: fixed; top: -50px; left: 0; width: 2px; height: 80px;
  background: linear-gradient(180deg, white, transparent);
  animation: shoot 5s linear infinite;
}

@keyframes starsScroll { 0% { transform: translate(0, 0); } 100% { transform: translate(-50%, -50%); } }
@keyframes orbitSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes shoot { 0% { top: -10%; left: 0; opacity: 1; transform: rotate(135deg); } 100% { top: 100%; left: 100%; opacity: 0; transform: rotate(135deg); } }
@keyframes issFly { 0% { transform: translateX(-10%) rotate(0deg); } 100% { transform: translateX(110%) rotate(360deg); } }

/* =========================================
   NAVBAR & HEADER
========================================= */
.navbar {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 30px; background: var(--bg-nav); backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4); border-bottom: 1px solid var(--border-color);
  z-index: 999; color: var(--text-primary); flex-wrap: wrap; transition: background 0.4s ease;
}

.brand {
  font-size: 22px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(90deg, #00c9ff, #92fe9d);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  font-family: 'Exo', sans-serif;
}

.hamburger {
  display: none; font-size: 24px; cursor: pointer; color: var(--text-primary);
  padding: 8px; background: rgba(127,127,127,0.1); border-radius: 4px; transition: all 0.3s ease;
}
.hamburger:hover { background: rgba(127,127,127,0.2); }

.nav-links {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; gap: 30px; transition: background 0.4s ease;
}

.nav-link {
  color: var(--text-primary); text-decoration: none; font-weight: 500;
  font-size: 16px; transition: color 0.3s ease;
}
.nav-link:hover { color: #9be3ff; }
.nav-right { display: flex; align-items: center; gap: 20px; }
#login-link { color: var(--text-primary); text-decoration: none; font-weight: 600; font-size: 14px; }
#user-info { color: var(--text-primary); font-weight: 600; font-size: 15px; }

/* =========================================
   DROPDOWN MENU STYLES
========================================= */
.nav-dropdown { position: relative; display: flex; align-items: center; height: 100%; }
.dropdown-trigger { cursor: pointer; display: flex; align-items: center; gap: 6px; }
.arrow-icon { font-size: 12px; transition: transform 0.3s ease; }

.dropdown-menu {
  position: absolute; top: 100%; left: 0; background: var(--bg-card);
  min-width: 200px; border-radius: 8px; border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow); display: none; flex-direction: column;
  padding: 8px 0; opacity: 0; transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease; z-index: 1000;
}

.dropdown-item {
  color: var(--text-primary); padding: 12px 20px; text-decoration: none;
  font-size: 14px; transition: all 0.2s ease; border-left: 2px solid transparent;
}
.dropdown-item:hover {
  background: var(--stat-box-bg); color: #9be3ff; border-left: 2px solid #9be3ff;
}

/* =========================================
   MAIN CONTENT
========================================= */
.hero { text-align: center; padding: 8rem 2rem; position: relative; z-index: 1; }
.hero h2 { 
  font-size: 4rem; 
  background: var(--hero-gradient); 
  -webkit-background-clip: text; 
  -webkit-text-fill-color: transparent; 
  margin-bottom: 1.5rem; 
  transition: background 0.4s ease; 
}
.hero p { max-width: 700px; margin: 0 auto; font-size: 1.25rem; color: var(--text-secondary); transition: color 0.4s ease; }

.cta {
  background: #7f5af0; color: white; padding: 0.8rem 2.5rem; font-size: 1.1rem;
  border: none; border-radius: 12px; margin-top: 2.5rem; cursor: pointer;
  transition: background 0.3s, transform 0.3s; box-shadow: 0 0 30px rgba(127, 90, 240, 0.5);
}
.cta:hover { background: #6d44e0; transform: scale(1.05); }

/* =========================================
   NASA-LEVEL CARDS (Live Stats & Features)
========================================= */
.stat-box {
  flex: 1 1 250px;
  background: var(--stat-box-bg);
  color: var(--text-primary);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  
  /* The Glass Effect */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  
  /* The Structure & Glow */
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow), var(--card-inner-glow);
  
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.stat-box h3 { font-size: 1.5rem; margin-bottom: 1rem; transition: color 0.4s ease; }
.stat-number { font-size: 2rem; transition: color 0.4s ease; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; padding: 4rem 1rem; max-width: 1200px; margin: 0 auto; position: relative; z-index: 1; }

.feature-box {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  
  /* The Glass Effect */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  
  /* The Structure & Glow */
  border: 1px solid var(--border-color);
  box-shadow: var(--card-shadow), var(--card-inner-glow);
  
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.feature-box:hover { 
  transform: translateY(-8px) scale(1.01); 
  box-shadow: var(--card-hover-shadow), var(--card-inner-glow); 
  border-color: rgba(124, 58, 237, 0.3);
}
.feature-box h3 { font-size: 1.6rem; color: #a07fff; margin-bottom: 1rem; transition: color 0.4s ease; }
.feature-box p { font-size: 1rem; color: var(--text-secondary); transition: color 0.4s ease; }

/* Add a subtle tint to icons/text in light mode so they don't look flat */
[data-theme="light"] .feature-box h3 {
  text-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}

footer { text-align: center; padding: 2rem; font-size: 0.95rem; color: var(--text-muted); transition: color 0.4s ease;}
footer p { margin-bottom: 1rem; }

/* =========================================
   CHAT PANEL
========================================= */
.chat-trigger {
  position: fixed; bottom: 20px; right: 20px; background: #7f5af0; color: white; border: none; border-radius: 50px; padding: 1rem 1.5rem; font-size: 1rem; font-weight: 600; cursor: pointer; box-shadow: 0 4px 20px rgba(127, 90, 240, 0.4); z-index: 999; transition: transform 0.3s ease, opacity 0.3s ease; opacity: 0; visibility: hidden; transform: scale(0.8);
}
.chat-trigger.visible { opacity: 1; visibility: visible; transform: scale(1); }
.chat-trigger:hover { transform: scale(1.05); }

.telegram-trigger { position: fixed; bottom: 20px; left: 20px; background: #0088cc; color: white; border: none; border-radius: 50px; padding: 1rem 1.5rem; font-size: 1rem; font-weight: 600; cursor: pointer; box-shadow: 0 4px 20px rgba(0, 136, 204, 0.4); z-index: 998; transition: transform 0.3s ease; text-decoration: none; display: flex; align-items: center; gap: 0.5rem; }
.telegram-trigger:hover { transform: scale(1.05); }

.chat-panel {
  position: fixed; top: 0; right: 0; width: 100%; max-width: 400px; height: 100%; z-index: 1000; transform: translateX(100%); transition: transform 0.4s ease-in-out, background 0.4s ease; background: var(--bg-chat); border-left: 1px solid var(--border-chat); box-shadow: -10px 0 40px rgba(127, 90, 240, 0.25); display: flex; flex-direction: column; backdrop-filter: blur(12px);
}
.chat-panel.open { transform: translateX(0); }
.chat-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: var(--chat-header-bg); border-bottom: 1px solid var(--border-chat); flex-shrink: 0; transition: background 0.4s ease; }
.user-info { display: flex; align-items: center; gap: 0.75rem; color: var(--text-primary); }
.user-info img { width: 40px; height: 40px; border-radius: 50%; }
#close-chat-button { background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; transition: color 0.2s; }
#close-chat-button:hover { color: var(--text-primary); }
#chat-window { flex-grow: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.message { display: flex; flex-direction: column; max-width: 75%; }
.message-bubble { padding: 0.75rem 1rem; border-radius: 18px; line-height: 1.4; word-wrap: break-word; }
.message-sender { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.25rem; color: #a07fff; }
.received { align-self: flex-start; align-items: flex-start; }
.received .message-bubble { background: var(--received-msg-bg); color: var(--text-primary); border-top-left-radius: 4px; transition: background 0.4s ease, color 0.4s ease;}
.sent { align-self: flex-end; align-items: flex-end; }
.sent .message-sender { display: none; }
.sent .message-bubble { background: #7f5af0; color: white; border-top-right-radius: 4px; }
#message-form { display: flex; padding: 1.5rem; border-top: 1px solid var(--border-chat); gap: 1rem; flex-shrink: 0; }
#message-input { flex-grow: 1; background: var(--chat-input-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 0.8rem; color: var(--text-primary); font-size: 1rem; transition: background 0.4s ease, color 0.4s ease; }
#message-input:focus { outline: none; border-color: #7f5af0; }
#message-form button { background: #7f5af0; color: white; border: none; border-radius: 12px; padding: 0 1.5rem; font-size: 1.25rem; cursor: pointer; transition: background-color 0.2s; }
#message-form button:hover { background: #6d44e0; }

/* =========================================
   MOBILE RESPONSIVENESS & OVERRIDES
========================================= *//* =========================================
   MOBILE RESPONSIVENESS & OVERRIDES
========================================= */

@media (min-width: 950px) {
  /* Handle Dropdown Hover on Desktop */
  .nav-dropdown:hover .dropdown-menu { display: flex; opacity: 1; transform: translateY(0); }
  .nav-dropdown:hover .arrow-icon { transform: rotate(180deg); }
  /* Hide Mobile UI on Desktop */
  .mobile-profile-section, .mobile-logout, .menu-close-btn, .nav-overlay { display: none !important; }
}

/* --- MOBILE MENU UI COMPONENTS --- */

/* Dark Overlay behind menu */
.nav-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); z-index: 996; opacity: 0;
  pointer-events: none; transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}
.nav-overlay.show { opacity: 1; pointer-events: auto; }

/* Mobile Menu Close "X" Button */
.menu-close-btn {
  position: absolute; top: 15px; right: 20px; font-size: 20px; 
  color: var(--text-primary); cursor: pointer; background: var(--stat-box-bg); 
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; 
  border-radius: 50%; border: 1px solid var(--border-color); z-index: 1000; transition: all 0.3s ease;
}
.menu-close-btn:hover { background: #ff6b6b; color: white; border-color: #ff6b6b; }

/* Mobile Profile Area (The "K" Initial) */
.mobile-profile-section {
  padding: 15px; border-bottom: 1px solid var(--border-color); 
  margin-bottom: 10px; display: flex; justify-content: center; width: 100%;
}
.profile-initial {
  width: 50px; height: 50px; border-radius: 50%; 
  background: linear-gradient(135deg, #7f5af0, #00c9ff); color: white; 
  display: flex; align-items: center; justify-content: center; 
  font-weight: bold; font-size: 22px; box-shadow: 0 4px 10px rgba(127, 90, 240, 0.3);
}
.login-prompt-mobile {
  padding: 10px 20px; border-radius: 20px; background: var(--stat-box-bg); 
  border: 1px solid var(--border-color); color: var(--text-primary); 
  display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600;
}

/* Mobile Logout Button */
.mobile-logout { margin-top: auto !important; color: #ff6b6b !important; font-weight: 600; }
.mobile-logout:hover { background: rgba(255, 107, 107, 0.1) !important; border-left: 3px solid #ff6b6b !important; }

/* --- MOBILE LAYOUT RULES --- */
@media (max-width: 950px) {
  .hamburger { display: block; order: 1; }
  .brand { order: 0; }
  
  /* The Menu Drawer */
  .nav-links {
    display: none; flex-direction: column; width: 65%; max-width: 320px; height: 100vh; 
    position: fixed; top: 0; right: 0; background: var(--bg-main); padding: 80px 0 20px 0; 
    box-shadow: -10px 0 30px rgba(0,0,0,0.5); z-index: 997; transform: translateX(100%); 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); gap: 0; justify-content: flex-start; 
    margin: 0; border-left: 1px solid var(--border-color); overflow-y: auto;
  }
  .nav-links.show { display: flex; transform: translateX(0); }
  
  /* Menu Links */
  .nav-link { 
    padding: 15px 25px; border-radius: 0; background: transparent !important; 
    transition: all 0.3s ease; border-left: 4px solid transparent; width: 100%; 
    display: block; box-sizing: border-box; font-size: 1.1rem;
  }
  .nav-link:hover { color: #a07fff; border-left: 4px solid #a07fff; background: var(--stat-box-bg) !important; }
  .nav-right { display: none; }
  
  /* Mobile Dropdown Fixes */
  .nav-dropdown { flex-direction: column; align-items: flex-start; width: 100%; }
  .dropdown-trigger { width: 100%; padding: 15px 25px; box-sizing: border-box; justify-content: space-between; }
  .dropdown-menu { position: relative; top: 0; width: 100%; box-shadow: none; background: rgba(0,0,0,0.03); border: none; border-radius: 0; padding: 0; display: none; }
  [data-theme="dark"] .dropdown-menu { background: rgba(0,0,0,0.2); }
  .nav-dropdown.active .dropdown-menu { display: flex; }
  .nav-dropdown.active .arrow-icon { transform: rotate(180deg); }
  .dropdown-item { padding: 12px 25px 12px 45px; font-size: 1rem; }
}

@media (max-width: 768px) {
  .chat-panel { max-width: 100%; border-left: none; }
  .hero h2 { font-size: 3rem; }
}