
/* ============================================
   BASECORTEPVB - CATÁLOGO SAP
   Diseño independiente del código PHP
   ============================================ */

/* CONTENEDOR PRINCIPAL */

.catalogo-contenedor {
    width: 100%;
    max-width: 1500px;
    margin: 25px auto;
    padding: 0 22px 30px;
    box-sizing: border-box;
}

.catalogo-contenedor h1 {
    margin: 8px 0;
    color: #18364f;
    font-size: 30px;
}

.catalogo-contenedor .subtitulo {
    margin-top: 8px;
    margin-bottom: 20px;
    color: #687b8e;
    font-size: 14px;
    line-height: 1.5;
}

/* BUSCADOR */

.catalogo-buscador {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 16px;
}

.catalogo-buscador input {
    flex: 1;
    min-width: 220px;
    height: 42px;
    padding: 10px 13px;
    background: #ffffff;
    border: 1px solid #cbd5df;
    border-radius: 8px;
    color: #263746;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.catalogo-buscador input:focus {
    border-color: #1b4965;
    box-shadow: 0 0 0 3px rgba(27, 73, 101, 0.12);
}

.catalogo-buscador button,
.catalogo-buscador a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 15px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.btn-buscar {
    background: #1b4965;
    color: #ffffff;
    border: 1px solid #1b4965;
}

.btn-buscar:hover {
    background: #12354b;
}

.btn-limpiar {
    background: #e9eef3;
    color: #263746;
    border: 1px solid #d4dde6;
}

.btn-limpiar:hover {
    background: #dce5ed;
}

/* RESUMEN */

.catalogo-resumen {
    margin: 15px 0 12px;
    color: #536678;
    font-size: 13px;
}

.catalogo-resumen strong {
    color: #18364f;
}

/* ============================================
   TABLA COMPACTA
   ============================================ */

.tabla-contenedor {
    width: 100%;
    max-height: 70vh;
    overflow: auto;
    background: #ffffff;
    border: 1px solid #dce4ec;
    border-radius: 9px;
    box-shadow: 0 3px 12px rgba(25, 48, 68, 0.05);
    box-sizing: border-box;
}

.tabla-catalogo {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 10px;
    color: #293b4a;
}

/* ENCABEZADOS */

.tabla-catalogo thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 9px 4px;
    background: #1b4965;
    color: #ffffff;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    border-bottom: 1px solid #12354b;
}

/* CELDAS */

.tabla-catalogo tbody td {
    padding: 8px 4px;
    border-bottom: 1px solid #e8edf2;
    text-align: center;
    vertical-align: middle;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: 10px;
    line-height: 1.35;
}

.tabla-catalogo tbody tr:nth-child(even) {
    background: #f7f9fb;
}

.tabla-catalogo tbody tr:hover {
    background: #edf4f8;
}

.tabla-catalogo tbody tr:last-child td {
    border-bottom: none;
}

/* COLUMNA DE ACCIONES */

.tabla-catalogo th.columna-acciones {
    width: 118px;
}

.tabla-catalogo td.acciones-fila {
    padding: 5px 3px;
}

.acciones-fila {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
}

/* BOTONES EDITAR Y ELIMINAR */

.btn-editar,
.btn-eliminar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 7px;
    border: none;
    border-radius: 5px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-editar {
    background: #f0bd59;
    color: #3b2b0b;
}

.btn-editar:hover {
    background: #e6a82e;
}

.btn-eliminar {
    background: #b83232;
    color: #ffffff;
}

.btn-eliminar:hover {
    background: #922626;
}

/* MENSAJES */

.sin-registros {
    padding: 22px 12px !important;
    text-align: center;
    color: #687b8e;
    font-size: 13px !important;
}

.mensaje-error {
    margin: 20px 0;
    padding: 14px;
    background: #fff0f0;
    border: 1px solid #f1caca;
    border-radius: 8px;
    color: #9f2525;
    font-size: 13px;
    line-height: 1.5;
}

.nota-tabla {
    margin-top: 9px;
    color: #758494;
    font-size: 11px;
}

/* ============================================
   TABLET
   ============================================ */

@media (max-width: 1000px) {
    .catalogo-contenedor {
        padding-right: 15px;
        padding-left: 15px;
    }

    .tabla-catalogo {
        font-size: 9px;
    }

    .tabla-catalogo thead th {
        padding: 7px 3px;
        font-size: 9px;
    }

    .tabla-catalogo tbody td {
        padding: 6px 3px;
        font-size: 9px;
    }

    .btn-editar,
    .btn-eliminar {
        padding: 5px;
        font-size: 9px;
    }
}

/* ============================================
   CELULAR
   ============================================ */

