/* style.css - Design System for DriveTrack PWA */

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

:root {
  /* Color Palette */
  --bg-primary: #06080c;
  --bg-secondary: #0d1117;
  --bg-tertiary: #161c24;
  --border-color: rgba(255, 255, 255, 0.05);
  
  --accent-cyan: #00f0ff; /* Neon Cyber Cyan */
  --accent-cyan-rgb: 0, 240, 255;
  --accent-blue: #2563eb;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Fonts & Shadows */
  --font-main: 'Outfit', sans-serif;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-neon: 0 0 20px rgba(0, 240, 255, 0.25);
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Layout Skeleton */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.site-header {
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 0;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  text-decoration: none;
  letter-spacing: -0.5px;
}

.brand-logo i {
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.5));
}

.brand-logo .accent {
  color: var(--accent-cyan);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 8px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.nav-item a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active a {
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.15);
}

/* User simulated select dropdown */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Premium Buttons */
.btn-premium {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: var(--accent-cyan);
  color: #06080c;
  box-shadow: var(--shadow-neon);
}

.btn-primary:hover {
  background: #00c7d4;
  transform: translateY(-1px);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.35);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

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

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--accent-red);
  color: white;
}

/* Floating Switcher Role Badge */
.role-badge-floating {
  background: var(--bg-secondary);
  border: 1px solid var(--accent-cyan);
  border-radius: 50px;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  letter-spacing: 0.5px;
}

/* App Sections */
main {
  flex-grow: 1;
  padding: 30px 0;
}

.app-section {
  display: none;
}

.app-section.active {
  display: block;
}

/* --- MOBILE DRIVER VIEW --- */
.mobile-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
}

.mobile-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.mobile-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-blue));
}

.driver-welcome {
  text-align: center;
  margin-bottom: 24px;
}

.driver-welcome h2 {
  font-size: 1.8rem;
  font-weight: 800;
}

.driver-welcome p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 20px;
  width: 100%;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-select, .form-input, .form-textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: white;
  padding: 12px 16px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  outline: none;
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.15);
}

/* Action Trigger Dials */
.action-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px 0;
}

.ride-main-btn {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 4px solid var(--bg-tertiary);
  background: radial-gradient(circle, var(--accent-cyan) 0%, #009aa8 100%);
  color: #06080c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  outline: none;
}

.ride-main-btn::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 1px solid rgba(0, 240, 255, 0.2);
  animation: pulse-ring 2s infinite;
}

.ride-main-btn i {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.ride-main-btn span {
  font-weight: 800;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ride-main-btn.active {
  background: radial-gradient(circle, var(--accent-red) 0%, #7f1d1d 100%);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

.ride-main-btn.active::after {
  border-color: rgba(239, 68, 68, 0.2);
}

.ride-main-btn:hover {
  transform: scale(1.03);
}

.ride-timer-display {
  font-size: 2rem;
  font-family: monospace;
  font-weight: 700;
  color: white;
  margin-top: 15px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* GPS Status Widget */
.gps-status {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
}

.gps-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
}

.gps-indicator.active {
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
  animation: blink 1.5s infinite;
}

.gps-indicator.error {
  background: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

.gps-info {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* History logs list in mobile card */
.mobile-history-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.history-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-details {
  display: flex;
  flex-direction: column;
}

.history-location {
  font-weight: 600;
  font-size: 0.9rem;
}

.history-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.history-fare {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
  padding: 2px 8px;
  border-radius: 50px;
  border: 1px solid rgba(0, 240, 255, 0.15);
}

/* --- DESKTOP ADMIN PANELS --- */
.dashboard-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.summary-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.summary-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: rgba(0, 240, 255, 0.08);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border: 1px solid rgba(0, 240, 255, 0.15);
}

.summary-icon.green {
  background: rgba(16, 185, 129, 0.08);
  color: var(--accent-green);
  border-color: rgba(16, 185, 129, 0.15);
}

.summary-icon.orange {
  background: rgba(245, 158, 11, 0.08);
  color: var(--accent-orange);
  border-color: rgba(245, 158, 11, 0.15);
}

.summary-info {
  display: flex;
  flex-direction: column;
}

.summary-val {
  font-size: 1.8rem;
  font-weight: 800;
}

.summary-lbl {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tab Content toggles */
.tab-content-panel {
  display: none;
}

.tab-content-panel.active {
  display: block;
}

/* Grid of Vehicles overview */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.vehicle-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.vehicle-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-sm);
}

.vehicle-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.vehicle-status-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.vehicle-status-badge.available {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.vehicle-status-badge.rented {
  background: rgba(0, 240, 255, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.2);
  animation: pulse-border-cyan 2s infinite;
}

.vehicle-status-badge.maintenance {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.vehicle-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.vehicle-card-plate {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  width: fit-content;
  margin-bottom: 12px;
}

.vehicle-card-color {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.vehicle-active-driver {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: auto;
}

.vehicle-active-driver-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.vehicle-active-driver-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.vehicle-active-driver-info i {
  color: var(--accent-cyan);
  animation: blink 1.5s infinite;
}

/* CRUD Table layouts */
.crud-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.crud-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.crud-panel-title {
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.crud-search-row {
  display: flex;
  gap: 10px;
}

.crud-table-wrap {
  overflow-x: auto;
  width: 100%;
}

.crud-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.crud-table th, .crud-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.crud-table th {
  background: rgba(255, 255, 255, 0.01);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.crud-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.badge {
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.action-buttons {
  display: flex;
  gap: 6px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: white;
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.btn-icon.edit:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.05);
}

.btn-icon.delete:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.05);
}

/* Modals Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.3s ease;
  position: relative;
}

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

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: white;
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
}

/* Utility Animations */
@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.4;
  }
  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}

@keyframes pulse-border-cyan {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 240, 255, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(0, 240, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 240, 255, 0);
  }
}

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

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fade-in 0.4s ease forwards;
}
