:root {
    --petrol: #0F5C5C;
    --petrol-oscuro: #0A3D3D;
    --petrol-claro: #3D8B8B;
    --amber: #F5A623;
    --amber-oscuro: #D6890C;
    --crema: #FAF8F5;
    --tinta: #17211F;
    --gris: #6B7674;
    --linea: #E4E0D8;
    --exito: #2F9E44;
    --peligro: #E03131;
    --radio: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--tinta);
    background: var(--crema);
    overscroll-behavior: none;
}

h1, h2, .costo-numero, .estado-titulo, .marca {
    font-family: 'Space Grotesk', sans-serif;
}

.oculto { display: none !important; }

.pantalla {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
}

/* ---- Splash ---- */
.splash {
    background: var(--petrol);
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.marca { color: white; font-size: 22px; font-weight: 500; letter-spacing: 0.3px; }
.marca strong { font-weight: 700; }
.linea-animada {
    stroke-dashoffset: 0;
    animation: recorrer 2.4s linear infinite;
}
@keyframes recorrer { to { stroke-dashoffset: -24; } }

/* ---- Auth ---- */
#pantalla-auth { justify-content: center; align-items: center; padding: 24px; background: var(--crema); }
.auth-contenedor { width: 100%; max-width: 380px; text-align: center; }
.auth-contenedor h1 { font-size: 26px; margin: 16px 0 2px; color: var(--petrol-oscuro); font-weight: 500; }
.auth-contenedor h1 strong { font-weight: 700; }
.subtitulo { color: var(--gris); margin: 0 0 24px; font-size: 14px; }

.auth-tabs {
    display: flex;
    background: white;
    border-radius: 999px;
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--linea);
}
.auth-tab {
    flex: 1;
    border: none;
    background: none;
    padding: 10px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--gris);
    cursor: pointer;
}
.auth-tab.activo { background: var(--petrol); color: white; }

.auth-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.auth-form input {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--linea);
    font-size: 15px;
    font-family: inherit;
    background: white;
}
.auth-form input:focus { outline: 2px solid var(--petrol-claro); outline-offset: -1px; }

.btn {
    padding: 15px;
    border-radius: 14px;
    border: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}
.btn-primario { background: var(--amber); color: var(--petrol-oscuro); margin-top: 6px; }
.btn-primario:disabled { background: #E8E3D9; color: var(--gris); cursor: not-allowed; }
.btn-primario:not(:disabled):active { transform: scale(0.98); }
.btn-texto { background: none; color: var(--petrol); padding: 12px; }
.btn-cancelar-texto { color: var(--peligro); }
.error { color: var(--peligro); font-size: 13px; margin-top: 10px; min-height: 16px; }
.muted { color: var(--gris); }

/* ---- Mapa ---- */
.mapa { flex: 1; width: 100%; z-index: 1; }
.mapa-chica { flex: 0 0 40%; }

.panel-inferior {
    background: white;
    border-radius: 24px 24px 0 0;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
    position: relative;
    z-index: 2;
}

/* ---- Campos de dirección (estilo "ruta") ---- */
.campo-direccion {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 4px;
    border-bottom: 1px solid var(--linea);
}
.campo-direccion:last-of-type { border-bottom: none; }
.punto { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.punto-origen { background: var(--petrol); }
.punto-destino { width: 10px; height: 10px; background: var(--amber); border-radius: 3px; }
.campo-direccion input {
    border: none;
    outline: none;
    font-size: 15px;
    font-family: inherit;
    width: 100%;
    background: none;
}

.sugerencias {
    background: white;
    border: 1px solid var(--linea);
    border-radius: 12px;
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
}
.sugerencia-item {
    padding: 12px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--linea);
    cursor: pointer;
}
.sugerencia-item:last-child { border-bottom: none; }
.sugerencia-item:active { background: var(--crema); }

#btn-ver-costo { margin-top: 16px; }

.reintentar-ubicacion { font-size: 12.5px; color: var(--peligro); margin: 0 0 8px 4px; }
.reintentar-ubicacion button {
    background: none; border: none; color: var(--petrol);
    font-weight: 700; text-decoration: underline; cursor: pointer; font-size: 12.5px; padding: 0;
}

/* ---- Confirmar ---- */
.resumen-ruta { display: flex; gap: 24px; margin-bottom: 16px; }
.resumen-fila { display: flex; flex-direction: column; gap: 2px; }
.resumen-fila span { font-size: 12px; color: var(--gris); }
.resumen-fila strong { font-size: 16px; }

.costo-destacado {
    background: var(--petrol);
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
}
.costo-label { color: rgba(255,255,255,0.7); font-size: 13px; }
.costo-numero { color: white; font-size: 34px; font-weight: 700; }

/* ---- Botón flotante ---- */
.btn-flotante-esquina {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top));
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 18px;
    z-index: 5;
    cursor: pointer;
}

