/*
    ====================
        Ajustes responsivos (Facturación Express / Contacto)
        Se carga después de style.css y tablas.css
    ====================
*/

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
}

.form-text,
.form-drop,
.btn-primary,
.btn-secondary,
.btn-facturar {
    box-sizing: border-box;
}

/* Contenedor principal (antes padding en línea) */
.contenido {
    padding: 30px 30px 20px 20px;
}

.separador {
    height: 50px;
}

/* Cada campo agrupa su etiqueta y su control para que no se separen al apilarse */
.campo {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.campo > .form-text,
.campo > .form-drop,
.campo > input[type="submit"] {
    margin-top: auto;
}

.campo-etiqueta {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 22px;
}

.campo-etiqueta img {
    cursor: pointer;
}

/* La tabla de tickets se desplaza horizontalmente en lugar de desbordar la página */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive .table {
    width: 100%;
}

/* Las imágenes de ayuda (Estación / Ticket) no se deforman en pantallas angostas */
.swal2-image {
    max-width: 100%;
    height: auto !important;
}

/*
    Tablet y celular horizontal: la barra lateral pasa arriba como barra horizontal
    (col-sm-1 es más angosta que los 80px de la barra por debajo de 992px)
*/
@media (max-width: 991.98px) {
    .row > .col-nav,
    .row > .col-main {
        flex: 0 0 auto;
        width: 100%;
    }

    /* Barra compacta y centrada, separada del logo y con margen a los lados */
    .sidebar-navigation {
        display: block;
        float: none;
        width: fit-content;
        max-width: calc(100% - 32px);
        min-height: 0;
        margin: 14px auto 0;
        padding: 4px 6px;
        box-sizing: border-box;
    }

    .sidebar-navigation ul {
        display: flex;
        justify-content: center;
        gap: 2px;
        margin: 0;
    }

    .sidebar-navigation ul li {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 7px 12px;
        border-radius: 8px;
    }

    .sidebar-navigation ul li svg {
        width: auto;
        height: 18px;
    }

    .sidebar-navigation ul li:empty {
        display: none;
    }

    /* En pantallas táctiles no hay hover: la etiqueta se muestra bajo el ícono */
    .sidebar-navigation ul li .tooltip {
        position: static;
        margin: 0;
        padding: 0;
        opacity: 1;
        visibility: visible;
        background: none;
        font-size: 10px;
        white-space: nowrap;
    }

    .sidebar-navigation ul li .tooltip:before {
        display: none;
    }

    .row > .campo {
        width: 50%;
        margin-bottom: 14px;
    }
}

/* Celular vertical */
@media (max-width: 575.98px) {
    .contenido {
        padding: 20px 16px;
    }

    .separador {
        height: 20px;
    }

    .contenido-contacto {
        box-sizing: border-box;
        padding: 0 16px 20px;
    }

    .labelTitulo,
    .labelBold {
        font-size: 28px;
    }

    .row > .campo {
        width: 100%;
    }

    /* Los dos botones de tickets quedan lado a lado */
    .row > .campo-boton {
        width: 50%;
        padding-right: 5px;
    }

    .row > .campo-boton + .campo-boton {
        padding-left: 5px;
        padding-right: 0;
    }

    .campo-boton .campo-etiqueta {
        display: none;
    }

    .form-text,
    .form-drop,
    .btn-primary,
    .btn-secondary,
    .btn-facturar {
        width: 100%;
        /* 16px evita que iOS haga zoom al enfocar el campo */
        font-size: 16px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-facturar {
        padding: 12px 10px;
    }

    /* Tabla de tickets como tarjetas: una por ticket, etiqueta a la izquierda y valor a la derecha */
    .tabla-tickets,
    .tabla-tickets tbody,
    .tabla-tickets tr,
    .tabla-tickets td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .tabla-tickets thead {
        display: none;
    }

    .tabla-tickets tbody tr {
        margin-bottom: 12px;
        overflow: hidden;
        border: 1px solid #E1E1E1;
        border-radius: 10px;
        background: #fff;
    }

    .table.tabla-tickets tbody tr td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 9px 14px;
        border-bottom: 1px solid #F0F0F0;
        white-space: normal;
        text-align: right;
    }

    .table.tabla-tickets tbody tr td:last-child {
        border-bottom: none;
    }

    .tabla-tickets td::before {
        content: attr(data-label);
        color: #000;
        font-family: Gilroy-Bold;
        text-align: left;
    }

    /* El número de ticket funciona como encabezado de la tarjeta */
    .table.tabla-tickets tbody tr td:first-child {
        background: #000;
        color: #fff;
    }

    .tabla-tickets td:first-child::before {
        color: #fff;
    }

    /* Si el navegador convierte un número en enlace (teléfono en iOS), conserva el color de la celda */
    .tabla-tickets td a,
    .tabla-tickets td a[x-apple-data-detectors] {
        color: inherit !important;
        text-decoration: none !important;
        font: inherit !important;
    }

    .table.tabla-tickets tbody tr td.sin-tickets {
        justify-content: center;
        text-align: center;
        background: #fff;
        color: #515365;
    }

    .tabla-tickets td.sin-tickets::before {
        content: none;
    }

    .logo {
        max-width: 70%;
    }
}
