/* ===== THEME TOGGLE STYLES ===== */
/* Light mode variables */
[data-theme="light"] {
  --bg: #f8fafc;
  --card: #ffffff;
  --card2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --dim: #475569;
  --dim2: #475569;
  --dim3: #475569;
  /* Adjusted accent colors for light backgrounds */
  --teal: #0d9488;
  --cyan: #0891b2;
  --purple: #7c3aed;
  --amber: #d97706;
  --red: #dc2626;
  --green: #16a34a;
  --pink: #db2777;
  /* Glass morphism adjustments for light mode */
  --glass: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(20, 184, 166, 0.15);
  /* Brand colors for light mode */
  --brand: #7c3aed;
  --brand-light: #8b5cf6;
  color-scheme: light;
}

/* Dark mode (default) */
:root {
  color-scheme: dark;
}

/* Respects prefers-color-scheme */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --card: #ffffff;
    --card2: #f1f5f9;
    --border: #e2e8f0;
    --text: #0f172a;
    --dim: #475569;
    --dim2: #475569;
    --dim3: #475569;
    --teal: #0d9488;
    --cyan: #0891b2;
    --purple: #7c3aed;
    --amber: #d97706;
    --red: #dc2626;
    --green: #16a34a;
    --pink: #db2777;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(20, 184, 166, 0.15);
    --brand: #7c3aed;
    --brand-light: #8b5cf6;
    color-scheme: light;
  }
}

/* Theme toggle button styling */
.theme-toggle {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 50px;
  height: 28px;
  padding: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--teal);
  box-shadow: 0 0 12px rgba(20, 184, 166, 0.1);
}

.theme-toggle.active {
  background: rgba(20, 184, 166, 0.1);
  border-color: var(--teal);
}

.theme-toggle-slider {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--teal), var(--cyan));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  position: absolute;
  left: 2px;
  font-size: 14px;
  color: white;
}

.theme-toggle.active .theme-toggle-slider {
  transform: translateX(22px);
}

.theme-toggle-icon-sun {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.theme-toggle.active .theme-toggle-icon-sun {
  opacity: 0;
}

.theme-toggle-icon-moon {
  opacity: 0;
  transition: opacity 0.3s ease;
  position: absolute;
  left: 26px;
}

.theme-toggle.active .theme-toggle-icon-moon {
  opacity: 1;
}

/* Smooth transitions for theme changes */
html {
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Card and container transitions */
.card,
.kpi,
.alert-item,
nav,
.sidebar,
.auth-card,
.meet-card {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Input transitions */
input,
textarea,
select {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ===== LIGHT MODE ELEMENT OVERRIDES ===== */

/* Body background gradient */
[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

[data-theme="light"] body::before {
  background: radial-gradient(ellipse 80% 60% at 20% 10%, rgba(139, 92, 246, 0.05), transparent),
              radial-gradient(ellipse 60% 50% at 80% 80%, rgba(236, 72, 153, 0.03), transparent);
}

/* Auth overlay */
[data-theme="light"] .auth-overlay {
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.95), rgba(241, 245, 249, 0.95));
}

/* Navigation / Topbar */
[data-theme="light"] nav,
[data-theme="light"] header,
[data-theme="light"] .topbar,
[data-theme="light"] nav.pulso-top-nav {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] nav.pulso-top-nav a {
  color: var(--text);
}

[data-theme="light"] nav.pulso-top-nav a:hover,
[data-theme="light"] nav.pulso-top-nav a.nav-active {
  color: var(--brand);
}

/* Sidebar */
[data-theme="light"] .sidebar,
[data-theme="light"] [class*="sidebar"] {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

[data-theme="light"] .sb-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .sb-item.active {
  background: rgba(124, 58, 237, 0.06);
}

/* Cards, Panels, Boxes, Widgets, Glass elements */
[data-theme="light"] .card,
[data-theme="light"] [class*="card"],
[data-theme="light"] [class*="glass"],
[data-theme="light"] [class*="box"],
[data-theme="light"] [class*="panel"],
[data-theme="light"] [class*="widget"],
[data-theme="light"] .kpi,
[data-theme="light"] .meet-card,
[data-theme="light"] .alert-item {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: #e2e8f0 !important;
  color: var(--text) !important;
}

/* Auth card */
[data-theme="light"] .auth-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

/* Inputs, Selects, Textareas */
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea,
[data-theme="light"] .auth-input {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder,
[data-theme="light"] .auth-input::placeholder {
  color: #94a3b8 !important;
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] .auth-input:focus {
  background: #ffffff !important;
  border-color: var(--teal) !important;
}

/* Tables */
[data-theme="light"] table,
[data-theme="light"] th,
[data-theme="light"] td {
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] th {
  background: #f1f5f9 !important;
}

[data-theme="light"] tr:hover td {
  background: #f8fafc !important;
}

/* Progress bars & sticky elements */
[data-theme="light"] .progress-wrap {
  background: rgba(255, 255, 255, 0.95) !important;
}

/* Overlays & modals */
[data-theme="light"] .scanning-overlay,
[data-theme="light"] .loading-overlay {
  background: rgba(248, 250, 252, 0.95) !important;
}

/* AI Drawer (dashboard-gestor) */
[data-theme="light"] .ai-drawer {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: #e2e8f0 !important;
}

/* Tooltips */
[data-theme="light"] .trend-tooltip {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(13, 148, 136, 0.3) !important;
  color: var(--text) !important;
}

/* Topbar timestamp/date */
[data-theme="light"] .tb-timestamp,
[data-theme="light"] .tb-date {
  background: var(--card2);
  border-color: var(--border);
}

/* Alerts */
[data-theme="light"] .alert-red {
  background: rgba(220, 38, 38, 0.08);
}

[data-theme="light"] .alert-orange {
  background: rgba(249, 115, 22, 0.08);
}

[data-theme="light"] .alert-yellow {
  background: rgba(217, 119, 6, 0.06);
}

/* Buttons with dark backgrounds */
[data-theme="light"] .btn-ghost,
[data-theme="light"] button[class*="ghost"] {
  color: var(--text);
  border-color: #cbd5e1;
}

/* Select dropdown options */
[data-theme="light"] select option {
  background: #ffffff;
  color: #0f172a;
}

/* Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f1f5f9;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Badge */
[data-theme="light"] .sb-badge {
  background: rgba(220, 38, 38, 0.1);
}

/* Gradient text - ensure readability */
[data-theme="light"] .gradient-text {
  background: linear-gradient(135deg, var(--teal), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Accessibility: respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .theme-toggle-slider,
  .theme-toggle-icon-sun,
  .theme-toggle-icon-moon,
  html,
  body,
  .card,
  .kpi,
  .alert-item,
  input,
  textarea,
  select {
    transition: none !important;
  }
}
