/* ============================================================================
   GUÍALO — DRIVER APP
   Sistema de diseño: Imperial Cocoa + Vanilla Sage
   Estilo: BBOS 10 / Symbian Belle moderno
   Versión: 2.0 — con modos de contraste para uso bajo el sol
   ============================================================================ */

/* ============================================================================
   1. VARIABLES — MODO NORMAL (por defecto)
   ============================================================================ */
:root {
  /* ---------- BASE ---------- */
  --bg-primary:      #1A120B;
  --bg-surface:      #231A12;
  --bg-elevated:     #2E2418;
  --bg-inset:        #0F0A06;

  /* ---------- TEXTO — más claro que antes para mejor legibilidad ---------- */
  --text-primary:    #FAFAF5;   /* casi blanco en vez de beige */
  --text-secondary:  #D4D4C0;
  --text-muted:      #9A9A85;
  --text-faint:      #6B6B58;

  /* ---------- ACENTOS — más saturados para visibilidad ---------- */
  --accent-online:      #A8D18D;
  --accent-online-bg:   rgba(168, 209, 141, 0.12);
  --accent-online-border: rgba(168, 209, 141, 0.4);

  --accent-active:      #E5B96D;
  --accent-active-bg:   rgba(229, 185, 109, 0.12);
  --accent-active-border: rgba(229, 185, 109, 0.45);

  --accent-critical:    #E06B55;
  --accent-critical-bg: rgba(224, 107, 85, 0.12);
  --accent-critical-border: rgba(224, 107, 85, 0.45);

  --accent-action:      #F0E8D0;
  --accent-action-hover:#FAFAF5;

  /* ---------- BORDES ---------- */
  --border-subtle:   rgba(250, 250, 245, 0.09);
  --border-medium:   rgba(250, 250, 245, 0.18);
  --border-strong:   rgba(250, 250, 245, 0.30);

  /* ---------- SOMBRAS ---------- */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);

  /* ---------- RADIOS ---------- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* ---------- ESPACIADO ---------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* ---------- TIPOGRAFÍA ---------- */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* ---------- TRANSICIONES ---------- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-slow: 400ms;
}

/* ============================================================================
   2. MODO ALTO CONTRASTE — activable con data-contrast="high"
   ============================================================================ */
[data-contrast="high"] {
  --text-primary:    #FFFFFF;
  --text-secondary:  #EBEBEB;
  --text-muted:      #C0C0C0;
  --text-faint:      #8A8A8A;

  --border-subtle:   rgba(255, 255, 255, 0.14);
  --border-medium:   rgba(255, 255, 255, 0.24);
  --border-strong:   rgba(255, 255, 255, 0.40);

  --accent-online:      #B8E89D;
  --accent-active:      #F5C976;
  --accent-critical:    #F07B65;
  --accent-action:      #FFFFFF;
  --accent-action-hover:#FFFFFF;
}

/* ============================================================================
   3. MODO SOL DIRECTO — activable con data-contrast="sunlight"
   Colores puros para máxima legibilidad bajo luz solar intensa
   ============================================================================ */
[data-contrast="sunlight"] {
  --bg-primary:      #000000;
  --bg-surface:      #0D0D0D;
  --bg-elevated:     #1A1A1A;
  --bg-inset:        #000000;

  --text-primary:    #FFFFFF;
  --text-secondary:  #F0F0F0;
  --text-muted:      #CCCCCC;
  --text-faint:      #999999;

  --border-subtle:   rgba(255, 255, 255, 0.20);
  --border-medium:   rgba(255, 255, 255, 0.32);
  --border-strong:   rgba(255, 255, 255, 0.50);

  --accent-online:      #A5E88F;
  --accent-online-bg:   rgba(165, 232, 143, 0.18);
  --accent-online-border: rgba(165, 232, 143, 0.55);

  --accent-active:      #FFD166;
  --accent-active-bg:   rgba(255, 209, 102, 0.18);
  --accent-active-border: rgba(255, 209, 102, 0.55);

  --accent-critical:    #FF8A70;
  --accent-critical-bg: rgba(255, 138, 112, 0.18);
  --accent-critical-border: rgba(255, 138, 112, 0.55);

  --accent-action:      #FFFFFF;
  --accent-action-hover:#FFFFFF;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.8);
}

