/* =====================================================================
   RemisOnline - estilos compartidos por TODAS las pantallas
   1) Esquinas rectas en toda la app (nada de bordes redondeados)
   2) Diseño adaptable (responsive):
        - Celular: pantalla completa, una columna
        - Tablet vertical: una columna centrada
        - PC / tablet horizontal / celular horizontal: dos columnas (mapa grande + panel)
   Para cambiar algo de aspecto en toda la app, se edita SOLO este archivo.
   ===================================================================== */


/* ---------- MAPA EN MODO BLACK ---------- */
/* El proveedor NO cambia (siguen siendo los mosaicos de OpenStreetMap): solo se oscurece cómo se ven.
   El filtro actúa únicamente sobre la capa de mosaicos: la ruta, los autos y los marcadores conservan sus colores.
   Terreno casi negro, etiquetas claras y calles en gris. Para más/menos oscuridad, ajustar el último brightness(). */
.mapa-modo-oscuro-osm {
    filter: brightness(0.69) invert(1) contrast(3) hue-rotate(185deg) saturate(0.2) brightness(0.8) !important;
}
.leaflet-container { background: #050505 !important; }
.leaflet-control-attribution { background: rgba(0, 0, 0, .72) !important; color: #94a3b8 !important; }
.leaflet-control-attribution a { color: #818cf8 !important; }
.leaflet-bar a, .leaflet-bar a:hover { background: #0b0b0f !important; color: #e2e8f0 !important; border-bottom-color: #27272a !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #0b0b0f !important; color: #e2e8f0 !important; }


/* ---------- 1) ESQUINAS RECTAS ---------- */
*, *::before, *::after { border-radius: 0 !important; }
/* Elementos internos del navegador que la regla anterior no alcanza (botón de "elegir archivo", barras de desplazamiento) */
::file-selector-button, ::-webkit-file-upload-button { border-radius: 0 !important; }
::-webkit-scrollbar, ::-webkit-scrollbar-thumb, ::-webkit-scrollbar-track { border-radius: 0 !important; }


/* ---------- 2) BASE ADAPTABLE ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    min-height: 100vh;
    min-height: 100dvh;            /* altura real visible en celulares (sin contar la barra del navegador) */
    overflow-x: hidden;            /* nunca scroll horizontal */
}

button, a, select, input, textarea, label { touch-action: manipulation; }

/* En celulares, los campos de 16px evitan que iPhone amplíe la pantalla al tocarlos */
@media (max-width: 768px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]),
    select, textarea { font-size: 16px !important; }
}

/* Correos, nombres y direcciones largos: se parten en vez de ensanchar la pantalla */
h1, h2, h3, h4, p, span, a, label, td, th, li, button { overflow-wrap: anywhere; }

/* Botones principales: tamaño cómodo para el dedo */
button.w-full { min-height: 44px; }

/* Textos diminutos: se agrandan un poco para que se lean bien en pantallas chicas */
[class*="text-[8px]"], [class*="text-[9px]"] { font-size: 10px !important; }


/* ---------- VENTANAS (MODALES) ---------- */
/* Celular: ocupan toda la pantalla, como una pantalla propia */
@media (max-width: 640px) {
    [id^="modal-"].fixed { padding: 0 !important; align-items: stretch !important; }
    [id^="modal-"].fixed > div {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 100vh;
        min-height: 100dvh;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        border-width: 0 !important;
    }
}
/* PC: un poco más anchas para aprovechar el espacio */
@media (min-width: 1024px) {
    [id^="modal-"].fixed > .max-w-sm,
    [id^="modal-"].fixed > .max-w-md { max-width: 560px !important; }
}


/* ---------- PANEL DE ADMINISTRACIÓN ---------- */
/* En monitores grandes aprovecha el ancho */
@media (min-width: 1536px) {
    .max-w-7xl { max-width: 1760px !important; }
}


/* ---------- PANTALLAS PRINCIPALES (pasajero y chofer) ---------- */
/*  body.app-pagina  >  #tarjeta-app  >  [cabecera, avisos, .app-cuerpo > (mapa + .app-panel)]  */

/* Celular: pantalla completa, sin marcos ni márgenes */
body.app-pagina {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
}
.app-pagina #tarjeta-app {
    width: 100%;
    max-width: none !important;
    margin: 0 !important;
    min-height: 100vh;
    min-height: 100dvh;
    border: 0 !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}
.app-pagina #tarjeta-app > header {
    padding-top: calc(0.75rem + env(safe-area-inset-top));
}
.app-pagina .app-cuerpo {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.app-pagina #map-pasajero,
.app-pagina #map-chofer {
    height: 42vh !important;
    height: 42dvh !important;
    min-height: 230px !important;
}
.app-pagina .app-panel {
    margin-top: 0 !important;
    flex: 1 1 auto;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

/* Tablet vertical: una columna centrada y con aire a los costados */
@media (min-width: 700px) and (max-width: 1023px) and (orientation: portrait) {
    .app-pagina #tarjeta-app {
        max-width: 780px !important;
        margin: 0 auto !important;
        border-left: 1px solid #334155 !important;
        border-right: 1px solid #334155 !important;
    }
    .app-pagina #map-pasajero,
    .app-pagina #map-chofer { height: 46dvh !important; }
}

/* PC, tablet horizontal y celular horizontal: DOS COLUMNAS (mapa grande + panel a la derecha) */
@media (min-width: 1024px), (min-width: 700px) and (orientation: landscape) {
    body.app-pagina {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }
    .app-pagina #tarjeta-app {
        flex: 1 1 0;
        min-height: 0;
        height: 100%;
    }
    .app-pagina .app-cuerpo {
        display: grid;
        grid-template-columns: minmax(0, 1fr) clamp(340px, 38vw, 520px);
        flex: 1 1 0;
    }
    .app-pagina #map-pasajero,
    .app-pagina #map-chofer {
        height: 100% !important;
        min-height: 0 !important;
    }
    .app-pagina .app-panel {
        overflow-y: auto;
        min-height: 0;
        border-left: 1px solid #334155;
    }
}
