/* Lazy loading placeholder */
.producto-imagen {
    transition: opacity 0.3s ease-in-out;
}

.producto-imagen[loading='lazy']:not([src]) {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.producto-imagen:not([src]) {
    opacity: 0;
}

.producto-imagen[src] {
    opacity: 1;
}

/* ============================================
   ENCABEZADOS FIJOS (STICKY) Y DATATABLES
   ============================================ */



/* ============================================
   ESTILOS DE PAGINACIÓN
   ============================================ */

.paginacion-wrapper {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.paginacion-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.paginacion-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.paginacion-info select {
    width: auto;
    min-width: 150px;
}

.paginacion-info span {
    color: #6c757d;
    font-size: 0.9rem;
    white-space: nowrap;
}

.paginacion-controles {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.paginacion-numeros {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.btn-page {
    min-width: 36px;
    height: 36px;
    padding: 0.375rem 0.75rem;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    transition: all 0.2s;
}

.btn-page:hover:not(.active) {
    background: #e9ecef;
    border-color: #adb5bd;
}

.btn-page.active {
    background: #0d6efd;
    color: #fff;
    border-color: #0d6efd;
    font-weight: 600;
    cursor: default;
}

.puntos {
    padding: 0 0.5rem;
    color: #6c757d;
}

/* Responsive */
@media (max-width: 768px) {
    .paginacion-container {
        flex-direction: column;
        align-items: stretch;
    }

    .paginacion-info {
        flex-direction: column;
        align-items: stretch;
    }

    .paginacion-info select {
        width: 100%;
    }

    .paginacion-controles {
        justify-content: center;
    }

    .btn-page {
        min-width: 32px;
        height: 32px;
        font-size: 0.875rem;
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 768px) {

    /* Ocultar encabezados de tabla */
    .table-inventario thead {
        display: none;
    }

    /* Card View para filas */
    .table-inventario tbody tr {
        display: block;
        background: white;
        border-radius: 12px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        margin-bottom: 15px;
        padding: 15px;
        border: 1px solid #eee;
    }

    .table-inventario tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #f9f9f9;
        text-align: right;
    }

    .table-inventario tbody td:last-child {
        border-bottom: none;
    }

    /* Labels via data-attribute */
    .table-inventario tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        text-align: left;
        margin-right: 15px;
        font-size: 0.9em;
    }

    /* Imagen adjustments for mobile */
    .table-inventario tbody td img {
        width: 60px;
        height: 60px;
        margin: 0;
    }

    /* Specific adjustments */
    td[data-label="IMAGEN"] {
        justify-content: center;
        border-bottom: 1px solid #eee;
        margin-bottom: 10px;
        padding-bottom: 15px;
    }

    td[data-label="IMAGEN"]::before {
        display: none;
    }

    /* Badge alignment */
    .badge {
        float: none;
    }
}

/* Forzar contenedor con altura fija y scroll interno permanente */
.table-responsive {
    max-height: 70vh !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    position: relative !important;
}

/* Clavar de forma nativa e indestructible los encabezados al techo del scroll interno */
.table-responsive table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.table-responsive thead th {
    position: sticky !important;
    top: 0 !important;
    background-color: #ffffff !important; /* Fondo blanco sólido para cubrir los datos al subir */
    z-index: 1100 !important;             /* Prioridad de capa por encima de filas y badges */
    box-shadow: inset 0 -1px 0 #dee2e6, 0 2px 5px rgba(0,0,0,0.05) !important; /* Línea divisoria y sombra */
}