/* ============================================================================
   4. RESET Y BASE
   ============================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg-primary);
}

body {
  font-family: var(--font-base);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-bottom: 100px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  transition: background-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}

/* ============================================================================
   5. TIPOGRAFÍA
   ============================================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

.label-uppercase {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.number-large {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.number-medium {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   6. LAYOUT
   ============================================================================ */
.app-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-4);
  padding-top: max(var(--space-4), env(safe-area-inset-top));
}

/* ============================================================================
   7. HEADER DEL MOTORIZADO
   ============================================================================ */
.driver-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.driver-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 1;
}

.driver-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  flex-shrink: 0;
  overflow: hidden;
}

.driver-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.driver-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.driver-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.driver-status-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--accent-online);
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-dot.offline {
  background: var(--text-faint);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1.5px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  position: relative;
  transition: all var(--dur-fast) var(--ease-out);
}

.icon-btn:active {
  transform: scale(0.94);
  background: var(--bg-elevated);
  border-color: var(--border-medium);
}

.icon-btn .badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--accent-critical);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--bg-primary);
}

/* ============================================================================
   8. CARDS
   ============================================================================ */
.card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  transition: border-color var(--dur-base) var(--ease-out),
              background var(--dur-base) var(--ease-out);
}

.card-elevated {
  background: var(--bg-elevated);
}

.card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.card-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--space-4) 0;
  border: none;
}

/* ---------- Card de ganancias ---------- */
.earnings-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.earnings-value {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.earnings-value .currency {
  font-size: 24px;
  color: var(--text-muted);
  margin-right: 4px;
}

.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 40px;
  margin-top: var(--space-2);
}

.mini-chart .bar {
  flex: 1;
  background: var(--border-medium);
  border-radius: 2px 2px 0 0;
  transition: background var(--dur-base) var(--ease-out);
  min-height: 4px;
}

.mini-chart .bar.today {
  background: var(--accent-active);
}

/* ============================================================================
   9. CARD DE ESTADO CENTRAL
   ============================================================================ */
.status-card {
  padding: var(--space-6) var(--space-5);
  text-align: center;
}

.status-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: all var(--dur-base) var(--ease-out);
}

.status-icon.searching {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-medium);
  animation: breathe 2.5s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

.status-icon.online {
  background: var(--accent-online-bg);
  color: var(--accent-online);
  border: 1.5px solid var(--accent-online-border);
}

.status-icon.active {
  background: var(--accent-active-bg);
  color: var(--accent-active);
  border: 1.5px solid var(--accent-active-border);
}

.status-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.status-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 300px;
  margin: 0 auto;
}

/* ============================================================================
   10. BOTONES
   ============================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 56px;
  padding: 0 var(--space-6);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  text-decoration: none;
  user-select: none;
  width: 100%;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent-action);
  color: #1A120B;
}

[data-contrast="sunlight"] .btn-primary {
  color: #000000;
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus-visible:not(:disabled) {
  background: var(--accent-action-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-elevated);
  border-color: var(--text-secondary);
}

.btn-success {
  background: var(--accent-online);
  color: #1A120B;
}

.btn-danger {
  background: transparent;
  color: var(--accent-critical);
  border: 1.5px solid var(--accent-critical-border);
}

.btn-danger:hover:not(:disabled) {
  background: var(--accent-critical-bg);
}

.btn-sm {
  min-height: 42px;
  font-size: 13px;
  padding: 0 var(--space-4);
}

/* ============================================================================
   11. BOTTOM NAVIGATION
   ============================================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border-top: 1.5px solid var(--border-subtle);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  min-width: 64px;
  text-decoration: none;
}

.nav-item:active {
  transform: scale(0.95);
}

.nav-item i {
  font-size: 22px;
  transition: color var(--dur-fast) var(--ease-out);
}

.nav-item.active {
  color: var(--accent-action);
}

.nav-item.active i {
  color: var(--accent-action);
}

/* ============================================================================
   12. TOAST
   ============================================================================ */
.toast-container {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 448px;
}

