/* ─── VARIABLES Y CONFIGURACIÓN GLOBAL ──────────────────────────────── */
:root {
  --bg-main: #0B0F19;
  --bg-card: rgba(22, 28, 45, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  
  --primary: #8B5CF6; /* Violeta vibrante */
  --primary-hover: #7C3AED;
  --success: #10B981; /* Verde esmeralda */
  --danger: #EF4444; /* Rojo coral */
  --warning: #F59E0B; /* Naranja/Amarillo */
  
  --gradient-main: linear-gradient(135deg, #1E1B4B 0%, #0F172A 100%);
  --gradient-accent: linear-gradient(90deg, #8B5CF6 0%, #EC4899 100%);
  
  --font-family: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --radius: 16px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  background-image: var(--gradient-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

/* ─── PANTALLAS (Gstión de estados de visualización) ──────────────── */
.screen {
  display: none;
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 24px;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.screen.active {
  display: flex;
  flex-direction: column;
}

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

/* ─── PANTALLA DE CARGA ────────────────────────────────────────────── */
#loading-screen {
  justify-content: center;
  align-items: center;
}

.loader-container {
  text-align: center;
}

.taxi-logo {
  font-size: 64px;
  margin-bottom: 16px;
  animation: pulse 1.5s infinite ease-in-out;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 2px;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.brand-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(139, 92, 246, 0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ─── BOTONES Y CONTROLES ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-primary {
  background: var(--gradient-accent);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-danger {
  background-color: var(--danger);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

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

.btn-success {
  background-color: var(--success);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background-color: #059669;
  transform: translateY(-2px);
}

.btn-pulse {
  animation: buttonPulse 2s infinite;
}

@keyframes buttonPulse {
  0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

/* ─── CARDS DE AUTENTICACIÓN (LOGIN/REGISTRO) ───────────────────── */
.auth-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 32px 24px;
  box-shadow: var(--shadow);
  width: 100%;
  margin: auto 0;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-icon {
  font-size: 40px;
  margin-bottom: 8px;
  display: block;
}

.auth-header h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Formularios */
.input-group {
  margin-bottom: 16px;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 15px;
  transition: border-color 0.2s, background-color 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Grid para Registro */
.register-card {
  max-width: 550px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Sección de carga de fotos */
.photos-section {
  border-top: 1px solid var(--border-color);
  margin-top: 20px;
  padding-top: 16px;
}

.photos-section h3 {
  font-family: var(--font-display);
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text-main);
}

.file-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.file-uploader {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed var(--border-color);
  border-radius: 16px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.file-uploader:hover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.05);
}

.file-uploader input[type="file"] {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0;
  cursor: pointer;
}

.file-label {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.upload-icon {
  font-size: 24px;
  margin-bottom: 6px;
}

.upload-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.image-preview {
  margin-top: 8px;
  width: 100%;
  height: 80px;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  display: none;
}

/* ─── PANTALLA PRINCIPAL (DASHBOARD) ──────────────────────────────── */
#dashboard-screen {
  background: transparent;
  max-width: 480px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.driver-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  object-fit: cover;
}

.driver-info h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}

.vehicle-badge {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 20px;
  color: var(--text-muted);
  display: inline-block;
  margin-top: 2px;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-logout:hover {
  transform: translateX(3px);
}

.app-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Tarjeta de Estado (Switch de Disponibilidad) */
.status-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.status-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  transition: background-color 0.3s;
}

.status-indicator.offline { background-color: var(--danger); box-shadow: 0 0 12px var(--danger); }
.status-indicator.online { background-color: var(--success); box-shadow: 0 0 12px var(--success); }

.status-text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}

/* Switch Toggle n8n-style */
.toggle-container {
  position: relative;
}

.switch-checkbox {
  display: none;
}

.switch-label {
  display: block;
  overflow: hidden;
  cursor: pointer;
  border: 0 solid #ccc;
  border-radius: 20px;
  margin: 0;
}

.switch-inner {
  display: block;
  width: 200%;
  margin-left: -100%;
  transition: margin 0.3s ease-in 0s;
}

.switch-inner:before, .switch-inner:after {
  display: block;
  float: left;
  width: 50%;
  height: 30px;
  padding: 0;
  line-height: 30px;
  font-size: 14px;
  color: white;
  font-family: var(--font-display);
  font-weight: bold;
  box-sizing: border-box;
}

.switch-inner:before {
  content: "";
  padding-left: 10px;
  background-color: var(--primary);
  color: #FFFFFF;
}

.switch-inner:after {
  content: "";
  padding-right: 10px;
  background-color: rgba(255,255,255,0.1);
  color: #999999;
  text-align: right;
}

.switch-switch {
  display: block;
  width: 24px;
  margin: 3px;
  background: #FFFFFF;
  position: absolute;
  top: 0;
  bottom: 0;
  right: 46px;
  border: 0 solid #ccc;
  border-radius: 20px;
  transition: all 0.3s ease-in 0s;
}

.switch-checkbox:checked + .switch-label .switch-inner {
  margin-left: 0;
}

.switch-checkbox:checked + .switch-label .switch-switch {
  right: 0px;
}

.switch-label {
  width: 76px;
}

/* GPS Status Card */
.gps-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-color);
  border-radius: 20px;
  padding: 16px;
  text-align: left;
}

.gps-icon {
  font-size: 24px;
}

.gps-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Tarjeta Viaje Activo */
.trip-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.trip-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 1px;
}

.trip-badge.active {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.trip-fare {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--success);
}

.trip-locations {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  padding-left: 16px;
}

.trip-locations::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background-color: var(--border-color);
}

.location-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}

.dot-green, .dot-red {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  position: absolute;
  left: -16px;
}

.dot-green { background-color: var(--success); box-shadow: 0 0 8px var(--success); }
.dot-red { background-color: var(--danger); box-shadow: 0 0 8px var(--danger); }

.location-details h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.location-details p {
  font-size: 14px;
  font-weight: 500;
}

.hidden {
  display: none !important;
}

/* ─── MODAL ALERTA DE VIAJE (TIEMPO REAL) ─────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-card {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: 28px;
  width: 100%;
  max-width: 400px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-top: 8px;
  margin-bottom: 16px;
}

.alert-icon {
  font-size: 48px;
  animation: heartbeat 1.2s infinite;
  display: inline-block;
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  20% { transform: scale(1.2); }
  40% { transform: scale(1.1); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Círculo de cuenta regresiva */
.countdown-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid rgba(245, 158, 11, 0.2);
  border-top-color: var(--warning);
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 16px;
}

.countdown-circle span {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--warning);
}

.modal-fare {
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.1);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 20px;
}

.fare-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.fare-amount {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  color: var(--success);
}

.trip-route {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
  background: rgba(255,255,255,0.02);
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.route-point {
  display: flex;
  gap: 12px;
}

.badge-dot-green, .badge-dot-red {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.badge-dot-green { background-color: var(--success); }
.badge-dot-red { background-color: var(--danger); }

.route-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.route-address {
  font-size: 13px;
  font-weight: 500;
  margin-top: 1px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 12px;
}
