.productos-lista {
    display: flex;
    flex-wrap: wrap;
    gap: 0px;
    padding: 10px;
    box-sizing: border-box;
    justify-content: flex-start;
}

.producto-col {
    flex: 0 0 calc((100% / 3));
    box-sizing: border-box;
    padding: 5px;
}

/* Tablets: 2 columnas */
@media (max-width: 900px) {
    .producto-col {
        flex: 0 0 calc((100% / 2));
    }
}

/* Móviles: 1 columna */
@media (max-width: 600px) {
    .producto-col {
        flex: 0 0 100%;
    }
}




/* ------------------------------
   TARJETA DE PRODUCTO
------------------------------ */
.producto-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    padding: 10px;
    text-align: center;
    transition: transform 0.2s ease;

}

.producto-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

/* ------------------------------
   IMAGEN DEL PRODUCTO
------------------------------ */
.img-container {
    width: 100%;
    height: 100px;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
}

.img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* ------------------------------
   CONTENIDO: NOMBRE, CATEGORÍA, CÓDIGO, PRECIO
------------------------------ */
.caption {
    flex: 1 1 auto;
    padding: 10px 5px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.caption h4 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 4px 0;
    text-align: center;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.caption .badge {
    max-width: 100%;
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.codigo-barra {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    letter-spacing: 2px;
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 6px 10px;
    margin: 6px 0;
    display: inline-block;
    user-select: all;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);

    white-space: nowrap;
    /* evitar salto de línea */
    overflow: hidden;
    /* ocultar texto que desborda */
    text-overflow: ellipsis;
    /* mostrar "..." */
    max-width: 100%;
    /* máximo ancho */

    transition: background-color 0.3s ease;
}

.codigo-barra:hover {
    background-color: #e1e1e1;
    cursor: text;
}


.price-tag {
    color: #343a40;
    /* Color oscuro y elegante */
    font-weight: 900;
    /* Negrita extra */
    font-size: 2rem;
    /* Texto grande y llamativo */
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    /* Sombra suave para resaltar */
    letter-spacing: 0.05em;
    /* Espacio entre letras para mejor legibilidad */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Fuente moderna */
    user-select: none;
    cursor: default;
    display: inline-block;
}



/* ------------------------------
   PIE DE LA TARJETA: BOTÓN AGREGAR
------------------------------ */
.producto-footer {
    margin-top: auto;
    padding-top: 10px;
}

.btn-cart {
    background-color: #8bc34a;
    color: white;
    border: none;
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    transition: background 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1px;
}

.btn-cart:hover {
    background-color: #689f38;
}

.btn-cart i {
    font-size: 18px;
}

/* ------------------------------
   RESPONSIVE (DESBLOQUEO EN MÓVIL)
------------------------------ */
@media (max-width: 575.98px) {
    .producto-col {
        max-width: 100%;
    }

    .caption h4 {
        white-space: normal;
    }

    .producto-card {
        min-height: auto;
    }
}

/* Contenedor con sombra y scroll vertical */
.tabla-productos-wrapper {
    max-height: 50vh;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 8px;
    background-color: #f5fff7;
    box-shadow: 0 2px 6px rgba(0, 128, 0, 0.1);
    position: relative;
}

/* Tabla moderna */
.addproducto {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    table-layout: fixed;
    font-family: 'Segoe UI', sans-serif;
    background-color: #ffffff;
}

/* Encabezado sticky con diseño moderno */
.addproducto thead th {
    position: sticky;
    top: 0;
    background: linear-gradient(to right, #a8eec1, #d4edda);
    color: #065f46;
    font-weight: bold;
    font-size: 12px;
    border-bottom: 1px solid #91d6aa;
    text-align: center;
    vertical-align: bottom;
    z-index: 5;
}

.addproducto td,
.addproducto th {
    border: 1px solid #bde5c8;
    text-align: center;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-wrap: break-word;
    font-size: 12px;
    color: #333;
}

/* Hover atractivo */
.addproducto tbody tr:hover {
    background-color: #e6f9ec;
    transition: background-color 0.3s ease;
}

/* Input moderno */
.addproducto input[type="number"] {
    width: 100%;
    padding: 6px 6px;
    font-size: 12px;
    border: 1px solid #b1dfbb;
    border-radius: 6px;
    text-align: center;
    background-color: #f0fcf5;
    transition: border-color 0.3s;
}

.addproducto input[type="number"]:focus {
    border-color: #28a745;
    outline: none;
}

/* Botones de acción */
.addproducto .btn {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
}

.addproducto .btn-danger {
    background-color: #ffccd5;
    border-color: #f8a5b2;
    color: #721c24;
}

.addproducto .btn-danger:hover {
    background-color: #f99fae;
    color: #fff;
}

/* Contenedor con scroll horizontal si es tabla clásica */
.tabla-productos-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tabla base para PC */
.tabla-totales {
    width: 100%;
    border-collapse: collapse;
    background-color: #f9fef9;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    font-size: 13px;
    margin-top: 10px;
    overflow: hidden;
}

/* Encabezados */
.tabla-totales th {
    background: linear-gradient(to right, #a8eec1, #d4edda);
    color: #065f46;
    font-size: 14px;
    padding: 10px;
    text-align: center;
    white-space: nowrap;
}

/* Celdas */
.tabla-totales td {
    padding: 8px 10px;
    border-top: 1px solid #c3e6cb;
    font-size: 13px;
    vertical-align: middle;
}

/* Inputs en tabla */
.tabla-totales input[type="text"] {
    width: 100%;
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    background-color: #ffffff;
    text-align: right;
    font-size: 13px;
}

/* Fila de mensaje vacío */
.mensaje-vacio td {
    font-style: italic;
    color: #6c757d;
    background-color: #f1fdf4;
    text-align: center;
    padding: 15px;
    font-size: 18px;
}

/* Responsive estilo tarjeta para móviles */
@media (max-width: 767.98px) {

    .tabla-totales,
    .tabla-totales thead,
    .tabla-totales tbody,
    .tabla-totales th,
    .tabla-totales td,
    .tabla-totales tr {
        display: block;
        width: 100%;
    }

    .tabla-totales thead {
        display: none;
        /* Oculta encabezados en móvil */
    }

    .tabla-totales tr {
        margin-bottom: 15px;
        border: 1px solid #d4edda;
        border-radius: 6px;
        background-color: #ffffff;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        padding: 10px;
    }

    .tabla-totales td {
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px;
        font-size: 13px;
        border-bottom: 1px solid #eee;
        position: relative;
    }

    .tabla-totales td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #333;
        flex: 1;
        text-align: left;
        padding-right: 10px;
        white-space: nowrap;
    }

    .tabla-totales td:last-child {
        border-bottom: none;
    }

    .tabla-totales input[type="text"] {
        font-size: 13px;
    }

    .mensaje-vacio td {
        font-size: 16px;
        padding: 12px;
    }
}


/* MODAL lateral por defecto */
.left-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 50vw !important;
    height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff;
    box-shadow: 6px 0 25px rgba(0, 0, 0, 0.3);
    border-radius: 0 10px 10px 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #222;
}

/* Contenedor principal del modal */
.left-modal .modal-content {
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    overflow: hidden;
}

/* Header del modal */
.left-modal .modal-header {
    flex-shrink: 0;
    padding: 15px 20px;
    background: #007bff;
    color: white;
    border-bottom: 1px solid #ccc;
}

/* Cuerpo del modal, se hace scroll solo aquí en móvil */
.left-modal .modal-body {
    flex: 1 1 auto;
    overflow: visible;
    padding: 20px 30px;
    background: #fafafa;
}

/* Footer SIEMPRE pegado abajo */
.left-modal .modal-footer {
    flex-shrink: 0;
    padding: 10px 20px;
    background: #f1f1f1;
    border-top: 1px solid #ccc;
}

/* Scroll SOLO en productos-list (solo en desktop) */
#productos-list {
    max-height: 80vh;
    overflow-y: auto;
    scroll-behavior: smooth;

    scrollbar-width: thin;
    scrollbar-color: #666 #f0f0f0;
}

