/* ============================================
   TRACCAR — DARK NEON THEME
   Azul Tech / Dark Mode / Cyan Accents
   v2 — Tipografía tech + Login page
   ============================================ */

/* ── Google Fonts: Orbitron (display) + Exo 2 (body) ── */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800&family=Exo+2:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Variables globales ── */
:root {
  --neon-blue: #00B4FF;
  --neon-cyan: #00FFFF;
  --neon-glow: #00B4FF44;
  --bg-deep: #070B15;
  --bg-base: #0A0E1A;
  --bg-paper: #0F1625;
  --bg-card: #111827;
  --border: #1A2A3A;
  --border-neon: #00B4FF33;
  --text-primary: #E0F4FF;
  --text-secondary: #7EC8E3;
  --text-muted: #3A5A7A;
  --success: #00FFB2;
  --error: #FF4466;
  --warning: #FFB800;
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Exo 2', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ============================================
   TIPOGRAFÍA
   ============================================ */

body, #root, * {
  font-family: var(--font-body) !important;
}

/* Títulos con Orbitron */
.MuiTypography-h1,
.MuiTypography-h2,
.MuiTypography-h3,
.MuiTypography-h4,
.MuiTypography-h5,
.MuiTypography-h6,
.MuiDialogTitle-root,
.MuiAppBar-root .MuiTypography-root {
  font-family: var(--font-display) !important;
  letter-spacing: 0.08em !important;
}

/* Monospace para datos */
.MuiTableBody-root .MuiTableCell-root,
.MuiChip-label {
  font-family: var(--font-mono) !important;
  font-size: 0.82rem !important;
}

/* Headers de tabla */
.MuiTableHead-root .MuiTableCell-root {
  font-family: var(--font-display) !important;
  font-size: 0.65rem !important;
  letter-spacing: 0.1em !important;
}

/* Botones */
.MuiButton-root {
  font-family: var(--font-body) !important;
  font-weight: 600 !important;
  letter-spacing: 0.06em !important;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

/* Grid tech de fondo */
#root::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 180, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 180, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* Scanline sutil */
#root::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 180, 255, 0.006) 2px,
    rgba(0, 180, 255, 0.006) 4px
  );
  pointer-events: none;
  z-index: 0;
}

/* Card del login — apuntamos al primer Paper centrado en pantalla */
.MuiBox-root > .MuiPaper-root:only-child,
[class*="login"] .MuiPaper-root,
[class*="Login"] .MuiPaper-root {
  background: linear-gradient(135deg, #0D1525 0%, #0A1020 100%) !important;
  border: 1px solid var(--border-neon) !important;
  box-shadow:
    0 0 40px #00B4FF18,
    0 0 80px #00B4FF08,
    inset 0 1px 0 #00B4FF22 !important;
  border-radius: 12px !important;
  position: relative !important;
  overflow: hidden !important;
}

/* Línea glow superior del card */
.MuiBox-root > .MuiPaper-root:only-child::before,
[class*="login"] .MuiPaper-root::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
}

/* Título del login */
[class*="login"] .MuiTypography-root,
[class*="Login"] .MuiTypography-root {
  font-family: var(--font-display) !important;
  letter-spacing: 0.12em !important;
  color: var(--neon-blue) !important;
  text-shadow: 0 0 20px #00B4FF66 !important;
}

