/* ==========================================================================
   FleetPulse Logistics & Control de Flota - CSS Design System
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-primary: #0b0f19;
  --bg-surface: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-solid: #1f293d;
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  
  --accent-cyan: #00f2fe;
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --text-bright: #ffffff;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #64748b;
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-cyan: rgba(0, 242, 254, 0.3);
  --border-blue: rgba(59, 130, 246, 0.3);

  --shadow-glow: 0 0 25px rgba(0, 242, 254, 0.15);
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #172554 0%, #0b0f19 70%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', 'Inter', sans-serif;
  color: var(--text-bright);
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, select, textarea {
  font-family: inherit;
  outline: none;
}

/* Utility Containers */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.glass-panel-glow {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-cyan);
  box-shadow: var(--shadow-glow);
  border-radius: var(--radius-md);
}

.gradient-text {
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 50%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-en-ruta {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-disponible {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-mantenimiento {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-carga {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Header & Navigation */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition-normal);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.brand-logo img {
  height: 48px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-cyan);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #00f2fe 0%, #0072ff 100%);
  color: #ffffff;
  font-weight: 600;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
  transition: var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.5);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-weight: 600;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-cyan);
  color: var(--accent-cyan);
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none;
  font-size: 1.5rem;
  color: var(--text-main);
}

/* Hero Section */
.hero-section {
  padding-top: 140px;
  padding-bottom: 60px;
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid var(--border-cyan);
  color: var(--accent-cyan);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
}

.hero-title {
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 1.2rem;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 540px;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

/* Tracking Bar Card */
.tracking-box {
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--border-cyan);
  padding: 0.6rem;
  border-radius: var(--radius-md);
  display: flex;
  gap: 0.5rem;
  box-shadow: var(--shadow-glow);
}

.tracking-box input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.8rem 1.2rem;
  color: var(--text-bright);
  font-size: 1rem;
}

.tracking-box input::placeholder {
  color: var(--text-dark);
}

.hero-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
  margin-top: 3rem;
}

.stat-card {
  padding: 1.4rem;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--border-cyan);
  transform: translateY(-3px);
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-cyan);
  font-family: 'Outfit', sans-serif;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.2rem;
}

/* Tracking Result Drawer/Modal */
.tracking-result-panel {
  margin-top: 1rem;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-cyan);
  display: none;
}

.tracking-result-panel.active {
  display: block;
  animation: fadeIn 0.3s ease-out forwards;
}

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

.timeline-tracker::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 10%;
  right: 10%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 1;
}

.timeline-tracker .progress-line {
  position: absolute;
  top: 16px;
  left: 10%;
  height: 3px;
  background: var(--accent-cyan);
  z-index: 2;
  transition: width 0.6s ease;
}

.step-item {
  position: relative;
  z-index: 3;
  text-align: center;
}

.step-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1e293b;
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.5rem auto;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.step-item.completed .step-icon {
  background: var(--accent-cyan);
  color: #0b0f19;
  border-color: var(--accent-cyan);
}

.step-item.active .step-icon {
  background: #0284c7;
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-cyan);
}

.step-title {
  font-size: 0.8rem;
  font-weight: 600;
}

.step-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Main Dashboard Section (Control de Flota) */
.dashboard-section {
  padding: 80px 0;
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-subtitle {
  color: var(--accent-cyan);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: 2.4rem;
  font-weight: 800;
}

/* Fleet Controls Bar */
.fleet-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  transition: var(--transition-fast);
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.filter-btn.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input-wrap input {
  padding: 0.55rem 1rem 0.55rem 2.5rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.9rem;
  width: 250px;
}

.search-input-wrap input:focus {
  border-color: var(--accent-cyan);
}

/* Dashboard Layout Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

/* Map Card */
.map-container-card {
  position: relative;
  height: 520px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

#fleet-map {
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #0f172a;
}

.map-overlay-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 500;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-cyan);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: blink 1.5s infinite;
}

/* Vehicle List Grid Panel */
.vehicle-panel-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.vehicle-panel-list::-webkit-scrollbar {
  width: 6px;
}

.vehicle-panel-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.vehicle-card {
  padding: 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.vehicle-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-cyan);
  transform: translateX(4px);
}

.vehicle-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vehicle-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vehicle-plate {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.1);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-sm);
}

.vehicle-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.6rem;
  border-radius: var(--radius-sm);
}

.metric-item {
  display: flex;
  flex-direction: column;
}

.metric-label {
  color: var(--text-dark);
  font-size: 0.7rem;
}

.metric-value {
  font-weight: 600;
  color: var(--text-bright);
}

/* Progress bar inside cards */
.progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.2rem;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* Telematics Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 15, 0.8);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 90%;
  max-width: 800px;
  background: #0f172a;
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
  padding: 2rem;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1.4rem;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--accent-rose);
}

.telematics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.telematics-card {
  background: var(--bg-card);
  padding: 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  text-align: center;
}

.telematics-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin: 0.4rem 0;
}

/* Services Section */
.services-section {
  padding: 80px 0;
  background: rgba(15, 23, 42, 0.5);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.service-card {
  padding: 2.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.service-card:hover {
  border-color: var(--border-cyan);
  transform: translateY(-6px);
  box-shadow: var(--shadow-glow);
}

.service-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
  border: 1px solid var(--border-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--accent-cyan);
}

.service-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.service-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex-grow: 1;
}

/* Calculator & Quote Section */
.calculator-section {
  padding: 80px 0;
}

.calculator-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  padding: 0.8rem 1rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.95rem;
}

.form-control:focus {
  border-color: var(--accent-cyan);
}

.quote-summary-box {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-md);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.quote-price {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent-cyan);
  font-family: 'Outfit', sans-serif;
  margin: 1rem 0;
}

/* Footer */
.footer {
  background: #070a12;
  border-top: 1px solid var(--border-light);
  padding: 60px 0 30px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-brand p {
  margin-top: 1rem;
  max-width: 320px;
}

.footer-title {
  color: var(--text-bright);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.footer-links a:hover {
  color: var(--accent-cyan);
}

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

/* Animations */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Leaflet Custom Marker Styling */
.leaflet-popup-content-wrapper {
  background: #0f172a !important;
  color: #fff !important;
  border: 1px solid #00f2fe !important;
  border-radius: 12px !important;
  box-shadow: 0 0 15px rgba(0,242,254,0.3) !important;
}

.leaflet-popup-tip {
  background: #0f172a !important;
}

.custom-map-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  border: 2px solid #00f2fe;
  border-radius: 50%;
  color: #00f2fe;
  box-shadow: 0 0 10px #00f2fe;
  font-size: 14px;
}

.custom-map-icon.en-ruta {
  border-color: #10b981;
  color: #10b981;
  box-shadow: 0 0 10px #10b981;
}

.custom-map-icon.mantenimiento {
  border-color: #f43f5e;
  color: #f43f5e;
  box-shadow: 0 0 10px #f43f5e;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .map-container-card {
    height: 380px;
  }
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .calculator-card {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links, .nav-actions {
    display: none;
  }
  .mobile-nav-toggle {
    display: block;
  }
  .hero-title {
    font-size: 2.2rem;
  }
  .hero-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .services-grid {
    grid-template-columns: 1fr;
  }
  .telematics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