/* ---- Estado del viaje ---- */
.panel-viaje { padding-top: 24px; }
.estado-viaje { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.estado-icono {
    width: 48px; height: 48px;
    background: var(--crema);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.estado-titulo { margin: 0; font-size: 17px; font-weight: 600; }
.estado-subtitulo { margin: 2px 0 0; font-size: 13px; color: var(--gris); }

.tarjeta-chofer {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--crema);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}
.chofer-avatar {
    width: 44px; height: 44px;
    background: var(--petrol);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.chofer-info { display: flex; flex-direction: column; flex: 1; gap: 2px; }
.chofer-info strong { font-size: 15px; }
.chofer-info span { font-size: 13px; color: var(--gris); }
.chofer-rating { color: var(--amber-oscuro) !important; font-weight: 600; }
.btn-llamar {
    width: 40px; height: 40px;
    background: var(--exito);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    font-size: 16px;
}

/* ---- Finalizado ---- */
#pantalla-finalizado { justify-content: center; align-items: center; padding: 24px; background: var(--crema); }
.finalizado-contenedor { text-align: center; max-width: 340px; width: 100%; }
.check-circulo {
    width: 72px; height: 72px;
    background: var(--exito);
    color: white;
    border-radius: 50%;
    font-size: 32px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}
.finalizado-contenedor h2 { margin: 0 0 4px; }
.finalizado-contenedor .costo-destacado { margin: 20px 0; }
.pago-estado { font-size: 13.5px; color: var(--gris); margin: -6px 0 14px; }
#btn-pagar-viaje { margin-bottom: 10px; }

.bloque-calificar {
    background: var(--crema);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 16px;
    text-align: left;
}
.calificar-titulo { font-size: 14px; font-weight: 600; margin: 0 0 12px; text-align: center; }
.estrellas { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.estrella {
    background: none;
    border: none;
    font-size: 32px;
    color: #D8D3C8;
    cursor: pointer;
    line-height: 1;
    padding: 2px;
    transition: color 0.15s ease;
}
.estrella.activa { color: var(--amber); }
.bloque-calificar textarea {
    width: 100%;
    border: 1px solid var(--linea);
    border-radius: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    margin-bottom: 10px;
    background: white;
}
.bloque-calificar .btn { margin: 0; }
.calificacion-enviada { text-align: center; color: var(--exito); font-weight: 600; font-size: 14px; margin: 0 0 16px; }

/* ---- Modal cuenta ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: flex-end; z-index: 200; }
.modal-box { background: white; width: 100%; border-radius: 24px 24px 0 0; padding: 24px; text-align: center; }
.menu-nombre { font-size: 17px; font-weight: 700; margin: 8px 0 0; }
.menu-email { font-size: 13px; margin: 2px 0 20px; }

/* ---- Marcadores Leaflet custom ---- */
.marcador-chofer {
    background: var(--petrol);
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.marcador-destino-pin {
    width: 22px; height: 22px;
    background: var(--amber);
    border: 3px solid white;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ---- Ayuda para tocar el mapa ---- */
.hint-mapa {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    background: rgba(23,33,31,0.85);
    color: white;
    font-size: 12.5px;
    padding: 8px 14px;
    border-radius: 999px;
    z-index: 5;
    pointer-events: none;
    white-space: nowrap;
}

@media (min-width: 480px) {
    #pantalla-auth, #pantalla-finalizado { background: var(--crema); }
}