.toast {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(200%);
  opacity: 0;
  transition: transform var(--dur-slow) var(--ease-out),
              opacity var(--dur-slow) var(--ease-out);
  pointer-events: auto;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast i {
  font-size: 18px;
  flex-shrink: 0;
}

.toast.success i { color: var(--accent-online); }
.toast.error i { color: var(--accent-critical); }
.toast.info i { color: var(--accent-active); }

/* ============================================================================
   13. UTILIDADES
   ============================================================================ */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.w-100 { width: 100%; }

/* ============================================================================
   14. ANIMACIONES DE ENTRADA
   ============================================================================ */
.animate-in {
  animation: fadeSlideUp var(--dur-slow) var(--ease-out) backwards;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.10s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.20s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }

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

/* ============================================================================
   15. MODAL DE NUEVO VIAJE
   ============================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 6, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: 900;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
}

.modal-backdrop.show {
  display: flex;
  opacity: 1;
}

.modal {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform var(--dur-slow) var(--ease-out);
}

.modal-backdrop.show .modal {
  transform: scale(1);
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.modal-title i {
  color: var(--accent-active);
}

.ride-info {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ride-info-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 14px;
}

.ride-info-row i {
  color: var(--text-muted);
  font-size: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

.ride-info-row .label {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 2px;
}

.ride-info-row .value {
  color: var(--text-primary);
  font-weight: 600;
}

.ride-info-row .price {
  color: var(--accent-action);
  font-weight: 800;
  font-size: 18px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* ============================================================================
   16. COUNTDOWN
   ============================================================================ */
.countdown-bar {
  height: 4px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.countdown-fill {
  height: 100%;
  background: var(--accent-active);
  border-radius: var(--radius-full);
  width: 100%;
  transform-origin: left;
}

.countdown-fill.running {
  animation: countdown 15s linear forwards;
}

@keyframes countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ============================================================================
   17. TOGGLE DE CONTRASTE (mini botón para el header)
   ============================================================================ */
.contrast-toggle {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.contrast-toggle:active {
  transform: scale(0.94);
  background: var(--bg-elevated);
}

.contrast-toggle i {
  transition: transform var(--dur-base) var(--ease-out);
}

.contrast-toggle.cycle {
  animation: rotateIcon var(--dur-base) var(--ease-out);
}

@keyframes rotateIcon {
  from { transform: rotate(0deg); }
  to { transform: rotate(180deg); }
}

/* ============================================================================
   18. PANTALLA DE VIAJE ACTIVO
   ============================================================================ */
.ride-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.ride-header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.ride-header-id {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ride-header-status {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ride-header-status .status-dot {
  width: 7px;
  height: 7px;
}

/* ---------- Stepper de estados ---------- */
.stepper {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.step {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 42px;
  bottom: -6px;
  width: 2px;
  background: var(--border-subtle);
  transition: background var(--dur-slow) var(--ease-out);
}

.step.completed:not(:last-child)::after {
  background: var(--accent-online);
}

.step-indicator {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--dur-base) var(--ease-out);
  position: relative;
  z-index: 1;
}

.step.completed .step-indicator {
  background: var(--accent-online);
  border-color: var(--accent-online);
  color: #1A120B;
}

.step.active .step-indicator {
  background: var(--accent-active);
  border-color: var(--accent-active);
  color: #1A120B;
  animation: stepPulse 2s ease-in-out infinite;
}

@keyframes stepPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 var(--accent-active-bg);
  }
  50% {
    box-shadow: 0 0 0 8px var(--accent-active-bg);
  }
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--dur-base) var(--ease-out);
}

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

.step.active .step-title {
  color: var(--accent-active);
  font-weight: 700;
}

.step-time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- Card del cliente ---------- */
.client-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.client-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.client-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  flex-shrink: 0;
}

.client-meta {
  flex: 1;
  min-width: 0;
}

.client-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.client-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.client-rating i {
  color: var(--accent-active);
  font-size: 12px;
}

/* ---------- Info de dirección ---------- */
.address-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-inset);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.address-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 14px;
}

.address-row i {
  color: var(--text-muted);
  font-size: 16px;
  margin-top: 2px;
  flex-shrink: 0;
}

.address-row .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.address-row .value {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.4;
}

/* ---------- Botones de contacto ---------- */
.contact-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 52px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid var(--border-medium);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  text-decoration: none;
}

.contact-btn:active {
  transform: scale(0.97);
}

.contact-btn.call {
  border-color: var(--accent-online-border);
  color: var(--accent-online);
  background: var(--accent-online-bg);
}

