/* ==========================================================================
   DESDE LA CABINA - DESIGN SYSTEM & VISUAL STYLE
   Theme: Luxury Matte White & Emerald Tab (Volvo/Modern Web Aesthetic)
   Inspired by the clean, rounded white card layout with top tabs
   ========================================================================== */

/* --- Design Tokens & Variables --- */
:root {
  /* Premium Light/Monochrome Web Palette */
  --status-green: #10b981;
  /* Solid emerald green tab */
  --status-green-soft: rgba(16, 185, 129, 0.1);
  --status-red: #ef4444;
  /* Solid flat red */

  /* Map JS variables to flat white and emerald green */
  --primary-cyan: #10b981;
  --primary-cyan-soft: rgba(16, 185, 129, 0.08);
  --accent-coral: #64748b;
  /* Flat slate gray for secondary */

  --border-cyan: rgba(16, 185, 129, 0.2);
  --border-coral: rgba(100, 116, 139, 0.2);

  /* Opaque frosted white background (No dark/black grids) */
  --bg-dark-charcoal: rgba(255, 255, 255, 0.94);
  --bg-dark-solid: #f8fafc;
  --bg-panel-hover: rgba(255, 255, 255, 0.98);
  --border-white-soft: rgba(0, 0, 0, 0.08);

  /* Typography (Outfit - Clean Sans) */
  --font-display: 'Outfit', sans-serif;
  --font-digital: 'Outfit', sans-serif;

  --text-main: #0f172a;
  /* Deep charcoal/slate for maximum contrast */
  --text-muted: #64748b;
  /* Slate gray */
  --text-dimmed: #94a3b8;
  /* Muted gray */

  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-fast: all 0.15s ease-out;
}

/* --- Base Layout --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-display);
  background-color: transparent;
  /* Mandatory for OBS Browser Source overlay transparency */
  color: var(--text-main);
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Canvas wrapper constraint for 1080p exact rendering */
.overlay-canvas {
  width: 1920px;
  height: 1080px;
  position: relative;
  overflow: hidden;
  pointer-events: none;
}

/* --- Premium Panel Style (frosted white glass card) --- */
.widget-panel {
  position: absolute;
  background: var(--bg-dark-charcoal);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-white-soft);
  border-radius: 20px;
  /* Soft round corners */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  /* Extremely light diffused shadow */
  transition: var(--transition-smooth);
  pointer-events: auto;
  opacity: 1;
  overflow: visible;
  /* Required so the top tab can stick out */
}

/* Decorative Top Left Tab (matches user's reference exactly) */
.widget-panel::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 24px;
  width: 70px;
  height: 10px;
  background: var(--status-green);
  border-radius: 5px 5px 0 0;
  z-index: 10;
}

.widget-panel:hover {
  background: var(--bg-panel-hover);
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.06);
}

.panel-inner {
  padding: 20px 24px;
  height: 100%;
}

/* Hidden before JS initialization to avoid layout shifts or raw tags */
.hidden-before-load {
  opacity: 0;
  transform: translateY(15px);
}

.widget-panel.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* --- Position Layout --- */
.widget-top-left {
  top: 40px;
  left: 40px;
  width: 380px;
}

.widget-top-right {
  top: 40px;
  right: 40px;
  width: 420px;
}

.widget-bottom-left {
  bottom: 40px;
  left: 40px;
  width: 500px;
}

/* --- 1. Top Left Widget: Title & Brand --- */
.header-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-green);
}

.pulsing-amber {
  background-color: var(--status-green);
  animation: pulse-opacity 2s infinite ease-in-out;
}

@keyframes pulse-opacity {

  0%,
  100% {
    opacity: 0.35;
  }

  50% {
    opacity: 1;
  }
}

.brand-sub {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--text-muted);
}

.brand-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.brand-status {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.route-tag {
  background: var(--status-green-soft);
  color: #059669;
  /* Slightly darker green for legibility on white bg */
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.truck-icon-indicator {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* --- 2. Top Right Widget: Time & Weather --- */
.clock-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.clock-time-wrapper {
  display: flex;
  align-items: baseline;
}

#time-display {
  font-family: var(--font-digital);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.03em;
  line-height: 1;
}

#time-seconds {
  font-family: var(--font-digital);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--status-green);
  margin-left: 4px;
}

.clock-date-weather {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 4px;
}

.date-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.weather-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

#weather-temp {
  font-family: var(--font-digital);
  font-size: 1.15rem;
  font-weight: 700;
  color: #059669;
}

.weather-divider {
  color: var(--text-dimmed);
}

.city-text {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- 3. Bottom Left Widget: GPS Route --- */
.gps-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gps-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.gps-title-icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
}

.gps-road-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.gps-stats {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 8px 12px;
}