@media (max-width: 700px) {
    .catalogo-contenedor {
        margin-top: 20px;
        padding: 0 12px 22px;
    }

    .catalogo-contenedor h1 {
        font-size: 24px;
    }

    .catalogo-buscador {
        align-items: stretch;
        flex-direction: column;
    }

    .catalogo-buscador input {
        width: 100%;
        min-width: 0;
    }

    .catalogo-buscador button,
    .catalogo-buscador a {
        width: 100%;
    }

    .tabla-contenedor {
        max-height: 65vh;
    }

    .tabla-catalogo {
        font-size: 9px;
    }

    .tabla-catalogo thead th {
        padding: 6px 2px;
        font-size: 8px;
    }

    .tabla-catalogo tbody td {
        padding: 5px 2px;
        font-size: 8px;
    }

    .btn-editar,
    .btn-eliminar {
        padding: 5px 4px;
        font-size: 8px;
    }
}

/* =========================================
   FORMULARIO DE EDICIÓN DEL CATÁLOGO SAP
========================================= */

.formulario-edicion {
    margin: 24px 0;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #d8e1e9;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(20, 48, 70, 0.06);
}

.titulo-edicion {
    margin-bottom: 22px;
}

.titulo-edicion h2 {
    margin: 5px 0;
    color: #193b55;
    font-size: 25px;
}

.titulo-edicion p {
    color: #687b8d;
}

.campos-edicion {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.campo-edicion {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 7px;
}

.campo-edicion label {
    color: #24445c;
    font-size: 13px;
    font-weight: 700;
}

.campo-edicion input,
.campo-edicion select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #cbd7e1;
    border-radius: 7px;
    background: #ffffff;
    color: #253746;
    font: inherit;
    font-size: 14px;
}

.campo-edicion input:focus,
.campo-edicion select:focus {
    outline: none;
    border-color: #20516c;
    box-shadow: 0 0 0 3px rgba(32, 81, 108, 0.12);
}

.campo-ancho-completo {
    grid-column: 1 / -1;
}

.botones-edicion {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.btn-guardar-edicion,
.btn-cancelar-edicion {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 18px;
    border: 0;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.btn-guardar-edicion {
    background: #20516c;
    color: #ffffff;
}

.btn-guardar-edicion:hover {
    background: #163d53;
}

.btn-cancelar-edicion {
    background: #e9eef3;
    color: #263d50;
}

.btn-cancelar-edicion:hover {
    background: #dbe4ec;
}

.mensaje-exito,
.mensaje-error {
    margin: 18px 0;
    padding: 13px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.mensaje-exito {
    color: #17613b;
    background: #e8f6ee;
    border: 1px solid #b8e2c8;
}

.mensaje-error {
    color: #8a2525;
    background: #fff0f0;
    border: 1px solid #efc4c4;
}

/* Botones de las filas */
.acciones-fila {
    min-width: 100px;
    white-space: nowrap;
    text-align: center;
}

.acciones-fila .btn-editar,
.acciones-fila .btn-eliminar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 2px;
    padding: 7px 10px;
    border: 0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.acciones-fila .btn-editar {
    background: #f2bd4b;
    color: #30240b;
}

.acciones-fila .btn-editar:hover {
    background: #e3a92f;
}

.acciones-fila .btn-eliminar {
    background: #bd3030;
    color: #ffffff;
}

.acciones-fila .btn-eliminar:hover {
    background: #982424;
}

/* =========================================
   RESPONSIVE
========================================= */

@media (max-width: 900px) {
    .campos-edicion {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .formulario-edicion {
        padding: 16px;
    }

    .campos-edicion {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .campo-ancho-completo {
        grid-column: auto;
    }

    .botones-edicion {
        flex-direction: column;
    }

    .btn-guardar-edicion,
    .btn-cancelar-edicion {
        width: 100%;
        box-sizing: border-box;
    }
}

/* ==========================================
   CATÁLOGO SAP: VISTA PARA CELULARES
   ========================================== */

@media (max-width: 600px) {

    .catalogo-contenedor {
        width: 100%;
        max-width: 100%;
        padding: 12px;
        margin: 0 auto;
        overflow: visible;
    }

    .catalogo-contenedor h1 {
        font-size: 27px;
        line-height: 1.2;
    }

    .catalogo-contenedor .subtitulo {
        font-size: 14px;
        line-height: 1.5;
    }

    .catalogo-buscador {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .catalogo-buscador input,
    .catalogo-buscador button {
        width: 100%;
        max-width: 100%;
        min-height: 44px;
        box-sizing: border-box;
    }

    .catalogo-resumen {
        font-size: 14px;
        margin: 16px 0;
    }

    /* Tabla con desplazamiento horizontal controlado */
    .tabla-contenedor {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
    }

    .tabla-contenedor table {
        min-width: 1100px;
        width: max-content;
        border-collapse: collapse;
        font-size: 12px;
    }

    .tabla-contenedor th,
    .tabla-contenedor td {
        padding: 10px 8px;
        white-space: normal;
        overflow-wrap: anywhere;
        vertical-align: middle;
        line-height: 1.35;
    }

    .tabla-contenedor th {
        min-width: 65px;
        font-size: 11px;
    }

    .tabla-contenedor td {
        max-width: 150px;
    }

    .tabla-contenedor td:last-child {
        min-width: 90px;
        white-space: normal;
    }

    .tabla-contenedor td button,
    .tabla-contenedor td a {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        margin: 3px 0;
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
    }
}

