/* Modern Light Dashboard Theme with Indigo & Slate Accents */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-color: #f8fafc; /* Soft slate light background */
  --panel-bg: rgba(255, 255, 255, 0.85); /* Glassmorphism white panel */
  --border-color: rgba(0, 0, 0, 0.08); /* Clean thin border */
  --text-main: #0f172a; /* Slate 900 */
  --text-muted: #64748b; /* Slate 500 */
  --primary: #4f46e5; /* Indigo 600 */
  --primary-hover: #3730a3; /* Indigo 800 */
  --primary-glow: rgba(79, 70, 229, 0.12);
  --accent: #ca8a04; /* Gold/Yellow for badges or secondary states */
  --success: #059669; /* Emerald 600 */
  --danger: #dc2626; /* Red 600 */
  --card-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(217, 70, 239, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent);
}

/* Layout Elements */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon {
  font-size: 1.75rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: rgba(79, 70, 229, 0.08);
}

/* Glassmorphism Panels */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 2.5rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

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

.form-control {
  width: 100%;
  padding: 0.875rem 1.25rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: #ffffff;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.75rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

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

.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
  background: #f1f5f9;
  color: var(--text-main);
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
}

/* Auth Cards */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 150px);
}

.auth-card {
  width: 100%;
  max-width: 450px;
}

.auth-title {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Flash Messages */
.flash-container {
  position: fixed;
  top: 90px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flash-message {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(8px);
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.flash-notice {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #059669;
}

.flash-alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #dc2626;
}

/* Maps & Live Tracking Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  height: calc(100vh - 120px);
  margin-top: 1rem;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.map-viewport {
  width: 100%;
  height: 100%;
  border-radius: var(--card-radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

#map {
  width: 100%;
  height: 100%;
}

.trip-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #d97706;
}

.badge-active {
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.2);
  color: #4f46e5;
}

.badge-completed {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #059669;
}

/* Animations */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Error Messages on fields */
.field-errors {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.field_with_errors .form-control {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.field_with_errors label {
  color: #dc2626;
}

/* Welcome Page Hero */
.hero-panel {
  text-align: center;
  max-width: 800px;
  margin: 4rem auto;
  padding: 4rem 2rem;
}

.hero-title {
  font-size: 3.5rem;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.25rem;
  margin-bottom: 2.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Live Telemetry Panels */
.telemetry-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.telemetry-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.telemetry-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.25rem;
  word-break: break-all;
}

/* Active Driver Panel */
.driver-console {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  max-width: 600px;
  margin: 0 auto;
}

.pulse-indicator {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 2rem;
}

.pulse-core {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 20px var(--primary);
}

.pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--primary);
  animation: pulse 2s infinite ease-out;
  opacity: 0;
}

@keyframes pulse {
  0% {
    transform: scale(0.3);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

/* Mobile Responsive full-screen map styling */
.mobile-floating-back {
  display: none;
}

@media (max-width: 767px) {
  .navbar {
    display: none !important;
  }
  
  .app-container {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100vw !important;
    height: 100dvh !important;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99;
  }

  .app-container > div:first-of-type {
    display: none !important;
  }

  .dashboard-grid {
    display: flex;
    flex-direction: column-reverse;
    height: 100%;
    width: 100%;
    margin: 0;
    gap: 0;
    position: relative;
  }

  .map-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    z-index: 1;
  }

  .sidebar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    padding: 1rem !important;
    gap: 0.75rem !important;
    box-sizing: border-box;
    pointer-events: auto !important;
    max-height: 250px !important;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.4), transparent);
    scrollbar-width: none;
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .sidebar > * {
    flex: 0 0 85% !important;
    scroll-snap-align: center;
    max-width: 380px !important;
  }

  .sidebar .glass-panel {
    padding: 1.25rem !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12) !important;
    background: rgba(255, 255, 255, 0.94) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-sizing: border-box;
    margin-bottom: 0 !important;
  }

  .sidebar .glass-panel h3 {
    font-size: 1rem !important;
    margin-top: 0 !important;
    margin-bottom: 0.5rem !important;
    color: var(--text-main);
  }

  .mobile-floating-back {
    display: flex !important;
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 20;
    background: rgba(255, 255, 255, 0.94) !important;
    border-radius: 50% !important;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.15);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: bold;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .mobile-floating-back:hover {
    background: #ffffff !important;
    transform: scale(1.05);
  }
}