#productos-list::-webkit-scrollbar {
    width: 10px;
}

#productos-list::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 5px;
}

#productos-list::-webkit-scrollbar-thumb {
    background-color: #666;
    border-radius: 5px;
    border: 2px solid #f0f0f0;
}

/* Animación de entrada */
@keyframes slideInBounce {
    0% {
        transform: translateX(-120%);
        opacity: 0;
    }

    60% {
        transform: translateX(20%);
        opacity: 1;
    }

    80% {
        transform: translateX(-10%);
    }

    100% {
        transform: translateX(0);
    }
}

/* Animación de salida */
.left-modal.slide-out-left {
    animation: slideOutLeft 0.4s ease forwards;
}

@keyframes slideOutLeft {
    0% {
        transform: translateX(0);
        opacity: 1;
    }

    100% {
        transform: translateX(-120%);
        opacity: 0;
    }
}

/* Mobile: modal a pantalla completa con scroll normal */
@media (max-width: 767.98px) {
    .left-modal {
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        animation: none !important;
    }

    .left-modal .modal-content {
        height: 100vh !important;
        flex-direction: column;
    }

    .left-modal .modal-body {
        overflow-y: auto !important;
    }

    #productos-list {
        max-height: none !important;
        overflow-y: visible !important;
    }
}