/* =========================
   GLOBAL THEME SYSTEM 
========================= */

:root {
  /* Common Variables */
  --neon-green: #dcfc44;
  --neon-emerald: #10b981;
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* DARK THEME (Premium Neon) */
[data-theme='dark-theme'],
:root:not([data-theme='light-theme']) {
  --bg: #030712;
  --text: #ffffff;
  --text-muted: #94a3b8;
  --card: rgba(17, 24, 39, 0.7);
  --border: rgba(255, 255, 255, 0.08);
  --input: rgba(255, 255, 255, 0.05);
  --primary: var(--neon-green);
  --primary-glow: rgba(220, 252, 68, 0.2);
  --shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.5);
  
  /* Toggle Specifics */
  --switch-bg: #1e293b;
  --switch-border: rgba(255,255,255,0.1);
  --knob-bg: #fde047; /* Moon Yellow */
  --knob-shadow: 0 0 15px rgba(253, 224, 71, 0.4);
}

/* LIGHT THEME (Premium Indigo) */
[data-theme='light-theme'] {
  --bg: #f8fafc;
  --text: #0f172a;
  --text-muted: #475569;
  --card: #ffffff;
  --border: #e2e8f0;
  --input: #f1f5f9;
  --primary: #4f46e5; /* Indigo 600 */
  --primary-glow: rgba(79, 70, 229, 0.15);
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  
  /* Toggle Specifics */
  --switch-bg: #7dd3fc; /* Sky Blue */
  --switch-border: rgba(0,0,0,0.05);
  --knob-bg: #fb923c; /* Sun Orange */
  --knob-shadow: 0 0 15px rgba(251, 146, 60, 0.4);
}

/* Base Styles */
html, body {
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* Reusable Components */
.glass-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: var(--transition);
}

.neon-button {
  background: var(--primary);
  color: white;
  font-weight: 800;
  box-shadow: 0 10px 20px -5px var(--primary-glow);
  transition: var(--transition);
}

[data-theme='dark-theme'] .neon-button, 
:root:not([data-theme='light-theme']) .neon-button {
  color: #000;
}

/* =========================
   AMAZING THEME SWITCH 
========================= */
.theme-switch-wrapper {
  position: relative;
  width: 64px;
  height: 32px;
  padding: 4px;
  background: var(--switch-bg);
  border: 1px solid var(--switch-border);
  border-radius: 20px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
}

.theme-switch-wrapper:hover {
  transform: scale(1.05);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), 0 0 15px var(--primary-glow);
}

.theme-switch-wrapper:active {
  transform: scale(0.95);
}

/* Clouds / Stars Decorators */
.theme-switch-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.theme-switch-decorators {
  position: absolute;
  inset: 0;
  transition: opacity 0.5s ease;
}

/* Light mode clouds */
[data-theme='light-theme'] .theme-switch-decorators::before {
  content: '☁️';
  position: absolute;
  font-size: 10px;
  left: 8px;
  top: 4px;
  opacity: 0.6;
  animation: float 3s ease-in-out infinite;
}

/* Dark mode stars */
[data-theme='dark-theme'] .theme-switch-decorators::after,
:root:not([data-theme='light-theme']) .theme-switch-decorators::after {
  content: '✨';
  position: absolute;
  font-size: 8px;
  right: 10px;
  top: 5px;
  opacity: 0.8;
  animation: twinkle 2s ease-in-out infinite;
}

/* The Knob */
.theme-switch-knob {
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--knob-bg);
  border-radius: 50%;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--knob-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

[data-theme='light-theme'] .theme-switch-knob {
  left: 32px;
}

[data-theme='dark-theme'] .theme-switch-knob,
:root:not([data-theme='light-theme']) .theme-switch-knob {
  left: 0;
}

/* Icon transformation */
.theme-switch-icon {
  font-size: 12px;
  transition: transform 0.5s ease;
}

[data-theme='light-theme'] .theme-switch-icon::before {
  content: '☀️';
}

[data-theme='dark-theme'] .theme-switch-icon::before,
:root:not([data-theme='light-theme']) .theme-switch-icon::before {
  content: '🌙';
  transform: rotate(-20deg);
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* Dropdown Animations */
.animate-in {
  animation: fadeInDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Dropdown Hover Bridges - Fixes shrinking on hover */
.dropdown-bridge-top::before {
  content: "";
  position: absolute;
  top: -24px; /* Covers 1rem - 1.5rem gap */
  left: 0;
  right: 0;
  height: 24px;
}

.dropdown-bridge-right::before {
  content: "";
  position: absolute;
  top: -20px;
  right: 0;
  left: -20px;
  height: calc(100% + 20px);
}

/* Utility Helpers */
.text-theme-main { color: var(--text); }
.text-theme-muted { color: var(--text-muted); }

* {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}