/* Light theme for the dashboard. The pages are dark by default (Tailwind utility classes with dark colors);
   when <html data-theme="light"> is set, these rules remap those utilities. Loaded after every other stylesheet. */
:root[data-theme="light"] {
  color-scheme: light;
  --surface-bg: rgba(255, 255, 255, 0.82);
  --border-color: rgba(106, 33, 181, 0.18);
  --text-primary: #14142b;
  --text-secondary: #4b5278;
  --text-dim: #6a7194;
  --shadow-glow: 0 0 20px rgba(106, 33, 181, 0.15);
}
:root[data-theme="light"] body,
:root[data-theme="light"] body.min-h-screen {
  background: linear-gradient(135deg, #f5f4ff 0%, #ebe9fb 100%);
  color: #14142b;
}
:root[data-theme="light"] .glass {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(106, 33, 181, 0.18);
}

/* text */
:root[data-theme="light"] .text-gray-100 { color: #14142b; }
:root[data-theme="light"] .text-gray-200 { color: #1d1d3a; }
:root[data-theme="light"] .text-gray-300 { color: #2a2a52; }
:root[data-theme="light"] .text-gray-400 { color: #4b5278; }
:root[data-theme="light"] .text-gray-500,
:root[data-theme="light"] .text-gray-600 { color: #6a7194; }
:root[data-theme="light"] .text-purple-300,
:root[data-theme="light"] .text-purple-400 { color: #6a21b5; }
:root[data-theme="light"] .text-pink-400 { color: #2563eb; }
:root[data-theme="light"] .hover\:text-gray-300:hover { color: #14142b; }
:root[data-theme="light"] .hover\:text-purple-400:hover,
:root[data-theme="light"] .hover\:text-purple-300:hover { color: #8a2be2; }

/* surfaces */
:root[data-theme="light"] .bg-gray-900 { background-color: #ebe9fb; }
:root[data-theme="light"] .bg-gray-800 { background-color: #ffffff; }
:root[data-theme="light"] .bg-gray-700 { background-color: #e4e1f7; }
:root[data-theme="light"] .bg-gray-600 { background-color: #d6d2f0; }
:root[data-theme="light"] .bg-gray-500 { background-color: #c5c0e6; }
:root[data-theme="light"] .bg-gray-900\/30,
:root[data-theme="light"] .bg-gray-900\/40,
:root[data-theme="light"] .bg-gray-900\/50,
:root[data-theme="light"] .bg-gray-900\/60,
:root[data-theme="light"] .bg-gray-900\/70 { background-color: rgba(235, 233, 251, 0.85); }
:root[data-theme="light"] .bg-gray-800\/40,
:root[data-theme="light"] .bg-gray-800\/50,
:root[data-theme="light"] .bg-gray-800\/60 { background-color: rgba(255, 255, 255, 0.8); }
:root[data-theme="light"] .bg-gray-700\/50,
:root[data-theme="light"] .bg-gray-700\/70 { background-color: rgba(228, 225, 247, 0.85); }
:root[data-theme="light"] .hover\:bg-gray-700:hover,
:root[data-theme="light"] .hover\:bg-gray-700\/50:hover { background-color: #e4e1f7; }
:root[data-theme="light"] .hover\:bg-gray-600:hover { background-color: #d6d2f0; }
:root[data-theme="light"] .hover\:bg-gray-500:hover { background-color: #c5c0e6; }
:root[data-theme="light"] .bg-black\/50,
:root[data-theme="light"] .bg-black\/60,
:root[data-theme="light"] .bg-black\/80 { background-color: rgba(20, 20, 43, 0.45); }

/* borders */
:root[data-theme="light"] .border-gray-600,
:root[data-theme="light"] .border-gray-700,
:root[data-theme="light"] .border-gray-800 { border-color: rgba(106, 33, 181, 0.22); }

/* fields */
:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea {
  color: #14142b;
}
:root[data-theme="light"] .placeholder-gray-500::placeholder,
:root[data-theme="light"] input::placeholder,
:root[data-theme="light"] textarea::placeholder { color: #6a7194; }

/* the switches added to the navbar and to the sign-in pages */
.nx-prefs { display: inline-flex; gap: .4rem; align-items: center; }
.nx-pref-btn {
  min-width: 44px; min-height: 36px; padding: 0 .6rem;
  border-radius: .5rem; font-size: .8rem; font-weight: 700; letter-spacing: .04em;
  color: inherit; background: transparent; border: 1px solid rgba(169, 139, 255, 0.35);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.nx-pref-btn:hover { background: rgba(169, 139, 255, 0.15); }

/* ---- top navigation (all pages that use the navbar macro) ---- */
.nx-nav { background: rgba(20, 20, 43, 0.94); }
.nx-nav-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.nx-nav-title { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1 1 12rem; }
.nx-nav-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-wrap: nowrap; }
.nx-nav-back, .nx-nav-logout {
  display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 .75rem;
  border-radius: .5rem; font-size: .875rem; text-decoration: none; white-space: nowrap; color: #fff;
}
.nx-nav-back { background: rgba(75, 85, 99, 1); }
.nx-nav-back:hover { background: rgba(107, 114, 128, 1); }
.nx-nav-logout { background: #dc2626; }
.nx-nav-logout:hover { background: #b91c1c; }
@media (max-width: 520px) {
  .nx-nav-row { gap: .5rem; }
  .nx-nav-title { flex-basis: 100%; order: 2; }
  .nx-nav-back { order: 1; }
  .nx-nav-actions { order: 1; }
}
.nx-prefs-fixed { position: absolute; top: 12px; right: 12px; z-index: 50; }

/* ---- light theme: surfaces the stylesheets paint with fixed dark colors ---- */
:root[data-theme="light"] .nx-nav { background: rgba(255, 255, 255, 0.97); }
:root[data-theme="light"] .nx-nav-back { background: #e4e1f7; color: #14142b; }
:root[data-theme="light"] .nx-nav-back:hover { background: #d6d2f0; }
:root[data-theme="light"] .streamer-card,
:root[data-theme="light"] .response-item,
:root[data-theme="light"] .faq-item,
:root[data-theme="light"] .command-card,
:root[data-theme="light"] .oauth-status-box,
:root[data-theme="light"] .voice-commands-list { background: #ffffff; }
:root[data-theme="light"] .streamer-card:hover,
:root[data-theme="light"] .response-item:hover,
:root[data-theme="light"] .faq-item:hover,
:root[data-theme="light"] .command-card:hover,
:root[data-theme="light"] .tab-button:hover { background: #ebe9fb; }
:root[data-theme="light"] #chat-messages,
:root[data-theme="light"] #log-messages,
:root[data-theme="light"] #responses-list { background: #f3f1ff; border: 1px solid rgba(106, 33, 181, 0.15); }
:root[data-theme="light"] .chat-input-group select,
:root[data-theme="light"] .chat-input-group input,
:root[data-theme="light"] .auto-response-form input,
:root[data-theme="light"] .integration-form input,
:root[data-theme="light"] .integration-form select,
:root[data-theme="light"] .form-group input,
:root[data-theme="light"] .oauth-form-input { background: #ffffff; color: #14142b; border: 1px solid rgba(106, 33, 181, 0.25); }
:root[data-theme="light"] .faq-answer code,
:root[data-theme="light"] .troubleshooting-item code,
:root[data-theme="light"] .info-item code,
:root[data-theme="light"] .login-info code,
:root[data-theme="light"] .oauth-redirect-uri { background: #ebe9fb; color: #14142b; }
:root[data-theme="light"] .integration-btn.test,
:root[data-theme="light"] .oauth-copy-btn,
:root[data-theme="light"] .oauth-error-btn.secondary { background: #e4e1f7; color: #14142b; }
:root[data-theme="light"] .login-divider span { background: #ffffff; }
:root[data-theme="light"] .troubleshooting-item h3.error,
:root[data-theme="light"] .oauth-error-title,
:root[data-theme="light"] .oauth-error-message p,
:root[data-theme="light"] .login-error p { color: #b91c1c; }
:root[data-theme="light"] .troubleshooting-item h3.warning,
:root[data-theme="light"] .oauth-redirect-title,
:root[data-theme="light"] .oauth-redirect-note { color: #92400e; }
:root[data-theme="light"] .troubleshooting-item h3.info,
:root[data-theme="light"] .oauth-links-title { color: #1d4ed8; }

/* accent text written for dark backgrounds: darker shades on light */
:root[data-theme="light"] .text-green-300, :root[data-theme="light"] .text-green-400 { color: #15803d; }
:root[data-theme="light"] .text-red-300, :root[data-theme="light"] .text-red-400 { color: #b91c1c; }
:root[data-theme="light"] .text-yellow-300, :root[data-theme="light"] .text-yellow-400,
:root[data-theme="light"] .text-amber-300, :root[data-theme="light"] .text-amber-400 { color: #92400e; }
:root[data-theme="light"] .text-sky-300, :root[data-theme="light"] .text-sky-400,
:root[data-theme="light"] .text-blue-300, :root[data-theme="light"] .text-blue-400 { color: #1d4ed8; }
:root[data-theme="light"] .text-violet-300, :root[data-theme="light"] .text-violet-400 { color: #6d28d9; }
:root[data-theme="light"] .hover\:text-red-200:hover { color: #7f1d1d; }
:root[data-theme="light"] .text-green-200 { color: #14532d; }
/* tinted boxes: keep the tint but light, so the dark text on top stays readable */
:root[data-theme="light"] .bg-red-900\/40, :root[data-theme="light"] .bg-red-900\/50, :root[data-theme="light"] .bg-red-900\/60,
:root[data-theme="light"] .bg-red-500\/10 { background-color: rgba(220, 38, 38, 0.10); }
:root[data-theme="light"] .bg-green-900\/30, :root[data-theme="light"] .bg-green-900\/50 { background-color: rgba(22, 163, 74, 0.12); }
:root[data-theme="light"] .bg-amber-900\/20, :root[data-theme="light"] .bg-amber-600\/20,
:root[data-theme="light"] .bg-amber-600\/30, :root[data-theme="light"] .bg-yellow-600\/20 { background-color: rgba(217, 119, 6, 0.14); }
:root[data-theme="light"] .bg-purple-900\/20, :root[data-theme="light"] .bg-purple-900\/30,
:root[data-theme="light"] .bg-sky-600\/30 { background-color: rgba(106, 33, 181, 0.10); }
:root[data-theme="light"] .bg-green-700 { background-color: #16a34a; }
:root[data-theme="light"] .bg-gray-900\/30, :root[data-theme="light"] .bg-gray-900\/40,
:root[data-theme="light"] .bg-gray-900\/50, :root[data-theme="light"] .bg-gray-900\/60,
:root[data-theme="light"] .bg-gray-900\/70 { background-color: #f3f1ff; }


/* ---- layout fixes: headers that squeezed their text on small screens ---- */
.integration-card > div:first-child { flex-wrap: wrap; gap: .75rem; }
.integration-card label span { white-space: nowrap; }
.integration-card [id^="status-"] { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; color: #fff; }
.nx-nav-actions button, .nx-nav-actions a { white-space: nowrap; }
.nx-nav-actions { flex-wrap: wrap; justify-content: flex-end; }
/* the /stream bar stays on one line: title, status dot, voice, menu (language and theme live in the menu) */
.nx-nav-actions--bar { flex-wrap: nowrap; }
.nx-nav-row:has(.nx-nav-actions--bar) { flex-wrap: nowrap; }
.nx-nav-row:has(.nx-nav-actions--bar) .nx-nav-title { flex: 1 1 0; min-width: 0; }

/* ---- light theme: solid colored buttons keep white text (they relied on the dark page's light text) ---- */
:root[data-theme="light"] :is(button, a):is([class*="bg-violet-"], [class*="bg-purple-"], [class*="bg-red-"], [class*="bg-green-"], [class*="bg-sky-"], [class*="bg-blue-"], [class*="bg-orange-"], [class*="bg-yellow-"], [class*="bg-amber-"], [class*="bg-indigo-"], [class*="bg-emerald-"], [class*="bg-teal-"]) { color: #fff; }
/* ...except tinted (opacity) ones, which stay light and keep dark text */
:root[data-theme="light"] :is(button, a):is([class*="bg-violet-"], [class*="bg-purple-"], [class*="bg-red-"], [class*="bg-green-"], [class*="bg-sky-"], [class*="bg-blue-"], [class*="bg-orange-"], [class*="bg-yellow-"], [class*="bg-amber-"]):is([class*="/10"], [class*="/20"], [class*="/30"], [class*="/40"], [class*="/50"], [class*="/60"]) { color: inherit; }
:root[data-theme="light"] .integration-card [id^="status-"] { color: #fff; }