.contact-btn.chat {
  border-color: var(--accent-active-border);
  color: var(--accent-active);
  background: var(--accent-active-bg);
}

.contact-btn i {
  font-size: 18px;
}

/* ---------- Preview del chat ---------- */
.chat-preview {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}

.chat-preview:active {
  transform: scale(0.98);
  background: var(--bg-elevated);
}

.chat-preview-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent-active-bg);
  color: var(--accent-active);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-preview-content {
  flex: 1;
  min-width: 0;
}

.chat-preview-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.chat-preview-text {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-preview-arrow {
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
}

/* ---------- Botón principal de acción ---------- */
.primary-action-wrap {
  position: sticky;
  bottom: 90px;
  margin-top: var(--space-5);
  z-index: 50;
}

.primary-action {
  width: 100%;
  min-height: 64px;
  border-radius: var(--radius-md);
  background: var(--accent-action);
  color: #1A120B;
  border: none;
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--dur-fast) var(--ease-out);
}

.primary-action:active {
  transform: scale(0.98);
}

.primary-action i {
  font-size: 22px;
}

.primary-action.flip-out {
  animation: flipOut var(--dur-base) var(--ease-in-out);
}

.primary-action.flip-in {
  animation: flipIn var(--dur-base) var(--ease-in-out);
}

@keyframes flipOut {
  from { transform: rotateX(0deg); }
  to { transform: rotateX(90deg); }
}

@keyframes flipIn {
  from { transform: rotateX(90deg); }
  to { transform: rotateX(0deg); }
}

/* ============================================================================
   19. CHAT CON PLANTILLAS
   ============================================================================ */
.chat-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.chat-header-back {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1.5px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease-out);
}

.chat-header-back:active {
  transform: scale(0.94);
  background: var(--bg-elevated);
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-header-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.chat-header-status {
  font-size: 12px;
  color: var(--accent-online);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ---------- Área de mensajes ---------- */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  margin-bottom: var(--space-4);
  max-height: 50vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: messageIn var(--dur-base) var(--ease-out);
}

.chat-message.incoming {
  align-self: flex-start;
}

.chat-message.outgoing {
  align-self: flex-end;
  align-items: flex-end;
}

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

.chat-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-message.incoming .chat-bubble {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.chat-message.outgoing .chat-bubble {
  background: var(--accent-action);
  color: #1A120B;
  font-weight: 600;
}

.chat-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 var(--space-2);
}

/* ---------- Indicador de escritura ---------- */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  width: fit-content;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  animation: typingBounce 1.4s infinite;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Plantillas rápidas ---------- */
.templates-section {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.templates-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.templates-manage {
  font-size: 11px;
  color: var(--accent-active);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  background: none;
  border: none;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease-out);
}

.templates-manage:active {
  background: var(--bg-elevated);
}

.templates-scroll {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.templates-scroll::-webkit-scrollbar {
  display: none;
}

.template-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  position: relative;
}

.template-chip:active {
  transform: scale(0.95);
  background: var(--accent-active-bg);
  border-color: var(--accent-active-border);
  color: var(--accent-active);
}

.template-chip i {
  font-size: 14px;
  color: var(--text-muted);
}

.template-chip:active i {
  color: var(--accent-active);
}

/* ---------- Input de mensaje ---------- */
.chat-input-wrap {
  display: flex;
  gap: var(--space-2);
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  min-height: 52px;
  max-height: 120px;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  resize: none;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.chat-input:focus {
  border-color: var(--accent-active-border);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--accent-action);
  color: #1A120B;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease-out);
}

.chat-send:active {
  transform: scale(0.94);
}

.chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================================
   20. MODAL DE VALORACIÓN
   ============================================================================ */
.rating-modal .modal-title {
  color: var(--accent-online);
}

.rating-stars {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
}

.rating-star {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
}

.rating-star:active {
  transform: scale(0.88);
}

.rating-star.active {
  color: var(--accent-active);
}

.rating-star.active i {
  animation: starPop var(--dur-base) var(--ease-out);
}

@keyframes starPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3) rotate(-8deg); }
  100% { transform: scale(1); }
}

.rating-note {
  width: 100%;
  min-height: 80px;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  margin-bottom: var(--space-5);
}

.rating-note:focus {
  border-color: var(--accent-active-border);
}

/* ============================================================================
   21. REDUCED MOTION
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}