/* ======================================================
   TRACKPRO - HIGH TECH CYBERPUNK / GLASSMORPHISM THEME
   ====================================================== */

:root {
  --neon-cyan: #00f2fe;
  --neon-blue: #4facfe;
  --dark-bg: #0b0f19;
  --dark-card: rgba(16, 24, 43, 0.75);
  --glass-border: rgba(0, 242, 254, 0.25);
  --glass-border-hover: rgba(0, 242, 254, 0.6);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --text-primary: #e6f1ff;
  --text-secondary: #8892b0;
}

body {
  background-color: var(--dark-bg) !important;
  color: var(--text-primary) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Cybernetic Animated Background for Login & System */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: 
    radial-gradient(circle at 15% 20%, rgba(0, 242, 254, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(79, 172, 254, 0.08) 0%, transparent 40%),
    linear-gradient(135deg, #070a12 0%, #0d1527 50%, #060913 100%);
  background-size: cover;
  z-index: -2;
  pointer-events: none;
}

/* Digital Grid Overlay */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: 
    linear-gradient(rgba(0, 242, 254, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 242, 254, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -1;
  pointer-events: none;
}

/* Glassmorphism Paper / Card Container */
.MuiPaper-root {
  background: var(--dark-card) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid var(--glass-border) !important;
  border-radius: 14px !important;
  box-shadow: var(--glass-shadow), 0 0 20px rgba(0, 242, 254, 0.08) !important;
}

/* Sidebar styling */
main > div:first-child {
  background: linear-gradient(180deg, rgba(10, 25, 47, 0.95) 0%, rgba(5, 15, 30, 0.95) 100%) !important;
  border-right: 1px solid var(--glass-border) !important;
}

/* Form Inputs */
.MuiOutlinedInput-root {
  background: rgba(13, 20, 36, 0.8) !important;
  border-radius: 10px !important;
  color: #fff !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.MuiOutlinedInput-notchedOutline {
  border-color: rgba(0, 242, 254, 0.25) !important;
}

.MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline {
  border-color: var(--neon-cyan) !important;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2) !important;
}

.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline {
  border-color: var(--neon-cyan) !important;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.35) !important;
}

.MuiInputLabel-root {
  color: var(--text-secondary) !important;
}

.MuiInputLabel-root.Mui-focused {
  color: var(--neon-cyan) !important;
}

/* Futuristic Neon Button */
.MuiButton-contained, .MuiButton-containedSecondary, .MuiButton-containedPrimary {
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%) !important;
  color: #050a14 !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 1.5px !important;
  border-radius: 10px !important;
  padding: 10px 24px !important;
  box-shadow: 0 4px 20px rgba(0, 242, 254, 0.4) !important;
  transition: all 0.3s ease !important;
  border: none !important;
}

.MuiButton-contained:hover {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
  box-shadow: 0 6px 25px rgba(0, 242, 254, 0.6) !important;
  transform: translateY(-2px) !important;
}

/* Links & Text */
.MuiLink-root {
  color: var(--neon-cyan) !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
}

.MuiLink-root:hover {
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.8) !important;
}

/* Custom Floating Dashboard Button */
#trackpro-dash-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: linear-gradient(135deg, #00f2fe 0%, #1e3c72 100%);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 50px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 242, 254, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

#trackpro-dash-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 30px rgba(0, 242, 254, 0.7);
}

#trackpro-dash-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(4, 8, 16, 0.85);
  backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#trackpro-dash-content {
  background: #0d1527;
  border: 1px solid rgba(0, 242, 254, 0.3);
  border-radius: 16px;
  width: 100%;
  max-width: 950px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 242, 254, 0.15);
  padding: 30px;
  color: #fff;
}

/* Dashboard Cards Grid */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 25px 0;
}