.gps-stats .stat-value {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.gps-stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon {
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
}

.stat-value.digital-text-small {
  font-family: var(--font-digital);
  font-size: 1.05rem;
  font-weight: 700;
  color: #059669;
}

.text-muted {
  color: var(--text-muted);
}

/* Digital Route Progress Bar */
.gps-progress-bar-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.gps-progress-track {
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  border: 1px solid #e2e8f0;
}

.gps-progress-fill {
  height: 100%;
  background: var(--status-green);
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.gps-progress-markers {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-dimmed);
  letter-spacing: 0.08em;
}

.marker-current-label {
  color: #059669;
  opacity: 0.8;
}

/* --- 2D Circular Game Minimap HUD & Two-Column GPS Layout --- */
.gps-body-wrapper {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 4px;
}

.gps-info-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gps-map-side {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
}

.gps-minimap-container {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  border: 3px solid var(--border-white-soft);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.04);
  background: #f8fafc;
  transition: var(--transition-smooth);
}

.gps-map-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: transparent;
}

/* Custom Video Game Player Navigation Arrow */
.navigation-arrow-wrapper {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.navigation-arrow {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 20px solid var(--status-green);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 6px var(--status-green));
  transform-origin: 50% 65%;
  transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.navigation-arrow-wrapper::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--status-green);
  opacity: 0.4;
  animation: arrow-pulse 2s infinite ease-in-out;
  z-index: -1;
}

@keyframes arrow-pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }

  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* Clean up Leaflet default UI elements for integration */
.leaflet-pane {
  z-index: 1 !important;
}

.leaflet-top,
.leaflet-bottom {
  z-index: 2 !important;
  display: none !important;
  /* Fully hide zoom controls and attributions for neat HUD design */
}

/* --- 4. Bottom Right Widget: Twitch Chat --- */
.widget-bottom-right {
  bottom: 40px;
  right: 40px;
  width: 380px;
  height: 440px;
}

.twitch-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 10px;
}

.twitch-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.twitch-title-icon {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
}

.twitch-channel-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  flex: 1;
}

.twitch-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-dimmed);
  flex-shrink: 0;
  transition: background-color 0.3s ease;
}

.twitch-status-dot.active {
  background-color: var(--status-green);
  animation: pulse-opacity 2s infinite ease-in-out;
}

.twitch-chat-container {
  flex: 1;
  min-height: 0;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.twitch-messages {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Custom scrollbar for chat */
.twitch-messages::-webkit-scrollbar {
  width: 4px;
}

.twitch-messages::-webkit-scrollbar-track {
  background: transparent;
}

.twitch-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

/* Individual chat message */
.twitch-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  animation: msg-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

@keyframes msg-slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.twitch-msg-user {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}

.twitch-msg-text {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-main);
  word-break: break-word;
  line-height: 1.4;
}

/* System messages (connect/disconnect notifications) */
.twitch-msg-system {
  justify-content: center;
  background: transparent;
  padding: 8px 10px;
}

.twitch-msg-system .twitch-msg-text {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--text-dimmed);
  text-align: center;
}

.twitch-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  text-align: center;
  padding: 20px;
}

.twitch-placeholder .placeholder-icon {
  font-size: 2.5rem;
  opacity: 0.4;
}

.twitch-placeholder .placeholder-text {
  font-size: 0.85rem;
  color: var(--text-dimmed);
  font-weight: 500;
  line-height: 1.5;
  max-width: 200px;
}

/* --- Settings Toggle Button --- */
.settings-toggle-btn {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  /* Positioned off-screen, reveals on hover or click */
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 20px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
  pointer-events: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.settings-toggle-btn:hover {
  color: #059669;
  border-color: #cbd5e1;
  background: #f8fafc;
  transform: translateX(-50%) translateY(0);
}

/* Show toggle button easily on mouse-enter near bottom of screen */
body:hover .settings-toggle-btn,
.settings-toggle-btn.active {
  transform: translateX(-50%) translateY(0);
}

.gear-icon {
  transition: transform 0.8s ease;
}

.settings-toggle-btn:hover .gear-icon {
  transform: rotate(90deg);
}

/* --- Interactive Control Dashboard (Settings Panel) --- */
.settings-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 580px;
  max-height: 85%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
}

.settings-panel.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.settings-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.settings-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.settings-close-btn:hover {
  color: var(--status-red);
}

.settings-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 480px;
}

/* Custom Scrollbar for Settings Panel */
.settings-body::-webkit-scrollbar {
  width: 6px;
}

.settings-body::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: 3px;
}

.settings-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.settings-body::-webkit-scrollbar-thumb:hover {
  background: var(--status-green);
}

.settings-section {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 20px;
}

.settings-section:last-child {
  border: none;
  padding-bottom: 0;
}

.settings-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
  margin-bottom: 12px;
}

.section-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -6px;
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="password"],
select.form-select {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 0.9rem;
  border-radius: 8px;
  transition: var(--transition-fast);
  font-family: inherit;
  width: 100%;
}

select.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%2364748b' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
  padding-right: 30px;
  cursor: pointer;
}