/* Botón login con pulse */
[class*="login"] .MuiButton-containedPrimary,
[class*="Login"] .MuiButton-containedPrimary {
  background: linear-gradient(90deg, #0080CC, var(--neon-blue)) !important;
  animation: loginPulse 3s ease-in-out infinite !important;
}

@keyframes loginPulse {
  0%, 100% { box-shadow: 0 0 16px #00B4FF44; }
  50%       { box-shadow: 0 0 30px #00B4FF99; }
}

/* ============================================
   BASE Y LAYOUT
   ============================================ */

body, #root {
  background-color: var(--bg-deep) !important;
  color: var(--text-primary) !important;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--neon-blue) var(--bg-base);
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb {
  background: var(--neon-blue);
  border-radius: 3px;
  box-shadow: 0 0 6px var(--neon-blue);
}

/* AppBar */
header, .MuiAppBar-root {
  background-color: #080C18 !important;
  border-bottom: 1px solid var(--border-neon) !important;
  box-shadow: 0 0 24px var(--neon-glow) !important;
}

/* Drawer */
.MuiDrawer-root .MuiPaper-root,
.MuiDrawer-paper {
  background-color: var(--bg-base) !important;
  border-right: 1px solid var(--border-neon) !important;
  box-shadow: 4px 0 20px #00B4FF11 !important;
}

/* Papers */
.MuiPaper-root {
  background-color: var(--bg-paper) !important;
  background-image: none !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
}

/* Texto */
.MuiTypography-root,
.MuiListItemText-primary { color: var(--text-primary) !important; }
.MuiTypography-colorTextSecondary,
.MuiListItemText-secondary { color: var(--text-secondary) !important; }

/* List Items */
.MuiListItemButton-root:hover {
  background-color: #00B4FF15 !important;
  border-left: 2px solid var(--neon-blue);
}
.MuiListItemButton-root.Mui-selected {
  background-color: #00B4FF20 !important;
  border-left: 2px solid var(--neon-cyan);
}
.MuiListItemButton-root.Mui-selected .MuiListItemText-primary {
  color: var(--neon-cyan) !important;
}

/* Iconos */
.MuiSvgIcon-root { color: var(--text-secondary) !important; }
.MuiListItemButton-root.Mui-selected .MuiSvgIcon-root,
.MuiListItemButton-root:hover .MuiSvgIcon-root { color: var(--neon-blue) !important; }

/* Botones */
.MuiButton-containedPrimary {
  background-color: var(--neon-blue) !important;
  color: #000 !important;
  font-weight: 700 !important;
  box-shadow: 0 0 14px var(--neon-glow) !important;
}
.MuiButton-containedPrimary:hover {
  background-color: var(--neon-cyan) !important;
  box-shadow: 0 0 24px #00FFFF66 !important;
}
.MuiButton-outlinedPrimary {
  border-color: var(--neon-blue) !important;
  color: var(--neon-blue) !important;
}
.MuiButton-outlinedPrimary:hover { background-color: #00B4FF15 !important; }
.MuiButton-textPrimary { color: var(--neon-blue) !important; }
.MuiIconButton-root:hover {
  background-color: #00B4FF15 !important;
  color: var(--neon-blue) !important;
}

/* Inputs */
.MuiOutlinedInput-root { background-color: #0D1520 !important; color: var(--text-primary) !important; }
.MuiOutlinedInput-notchedOutline { border-color: var(--border) !important; }
.MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline { border-color: var(--neon-blue) !important; }
.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline {
  border-color: var(--neon-blue) !important;
  box-shadow: 0 0 8px var(--neon-glow) !important;
}
.MuiInputLabel-root { color: var(--text-secondary) !important; }
.MuiInputLabel-root.Mui-focused { color: var(--neon-blue) !important; }
.MuiInputBase-input { color: var(--text-primary) !important; }

/* Select */
.MuiSelect-icon { color: var(--neon-blue) !important; }
.MuiMenu-paper {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-neon) !important;
  box-shadow: 0 0 20px #00B4FF22 !important;
}
.MuiMenuItem-root:hover { background-color: #00B4FF15 !important; }
.MuiMenuItem-root.Mui-selected { background-color: #00B4FF25 !important; color: var(--neon-cyan) !important; }

/* Tablas */
.MuiTableContainer-root { background-color: var(--bg-base) !important; }
.MuiTableHead-root .MuiTableCell-root {
  background-color: #0D1520 !important;
  color: var(--neon-blue) !important;
  font-weight: 700 !important;
  border-bottom: 1px solid var(--border-neon) !important;
}
.MuiTableBody-root .MuiTableCell-root {
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border) !important;
}
.MuiTableRow-root:hover { background-color: #00B4FF0D !important; }
.MuiTableRow-root.Mui-selected { background-color: #00B4FF18 !important; }

/* Tabs */
.MuiTab-root { color: var(--text-secondary) !important; letter-spacing: 0.04em !important; }
.MuiTab-root.Mui-selected { color: var(--neon-blue) !important; }
.MuiTabs-indicator {
  background-color: var(--neon-blue) !important;
  box-shadow: 0 0 8px var(--neon-blue) !important;
}

/* Chips */
.MuiChip-root {
  background-color: #0D1520 !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
}
.MuiChip-colorPrimary {
  background-color: #00B4FF20 !important;
  border-color: var(--neon-blue) !important;
  color: var(--neon-blue) !important;
}

/* Switches */
.MuiSwitch-colorPrimary.Mui-checked + .MuiSwitch-track {
  background-color: var(--neon-blue) !important;
  box-shadow: 0 0 8px var(--neon-glow) !important;
}
.MuiSwitch-colorPrimary.Mui-checked .MuiSwitch-thumb { background-color: var(--neon-cyan) !important; }

/* Checkboxes */
.MuiCheckbox-colorPrimary.Mui-checked,
.MuiRadio-colorPrimary.Mui-checked { color: var(--neon-blue) !important; }

/* Dividers */
.MuiDivider-root { border-color: var(--border) !important; }

/* Dialogs */
.MuiDialog-paper {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-neon) !important;
  box-shadow: 0 0 40px #00B4FF22 !important;
}
.MuiDialogTitle-root {
  color: var(--neon-blue) !important;
  border-bottom: 1px solid var(--border) !important;
}
.MuiBackdrop-root {
  background-color: rgba(4, 8, 20, 0.85) !important;
  backdrop-filter: blur(4px) !important;
}

/* Tooltips */
.MuiTooltip-tooltip {
  background-color: #0D1520 !important;
  border: 1px solid var(--border-neon) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.72rem !important;
  box-shadow: 0 0 10px var(--neon-glow) !important;
}

/* Alerts */
.MuiAlert-standardSuccess {
  background-color: #00FFB215 !important;
  border: 1px solid #00FFB244 !important;
  color: var(--success) !important;
}
.MuiAlert-standardError {
  background-color: #FF446615 !important;
  border: 1px solid #FF446644 !important;
  color: var(--error) !important;
}

/* Progress */
.MuiLinearProgress-root { background-color: var(--border) !important; }
.MuiLinearProgress-bar {
  background-color: var(--neon-blue) !important;
  box-shadow: 0 0 8px var(--neon-blue) !important;
}
.MuiCircularProgress-circle { stroke: var(--neon-blue) !important; }

/* ============================================
   MAPA (Leaflet)
   ============================================ */

.leaflet-tile-pane {
  filter: brightness(0.9) hue-rotate(180deg) invert(1) contrast(0.85) saturate(0.6) !important;
}

.leaflet-control-zoom a {
  background-color: var(--bg-card) !important;
  color: var(--neon-blue) !important;
  border-color: var(--border-neon) !important;
  font-family: var(--font-display) !important;
}
.leaflet-control-zoom a:hover { background-color: #00B4FF20 !important; }
.leaflet-bar {
  border: 1px solid var(--border-neon) !important;
  box-shadow: 0 0 12px var(--neon-glow) !important;
}

.leaflet-popup-content-wrapper {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border-neon) !important;
  color: var(--text-primary) !important;
  box-shadow: 0 0 20px var(--neon-glow) !important;
  font-family: var(--font-body) !important;
}
.leaflet-popup-tip { background-color: var(--bg-card) !important; }

.leaflet-control-attribution {
  background-color: rgba(7, 11, 21, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 0.65rem !important;
}
.leaflet-control-attribution a { color: var(--neon-blue) !important; }