.dash-card {
  background: rgba(18, 28, 48, 0.6);
  border: 1px solid rgba(0, 242, 254, 0.15);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.dash-card:hover {
  border-color: rgba(0, 242, 254, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 242, 254, 0.15);
}

.dash-card-title {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.dash-card-value {
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
}

.card-cyan .dash-card-value { color: #00f2fe; text-shadow: 0 0 15px rgba(0, 242, 254, 0.4); }
.card-green .dash-card-value { color: #00ff88; text-shadow: 0 0 15px rgba(0, 255, 136, 0.4); }
.card-yellow .dash-card-value { color: #ffd200; text-shadow: 0 0 15px rgba(255, 210, 0, 0.4); }
.card-red .dash-card-value { color: #ff3366; text-shadow: 0 0 15px rgba(255, 51, 102, 0.4); }

/* Table inside modal */
.dash-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.dash-table th, .dash-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dash-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--neon-cyan);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.dash-table tr:hover {
  background: rgba(0, 242, 254, 0.05);
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-online { background: rgba(0, 255, 136, 0.15); color: #00ff88; border: 1px solid #00ff88; }
.badge-stopped { background: rgba(255, 210, 0, 0.15); color: #ffd200; border: 1px solid #ffd200; }
.badge-offline { background: rgba(255, 51, 102, 0.15); color: #ff3366; border: 1px solid #ff3366; }


/* Enhanced Vehicle Photo in Map Popup Card */
.MuiCardMedia-root {
  background-size: cover !important;
  background-position: center !important;
  min-height: 160px !important;
  border-radius: 12px 12px 0 0 !important;
  border-bottom: 2px solid rgba(0, 242, 254, 0.4) !important;
  box-shadow: inset 0 -40px 30px -10px rgba(10, 15, 25, 0.8) !important;
}

/* Vehicle photo preview on hover / list */
.vehicle-avatar-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(0, 242, 254, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}


/* Action Buttons Grid in Status Popup */
.trackpro-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-lock {
  background: rgba(255, 51, 102, 0.15);
  color: #ff3366;
  border-color: rgba(255, 51, 102, 0.4);
}
.btn-lock:hover {
  background: #ff3366;
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 51, 102, 0.6);
}

.btn-unlock {
  background: rgba(0, 255, 136, 0.15);
  color: #00ff88;
  border-color: rgba(0, 255, 136, 0.4);
}
.btn-unlock:hover {
  background: #00ff88;
  color: #05101a;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.6);
}

.btn-follow {
  background: rgba(0, 242, 254, 0.15);
  color: #00f2fe;
  border-color: rgba(0, 242, 254, 0.4);
}
.btn-follow:hover {
  background: #00f2fe;
  color: #05101a;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.6);
}

.btn-street {
  background: rgba(255, 210, 0, 0.15);
  color: #ffd200;
  border-color: rgba(255, 210, 0, 0.4);
}
.btn-street:hover {
  background: #ffd200;
  color: #05101a;
  box-shadow: 0 0 12px rgba(255, 210, 0, 0.6);
}


/* ======================================================
   TRACKPRO - LEFT NAVIGATION SIDEBAR (ESTILO PLATAFORMA)
   ====================================================== */

#trackpro-left-nav {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 68px;
  background: rgba(8, 14, 26, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid rgba(0, 242, 254, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  z-index: 1300;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-brand-icon {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.6));
  animation: pulseBrand 3s infinite alternate;
}

@keyframes pulseBrand {
  0% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(0, 242, 254, 0.4)); }
  100% { transform: scale(1.06); filter: drop-shadow(0 0 14px rgba(0, 242, 254, 0.9)); }
}

.nav-items-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: center;
  flex: 1;
}

.nav-btn {
  background: transparent;
  border: none;
  outline: none;
  color: #718096;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.nav-btn span {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.25s ease;
}

.nav-btn:hover {
  color: #00f2fe;
  background: rgba(0, 242, 254, 0.08);
  transform: translateY(-2px);
}

.nav-btn.active {
  color: #00f2fe;
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid rgba(0, 242, 254, 0.3);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.25);
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #00f2fe;
  box-shadow: 0 0 10px #00f2fe;
}

.nav-bottom-group {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-btn-logout:hover {
  background: rgba(255, 51, 102, 0.15) !important;
  color: #ff3366 !important;
}

/* Compensar margin da área principal da tela para o menu lateral */
@media (min-width: 600px) {
  .MuiDrawer-docked .MuiPaper-root {
    left: 68px !important;
  }
}


/* ======================================================
   CARD & POPUP PHOTO STYLING
   ====================================================== */

.MuiCardMedia-root {
  background-size: cover !important;
  background-position: center !important;
  min-height: 170px !important;
  width: 100% !important;
  border-radius: 12px 12px 0 0 !important;
  border-bottom: 2px solid #00f2fe !important;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.25) !important;
  display: block !important;
}

/* Map Markers Tech Glow (MapLibre / Mapbox markers) */
.maplibregl-marker svg {
  filter: drop-shadow(0 0 6px #00f2fe) drop-shadow(0 0 10px rgba(0, 242, 254, 0.4)) !important;
  transition: transform 0.2s ease !important;
}

.maplibregl-marker:hover svg {
  transform: scale(1.25) !important;
  filter: drop-shadow(0 0 12px #00ff88) drop-shadow(0 0 18px rgba(0, 255, 136, 0.7)) !important;
}


/* ======================================================
   OCULTAR MENUS E BOTÕES DO MEIO DO MAPA (LIMPEZA TOTAL)
   Mantendo apenas a barra de navegação da esquerda
   ====================================================== */

/* 1. Ocultar botão flutuante antigo do canto inferior */
#trackpro-dash-btn {
  display: none !important;
}

/* 2. Ocultar barra de tabs/rodapé padrão do Traccar do meio da tela */
.MuiBottomNavigation-root,
div[class*="footer"] {
  display: none !important;
}

/* 3. Ajustar posição do popup/card do veículo caso ele colida com algo */
.MuiCard-root {
  max-width: 320px !important;
}


/* ======================================================
   SCROLLBAR & PROFESSIONAL FINISH
   ====================================================== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(11, 15, 25, 0.95);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 242, 254, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #00f2fe;
  box-shadow: 0 0 10px #00f2fe;
}

/* Modal and dialogs */
.MuiDialog-paper {
  background: #0d1527 !important;
  border: 1px solid rgba(0, 242, 254, 0.3) !important;
  border-radius: 14px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 242, 254, 0.15) !important;
}

/* Table header tech */
.MuiTableHead-root th {
  background: rgba(13, 21, 39, 0.95) !important;
  color: #00f2fe !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  font-size: 11px !important;
  letter-spacing: 1px !important;
  border-bottom: 1px solid rgba(0, 242, 254, 0.2) !important;
}

/* List items hover */
.MuiListItemButton-root:hover,
.MuiMenuItem-root:hover {
  background: rgba(0, 242, 254, 0.08) !important;
}


/* ======================================================
   OCULTAR DISPOSITIVOS DO MEIO DO MAPA (GAVETA RETRÁTIL)
   ====================================================== */

/* 1. Por padrão, a gaveta de dispositivos fica escondida à esquerda, fora da visão do mapa */
/* replaced old rule 1 */

/* 3. Garantir que o mapa ocupe 100% da largura da tela livremente */
.maplibregl-map, .mapboxgl-map {
  width: 100% !important;
}


/* ======================================================


/* ==========================================================================
   TRACKGUARD PRO - LAYOUT COMPLETO: MAPA, NAVEGAÇÃO E TELAS DE CONFIGURAÇÃO
   ========================================================================== */

/* 1. MAPA PRINCIPAL (TELA CHEIA) */
div[class*="contentMap"],
.maplibregl-map,
.mapboxgl-map {
  width: 100vw !important;
  height: 100vh !important;
  position: absolute !important;
  inset: 0 !important;
  z-index: 1 !important;
}

/* 2. BARRA LATERAL DO TRACCAR NA TELA DO MAPA (LISTA DE DISPOSITIVOS) */
/* O container lateral do mapa fica recolhido por padrão e só abre quando clica em 'Veículos' */
div[class*="sidebar"] {
  left: -420px !important;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  z-index: 1100 !important;
  box-shadow: 10px 0 35px rgba(0, 0, 0, 0.8) !important;
}

div[class*="sidebar"].trackpro-drawer-open {
  left: 68px !important;
}

/* Os itens internos da lista de veículos não devem esticar para 100vw */
div[class*="contentList"] {
  width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  flex: 1 !important;
  position: relative !important;
  z-index: 4 !important;
}

/* 3. POPUP DE STATUS DO VEÍCULO NO MAPA */
.MuiCard-root {
  width: 360px !important;
  max-width: 90vw !important;
  border-radius: 14px !important;
  border: 1px solid rgba(0, 242, 254, 0.35) !important;
  background: rgba(13, 20, 36, 0.95) !important;
  backdrop-filter: blur(16px) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 242, 254, 0.2) !important;
  overflow: visible !important;
}

.MuiCardContent-root {
  max-height: 250px !important;
  overflow-y: auto !important;
}

.MuiCardMedia-root {
  min-height: 140px !important;
  max-height: 150px !important;
  height: 140px !important;
  background-size: cover !important;
  background-position: center !important;
}

/* Container de ações e botões da central no popup */
#trackpro-card-actions {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding: 12px 14px 14px 14px !important;
  background: rgba(10, 15, 28, 0.98) !important;
  border-top: 1px solid rgba(0, 242, 254, 0.25) !important;
  border-radius: 0 0 14px 14px !important;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.4) !important;
  z-index: 10 !important;
  position: relative !important;
}

/* 4. TELAS DE AJUSTES E CONFIGURAÇÕES (/settings/*) */
/* Gaveta de menu de Ajustes (Usuários, Preferências, Servidor, Notificações, etc.) */
.MuiDrawer-docked {
  position: fixed !important;
  left: 68px !important;
  top: 0 !important;
  bottom: 0 !important;
  z-index: 1050 !important;
}

.MuiDrawer-docked .MuiPaper-root {
  position: relative !important;
  height: 100vh !important;
  width: 280px !important;
  background: rgba(10, 16, 28, 0.98) !important;
  border-right: 1px solid rgba(0, 242, 254, 0.25) !important;
  overflow-y: auto !important;
}

/* Área central onde ficam as páginas de configurações e formulários */
/* Em telas grandes afasta 348px (68px barra TrackGuard + 280px menu Ajustes) */
@media (min-width: 900px) {
  body:not(:has(div[class*="contentMap"])) .MuiContainer-root,
  body:not(:has(div[class*="contentMap"])) main > div[class*="container"] {
    margin-left: 360px !important;
    width: calc(100vw - 400px) !important;
    max-width: 950px !important;
  }
}

@media (max-width: 899px) {
  body:not(:has(div[class*="contentMap"])) .MuiContainer-root {
    margin-left: 76px !important;
    width: calc(100vw - 86px) !important;
  }
}

/* NUNCA cortar a altura dos formulários ou containers de edição */
.MuiContainer-root {
  min-height: auto !important;
  margin-top: 24px !important;
  margin-bottom: 80px !important;
  overflow: visible !important;
}

/* Todos os Accordions de Ajustes (Usuário, Preferências, Notificações, Atributos) */
.MuiAccordion-root {
  background: rgba(13, 20, 36, 0.95) !important;
  border: 1px solid rgba(0, 242, 254, 0.3) !important;
  border-radius: 12px !important;
  color: #fff !important;
  margin-bottom: 16px !important;
  overflow: visible !important;
}

.MuiAccordionDetails-root {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
  padding: 24px !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Botões 'Cancelar' e 'Salvar' de formulários */
div[class*="buttons"] {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 14px !important;
  margin-top: 24px !important;
  margin-bottom: 50px !important;
}

div[class*="buttons"] button {
  min-width: 140px !important;
  padding: 10px 24px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
}