select.form-select option {
  background: #ffffff;
  color: var(--text-main);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select.form-select:focus {
  outline: none;
  border-color: var(--status-green);
  background: #ffffff;
}

/* Badges for Live GPS State */
.gps-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-digital);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.gps-badge.badge-inactive {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.gps-badge.badge-active {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.gps-badge.badge-loading {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  animation: pulse-badge 1s infinite alternate;
}

.gps-badge.badge-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.gps-copy-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}

.copy-url-status {
  min-height: 18px;
  color: var(--status-green);
  font-size: 0.78rem;
  font-weight: 700;
}

@keyframes pulse-badge {
  0% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

.hidden {
  display: none !important;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--status-green);
  cursor: pointer;
}

.checkbox-group label {
  cursor: pointer;
  user-select: none;
}

.settings-footer {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
}

/* Button Classes */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}

.btn-primary {
  background: var(--status-green);
  color: #ffffff;
}

.btn-primary:hover {
  background: #059669;
}

.btn-secondary {
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-danger {
  background: var(--status-red);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
}

/* --- Loader System --- */
.overlay-loader {
  position: absolute;
  inset: 0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease-in-out;
}

.loader-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #f1f5f9;
  border-radius: 50%;
  border-top-color: var(--status-green);
  animation: spin 1s infinite linear;
  margin-bottom: 24px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.loader-text {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.loader-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   NIGHT MODE THEME (Cyber Night Matte Dark)
   ========================================================================== */
body.night-mode {
  --bg-dark-charcoal: rgba(15, 23, 42, 0.88);
  /* Translucent dark slate */
  --bg-dark-solid: #0f172a;
  --bg-panel-hover: rgba(15, 23, 42, 0.92);
  --border-white-soft: rgba(255, 255, 255, 0.08);
  --text-main: #f8fafc;
  /* Off-white text */
  --text-muted: #94a3b8;
  /* Cool light gray */
  --text-dimmed: #64748b;
  /* Slate gray */
  --border-cyan: rgba(52, 211, 153, 0.35);
  --status-green: #34d399;
  /* Vivid neon emerald */
  --status-green-soft: rgba(52, 211, 153, 0.1);
  --primary-cyan: #34d399;
  --primary-cyan-soft: rgba(52, 211, 153, 0.08);
}

/* Night Mode inputs compatibility */
body.night-mode input[type="text"],
body.night-mode input[type="number"],
body.night-mode input[type="password"],
body.night-mode select.form-select {
  background: #1e293b;
  border-color: #475569;
  color: #f8fafc;
}

body.night-mode .settings-panel {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

body.night-mode .settings-header,
body.night-mode .settings-footer {
  border-color: rgba(255, 255, 255, 0.1);
}

body.night-mode .settings-section {
  border-color: rgba(255, 255, 255, 0.08);
}

body.night-mode .brand-indicator .brand-sub {
  color: var(--primary-cyan);
}

/* Night Mode: Twitch Chat Widget */
body.night-mode .twitch-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.night-mode .twitch-header .twitch-channel-name {
  color: var(--text-muted);
}

body.night-mode .twitch-status-dot.active {
  background: var(--status-green);
  box-shadow: 0 0 8px var(--status-green);
}

body.night-mode .twitch-chat-container {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.08);
}

body.night-mode .twitch-msg {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

body.night-mode .twitch-msg-system {
  background: transparent;
  border: none;
}

body.night-mode .twitch-messages::-webkit-scrollbar-thumb {
  background: #334155;
}

body.night-mode .twitch-placeholder .placeholder-text {
  color: #94a3b8;
}

body.night-mode .stat-value.digital-text-small {
  color: var(--status-green);
}

body.night-mode .gps-progress-fill {
  background: var(--status-green);
}

body.night-mode .settings-toggle-btn {
  background: rgba(30, 41, 59, 0.9);
  border-color: #475569;
  color: #94a3b8;
}

/* Night Mode Minimapa Game Overrides */
body.night-mode .gps-minimap-container {
  border-color: var(--status-green);
  box-shadow: 0 0 15px rgba(52, 211, 153, 0.25), inset 0 2px 10px rgba(0, 0, 0, 0.5);
  background: #0f172a;
}

body.night-mode .gps-map-canvas {
  /* High contrast neon cyan-green retro HUD map styling filter */
  filter: saturate(1.25) contrast(1.15) brightness(0.85);
}

/* ==========================================================================
   TWITCH CHAT COMMAND ALERTS & HIGHLIGHTS
   ========================================================================== */
.command-alert {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--bg-dark-charcoal);
  border: 1px solid var(--border-cyan);
  border-top: 4px solid var(--status-green);
  border-radius: 12px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(16px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.command-alert.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.command-alert .alert-icon {
  font-size: 1.25rem;
}

.command-alert .alert-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* Pulse animation for widgets when command is triggered */
@keyframes widget-highlight-pulse {
  0% {
    box-shadow: 0 0 0 0px rgba(16, 185, 129, 0.7);
    border-color: var(--status-green);
  }

  50% {
    box-shadow: 0 0 0 18px rgba(16, 185, 129, 0);
    border-color: var(--status-green);
  }

  100% {
    box-shadow: 0 0 0 0px rgba(16, 185, 129, 0);
  }
}

.widget-panel.highlight-pulse {
  animation: widget-highlight-pulse 1.2s ease-in-out 2;
  z-index: 999;
}
