@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-deep: #0a0813;
  --bg-surface: rgba(22, 18, 44, 0.65);
  --bg-surface-opaque: #16122d;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(124, 58, 237, 0.6);
  
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.3);
  --secondary: #06b6d4;
  --accent: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --shadow-neon: 0 0 15px rgba(139, 92, 246, 0.15);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Customizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* --- TELA DE LOGIN (GLASSMORPHISM) --- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
              var(--bg-deep);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), var(--shadow-neon);
  animation: fadeIn 0.6s ease-out;
}

.brand-header {
  text-align: center;
  margin-bottom: 2rem;
}

.brand-logo {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-logo i {
  background: linear-gradient(135deg, #a78bfa 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tagline {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input, .input-wrapper select, .input-wrapper textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  padding-left: 2.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-smooth);
}

.input-wrapper input:focus, .input-wrapper select:focus, .input-wrapper textarea:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.input-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  transition: var(--transition-smooth);
}

.input-wrapper input:focus + i {
  color: var(--primary);
}

.btn-primary {
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5), 0 0 10px rgba(139, 92, 246, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.error-message {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 1rem;
  text-align: center;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.5rem;
  border-radius: 8px;
  display: none;
}


/* --- LAYOUT DO PAINEL GERAL (DASHBOARD) --- */
.dashboard-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: var(--bg-deep);
  animation: fadeIn 0.4s ease-out;
}

/* SIDEBAR */
.sidebar {
  width: 320px;
  height: 100%;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: var(--transition-smooth);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header .brand-logo {
  font-size: 1.75rem;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.5rem;
  border-radius: 8px;
  transition: var(--transition-smooth);
}

.btn-logout:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.sidebar-tabs {
  display: flex;
  padding: 0.75rem 1rem;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 0.6rem 0.25rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: center;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--primary);
  border: 1px solid rgba(139, 92, 246, 0.2);
  box-shadow: var(--shadow-neon);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.sidebar-panel {
  display: none;
}

.sidebar-panel.active {
  display: block;
}

/* LISTAS DENTRO DA SIDEBAR */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.list-header h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* CARD DE MOTORISTA / ENTREGADOR */
.deliverer-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.deliverer-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: var(--tracker-color, var(--primary));
}

.deliverer-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.deliverer-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.deliverer-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.deliverer-id {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.deliverer-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.speed-badge {
  background: rgba(6, 182, 212, 0.1);
  color: var(--secondary);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.battery-badge {
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.battery-high { background: rgba(16, 185, 129, 0.1); color: var(--accent); }
.battery-medium { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.battery-low { background: rgba(239, 68, 68, 0.1); color: var(--danger); animation: pulse 1s infinite alternate; }

.deliverer-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: right;
}

/* ÁREA DO MAPA PRINCIPAL */
.map-container {
  flex: 1;
  position: relative;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
}

/* --- OVERLAY DE CONTROLE DO SIMULADOR --- */
.simulator-panel {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 320px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  animation: slideInRight 0.4s ease-out;
}

.simulator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.simulator-header h4 {
  font-family: var(--font-title);
  font-weight: 700;
  color: var(--secondary);
}

.sim-btn-active {
  background: rgba(16, 185, 129, 0.2) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

/* --- MODAIS DE CADASTRO --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface-opaque);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(-20px);
  transition: var(--transition-smooth);
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.btn-secondary {
  flex: 1;
  padding: 0.8rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}


/* --- CUSTOM LEAFLET AND ACCENTS --- */
.leaflet-container {
  font-family: var(--font-body) !important;
}

.leaflet-bar {
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
  border-radius: 10px !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: var(--bg-surface-opaque) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-color) !important;
  transition: var(--transition-smooth);
}

.leaflet-bar a:hover {
  background-color: var(--primary) !important;
  color: #fff !important;
}

/* CUSTOM PULSING MOTORCYCLE CSS MARKER */
.custom-gps-marker {
  position: relative;
  width: 40px !important;
  height: 40px !important;
}

.marker-pin {
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  background: var(--marker-color, #7c3aed);
  position: absolute;
  transform: rotate(-45deg);
  left: 50%;
  top: 50%;
  margin: -16px 0 0 -16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  border: 2px solid #fff;
  transition: var(--transition-smooth);
}

/* Para conter o ícone rotacionado corretamente de volta */
.marker-pin i {
  transform: rotate(45deg);
  color: white;
  font-size: 0.9rem;
}

.marker-pulse {
  background: var(--marker-color, #7c3aed);
  border-radius: 50%;
  height: 40px;
  width: 40px;
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -20px 0 0 -20px;
  animation: pulsate 1.8s ease-out infinite;
  opacity: 0;
  z-index: -1;
  pointer-events: none;
}

/* Estilos de Rota nos Mapas */
.leaflet-interactive {
  filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.4));
}


/* --- TELA DE RASTREAMENTO DO CLIENTE (iFood Style) --- */
.client-track-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: var(--bg-deep);
  position: relative;
}

.client-header {
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.client-header-card {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: auto;
}

.client-header-card .logo-small {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a78bfa 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.client-status-card {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 500px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), var(--shadow-neon);
  z-index: 1000;
  animation: slideInUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.delivery-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.delivery-title {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.delivery-eta {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--secondary);
}

.status-timeline {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 1.5rem 0;
}

.status-timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 1;
}

.status-timeline-progress {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  width: var(--progress-width, 0%);
  z-index: 2;
  transition: width 1s ease-in-out;
}

.timeline-step {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-surface-opaque);
  border: 3px solid rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 3;
  transition: var(--transition-smooth);
}

.timeline-step.completed {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.timeline-step.active {
  border-color: var(--secondary);
  background: var(--bg-deep);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
  animation: pulse-border 1.5s infinite;
}

.timeline-step-label {
  position: absolute;
  top: 25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.timeline-step.active .timeline-step-label {
  color: var(--secondary);
  font-weight: 600;
}

.timeline-step.completed .timeline-step-label {
  color: var(--text-primary);
}

.deliverer-details {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  margin-top: 1rem;
}

.deliverer-avatar {
  width: 48px;
  height: 48px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.deliverer-meta {
  flex: 1;
}

.deliverer-meta-name {
  font-weight: 600;
  color: #fff;
}

.deliverer-meta-vehicle {
  font-size: 0.8rem;
  color: var(--text-secondary);
}


/* --- ANIMAÇÕES --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInUp {
  from { transform: translate(-50%, 50px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes pulsate {
  0% { transform: scale(0.1, 0.1); opacity: 0; }
  50% { opacity: 0.6; }
  100% { transform: scale(1.2, 1.2); opacity: 0; }
}

@keyframes pulse {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(6, 182, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

/* Responsividade Básica */
@media (max-width: 768px) {
  .dashboard-container {
    flex-direction: column-reverse;
  }
  .sidebar {
    width: 100%;
    height: 350px;
    border-right: none;
    border-top: 1px solid var(--border-color);
  }
  .simulator-panel {
    top: 1rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    bottom: auto;
  }
}
