* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* Login */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 400px;
    max-width: 90%;
}

.login-container h2,
.login-container h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #333;
}

/* Header */
.header {
    background: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background 0.3s;
}

.nav-menu a:hover {
    background: #34495e;
}

/* Main Content */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Grid de productos */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.producto-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-left: 5px solid #3498db;
}

.producto-card.bajo-stock {
    border-left-color: #e74c3c;
    background: #ffeaea;
}

.producto-card.stock-ok {
    border-left-color: #2ecc71;
}

.producto-card.sin-stock {
    border-left-color: #95a5a6;
    background: #f8f9fa;
}

.producto-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.producto-nombre {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
}

.stock-info {
    font-weight: bold;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.stock-bajo {
    background: #e74c3c;
    color: white;
}

.stock-ok {
    background: #2ecc71;
    color: white;
}


.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #3498db;
    outline: none;
}

.btn {
    background: #3498db;
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: #2980b9;
}

.btn-success {
    background: #2ecc71;
}

.btn-success:hover {
    background: #27ae60;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 2rem;
    border-bottom: 2px solid #ddd;
    flex-wrap: wrap;
}

.tab {
    padding: 1rem 2rem;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
    margin-right: 0.5rem;
    transition: background 0.3s;
}

.tab.active {
    background: #3498db;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Tabla de precios */
.precios-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.precios-table th,
.precios-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.precios-table th {
    background: #f8f9fa;
    font-weight: bold;
}

.mensaje {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

/* Estilos para el panel de administración */
.admin-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.admin-section {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #3498db;
}

.admin-section h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
    border-bottom: 2px solid #f8f9fa;
    padding-bottom: 0.5rem;
}

.lista-items {
    margin-top: 1.5rem;
}

.lista-items h4 {
    margin-bottom: 1rem;
    color: #34495e;
}

.item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border-radius: 5px;
    border-left: 3px solid #3498db;
}

.item-info {
    flex-grow: 1;
}

.item-info strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.item-info span {
    color: #7f8c8d;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.25rem;
}

.item-info small {
    color: #95a5a6;
    font-size: 0.8rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.stat-card h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    display: block;
}

/* Filtros */
.filtros {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.filtros select {
    padding: 0.7rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    background: white;
    min-width: 200px;
}

.filtros .btn {
    white-space: nowrap;
}

/* Estilos para roles y permisos */
.user-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.rol-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

.rol-lector {
    background: #95a5a6;
    color: white;
}

.rol-editor {
    background: #3498db;
    color: white;
}

.rol-admin {
    background: #e74c3c;
    color: white;
}

/* Deshabilitar elementos para lectores */
.readonly {
    opacity: 0.6;
    pointer-events: none;
}

.no-permission {
    background: #f8f9fa;
    padding: 2rem;
    text-align: center;
    font-weight: 600;
    border-bottom: 2px solid #34495e;
}

.tabla-stock td {
    padding: 1rem;
    border-bottom: 1px solid #ecf0f1;
    vertical-align: top;
}

.tabla-stock tbody tr:hover {
    background: #f8f9fa;
}

/* Estados de stock en la tabla */
.fila-bajo-stock {
    background: #ffeaea !important;
    border-left: 4px solid #e74c3c;
}

.fila-sin-stock {
    background: #f8f9fa !important;
    border-left: 4px solid #95a5a6;
}

.fila-stock-critico {
    background: #fff3e0 !important;
    border-left: 4px solid #f39c12;
}

.fila-bajo-stock:hover,
.fila-sin-stock:hover,
.fila-stock-critico:hover {
    background: #f1f1f1 !important;
}

.estado-stock {
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
}

.stock-ok {
    background: #d4edda;
    color: #155724;
}

.stock-bajo {
    background: #f8d7da;
    color: #721c24;
}

.stock-critico {
    background: #fff3cd;
    color: #856404;
}

.stock-cero {
    background: #e2e3e5;
    color: #383d41;
}

/* Textos especiales */
.texto-stock {
    font-weight: bold;
    font-size: 1.1rem;
}

.texto-caducado {
    color: #e74c3c !important;
    font-weight: bold;
}

.texto-proximo-caducar {
    color: #f39c12 !important;
    font-weight: bold;
}

/* Información del producto */
.producto-info-completa strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 0.25rem;
}

.producto-info-completa small {
    color: #7f8c8d;
    font-size: 0.8rem;
}

/* Acciones en tabla */
.acciones-tabla {
    white-space: nowrap;
}

.acciones-tabla .btn-small {
    padding: 0.3rem 0.6rem;
    margin: 0 0.1rem;
    font-size: 0.8rem;
}

/* Resumen del stock */
.resumen-stock {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.resumen-item {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    border-top: 4px solid #3498db;
}

.resumen-numero {
    font-size: 2.5rem;
    font-weight: bold;
    display: block;
    color: #2c3e50;
}

.resumen-texto {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
    display: block;
}

/* Sin productos */
.sin-productos {
    text-align: center;
    padding: 3rem;
    color: #7f8c8d;
}

.sin-productos h3 {
    margin-bottom: 1rem;
    color: #95a5a6;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-container {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .item-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .item-actions {
        align-self: flex-end;
        width: 100%;
        justify-content: flex-end;
    }

    .filtros {
        flex-direction: column;
        align-items: stretch;
    }

    .filtros select {
        min-width: auto;
    }

    .nav-menu {
        flex-direction: column;
        gap: 1rem;
    }

    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .tabs {
        flex-direction: column;
    }

    .tab {
        margin-right: 0;
        margin-bottom: 0.5rem;
        border-radius: 5px;
    }

    .tabla-container {
        overflow-x: auto;
    }

    .tabla-stock {
        min-width: 800px;
    }

    .resumen-stock {
        grid-template-columns: 1fr 1fr;
    }

    .acciones-tabla {
        white-space: normal;
    }

    .acciones-tabla .btn-small {
        margin-bottom: 0.2rem;
    }
}

/* Estilos para el modal de edición */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #ecf0f1;
    background: #f8f9fa;
    border-radius: 10px 10px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.btn-cerrar {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-cerrar:hover {
    color: #e74c3c;
    background: #f8f9fa;
    border-radius: 50%;
}

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

/* Form row para inputs en línea */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Responsive para el modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

/* Estilos para la sección de precios */
.precios-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.precios-section {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.precios-lista {
    margin-top: 1.5rem;
}

/* Logos de supermercados */
.logo-supermercado {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.supermercado-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tabla de precios */
.tabla-precios {
    width: 100%;
    border-collapse: collapse;
}

.tabla-precios th,
.tabla-precios td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.tabla-precios th {
    background: #2c3e50;
    color: white;
    font-weight: 600;
}

.precio-valor-tabla {
    font-weight: bold;
    color: #27ae60;
    font-size: 1.1rem;
}

.fecha-precio-tabla {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.acciones-precios {
    white-space: nowrap;
}

/* Tabla comparativa */
.tabla-comparativa {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tabla-comparativa th,
.tabla-comparativa td {
    padding: 0.8rem;
    text-align: center;
    border: 1px solid #ecf0f1;
}

.tabla-comparativa th {
    background: #34495e;
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

.tabla-comparativa td {
    background: white;
}

.precio-cell {
    position: relative;
    min-width: 100px;
}

.precio-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.precio-valor {
    font-weight: bold;
    font-size: 1rem;
}

.fecha-precio {
    font-size: 0.7rem;
    color: #7f8c8d;
}

.mejor-precio {
    background: #d4edda !important;
    border: 2px solid #27ae60;
}

.mejor-precio-total {
    font-weight: bold;
    color: #27ae60;
    font-size: 1.1rem;
}

.diferencia-precio {
    font-weight: bold;
}

.diferencia-alta {
    color: #e74c3c;
}

.sin-precio {
    background: #f8f9fa;
}

.sin-precio-text {
    color: #95a5a6;
    font-style: italic;
}

/* Filtros comparativa */
.filtros-comparativa {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

/* Estados sin datos */
.sin-datos {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
    font-style: italic;
}

/* Form actions */
.form-actions {
    .modal-actions {
        display: flex;
        gap: 1rem;
        justify-content: flex-end;
        margin-top: 2rem;
        padding-top: 1rem;
        border-top: 1px solid #ecf0f1;
    }

    /* Form row para inputs en línea */
    .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    /* Responsive para el modal */
    @media (max-width: 768px) {
        .modal-content {
            width: 95%;
            margin: 1rem;
        }

        .form-row {
            grid-template-columns: 1fr;
        }

        .modal-actions {
            flex-direction: column;
        }

        .modal-actions .btn {
            width: 100%;
        }
    }

    /* Estilos para la sección de precios */
    .precios-container {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .precios-section {
        background: white;
        padding: 1.5rem;
        border-radius: 10px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

    .precios-lista {
        margin-top: 1.5rem;
    }

    /* Logos de supermercados */
    .logo-supermercado {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        margin-right: 0.5rem;
        vertical-align: middle;
    }

    .supermercado-info {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    /* Tabla de precios */
    .tabla-precios {
        width: 100%;
        border-collapse: collapse;
    }

    .tabla-precios th,
    .tabla-precios td {
        padding: 1rem;
        text-align: left;
        border-bottom: 1px solid #ecf0f1;
    }

    .tabla-precios th {
        background: #2c3e50;
        color: white;
        font-weight: 600;
    }

    .precio-valor-tabla {
        font-weight: bold;
        color: #27ae60;
        font-size: 1.1rem;
    }

    .fecha-precio-tabla {
        color: #7f8c8d;
        font-size: 0.9rem;
    }

    .acciones-precios {
        white-space: nowrap;
    }

    /* Tabla comparativa */
    .tabla-comparativa {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.9rem;
    }

    .tabla-comparativa th,
    .tabla-comparativa td {
        padding: 0.8rem;
        text-align: center;
        border: 1px solid #ecf0f1;
    }

    .tabla-comparativa th {
        background: #34495e;
        color: white;
        font-weight: 600;
        white-space: nowrap;
    }

    .tabla-comparativa td {
        background: white;
    }

    .precio-cell {
        position: relative;
        min-width: 100px;
    }

    .precio-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
    }

    .precio-valor {
        font-weight: bold;
        font-size: 1rem;
    }

    .fecha-precio {
        font-size: 0.7rem;
        color: #7f8c8d;
    }

    .mejor-precio {
        background: #d4edda !important;
        border: 2px solid #27ae60;
    }

    .mejor-precio-total {
        font-weight: bold;
        color: #27ae60;
        font-size: 1.1rem;
    }

    .diferencia-precio {
        font-weight: bold;
    }

    .diferencia-alta {
        color: #e74c3c;
    }

    .sin-precio {
        background: #f8f9fa;
    }

    .sin-precio-text {
        color: #95a5a6;
        font-style: italic;
    }

    /* Filtros comparativa */
    .filtros-comparativa {
        background: #f8f9fa;
        padding: 1rem;
        border-radius: 5px;
        margin-bottom: 1rem;
    }

    /* Estados sin datos */
    .sin-datos {
        text-align: center;
        padding: 2rem;
        color: #7f8c8d;
        font-style: italic;
    }

    /* Form actions */
    .form-actions {
        display: flex;
        gap: 1rem;
        margin-top: 1rem;
    }

    /* Responsive */
    @media (max-width: 768px) {

        /* Navbar responsive */
        .navbar {
            flex-direction: column;
            padding: 0 1rem;
        }

        .nav-menu {
            flex-direction: column;
            gap: 0.5rem;
            margin-top: 1rem;
        }

        /* Tabs responsive */
        .tabs {
            overflow-x: auto;
            white-space: nowrap;
            -webkit-overflow-scrolling: touch;
        }

        .tab {
            font-size: 0.85rem;
            padding: 0.6rem 1rem;
        }

        /* Container responsive */
        .container {
            padding: 0.5rem;
        }

        /* Filtros responsive */
        .filtros {
            flex-direction: column;
            gap: 0.5rem;
        }

        .filtros select,
        .filtros button {
            width: 100%;
        }

        /* Tabla de productos - Convertir a tarjetas en móvil */
        .tabla-container {
            overflow-x: visible;
        }

        #tabla-productos {
            border: 0;
        }

        #tabla-productos thead {
            display: none;
        }

        #tabla-productos tbody {
            display: block;
        }

        #tabla-productos tr {
            display: block;
            margin-bottom: 1rem;
            border: 1px solid #ddd;
            border-radius: 8px;
            background: white;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            padding: 1rem;
        }

        #tabla-productos td {
            display: block;
            text-align: left;
            padding: 0.5rem 0;
            border: none;
            position: relative;
            padding-left: 50%;
        }

        #tabla-productos td::before {
            content: attr(data-label);
            position: absolute;
            left: 0;
            width: 45%;
            padding-right: 10px;
            font-weight: bold;
            color: #2c3e50;
        }

        /* Añadir labels a las celdas mediante JavaScript o inline */
        #tabla-productos td:nth-of-type(1)::before {
            content: "Producto: ";
        }

        #tabla-productos td:nth-of-type(2)::before {
            content: "Categoría: ";
        }

        #tabla-productos td:nth-of-type(3)::before {
            content: "Ubicación: ";
        }

        #tabla-productos td:nth-of-type(4)::before {
            content: "Stock: ";
        }

        #tabla-productos td:nth-of-type(5)::before {
            content: "Mínimo: ";
        }

        #tabla-productos td:nth-of-type(6)::before {
            content: "Estado: ";
        }

        #tabla-productos td:nth-of-type(7)::before {
            content: "Caducidad: ";
        }

        #tabla-productos td:nth-of-type(8)::before {
            content: "Acciones: ";
        }

        /* Acciones en móvil */
        .acciones-tabla {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
            padding-left: 0 !important;
        }

        .acciones-tabla::before {
            display: none !important;
        }

        .acciones-tabla button {
            flex: 1;
            min-width: 80px;
        }

        /* Resumen de stock responsive */
        .resumen-stock {
            grid-template-columns: repeat(2, 1fr);
            gap: 0.5rem;
        }

        .resumen-item {
            padding: 0.75rem;
        }

        .resumen-numero {
            font-size: 1.5rem;
        }

        /* Tabla comparativa responsive */
        .tabla-comparativa {
            font-size: 0.8rem;
        }

        .tabla-comparativa th,
        .tabla-comparativa td {
            padding: 0.4rem;
        }

        .precio-info {
            flex-direction: column;
        }

        /* Formularios responsive */
        .form-row {
            flex-direction: column;
        }

        .form-actions {
            flex-direction: column;
        }

        .precios-section {
            padding: 1rem;
        }

        /* Modal responsive */
        .modal-content {
            width: 95% !important;
            max-width: 95% !important;
            margin: 1rem;
            max-height: 90vh;
            overflow-y: auto;
        }

        .modal-header h3 {
            font-size: 1.2rem;
        }

        /* Admin grid responsive */
        .admin-grid {
            grid-template-columns: 1fr !important;
        }
    }

    /* Responsive para pantallas muy pequeñas */
    @media (max-width: 480px) {
        .tab {
            font-size: 0.75rem;
            padding: 0.5rem 0.75rem;
        }

        .btn {
            font-size: 0.85rem;
            padding: 0.6rem 1rem;
        }

        .btn-small {
            font-size: 0.75rem;
            padding: 0.4rem 0.6rem;
        }

        h2 {
            font-size: 1.3rem;
        }

        padding: 0.6rem 1rem;
    }

    /* Container responsive */
    .container {
        padding: 0.5rem;
    }

    /* Filtros responsive */
    .filtros {
        flex-direction: column;
        gap: 0.5rem;
    }

    .filtros select,
    .filtros button {
        width: 100%;
    }

    /* Tabla de productos - Convertir a tarjetas en móvil */
    .tabla-container {
        overflow-x: visible;
    }

    #tabla-productos {
        border: 0;
    }

    #tabla-productos thead {
        display: none;
    }

    #tabla-productos tbody {
        display: block;
    }

    #tabla-productos tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 8px;
        background: white;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        padding: 1rem;
    }

    #tabla-productos td {
        display: block;
        text-align: left;
        padding: 0.5rem 0;
        border: none;
        position: relative;
        padding-left: 50%;
    }

    #tabla-productos td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-right: 10px;
        font-weight: bold;
        color: #2c3e50;
    }

    /* Añadir labels a las celdas mediante JavaScript o inline */
    #tabla-productos td:nth-of-type(1)::before {
        content: "Producto: ";
    }

    #tabla-productos td:nth-of-type(2)::before {
        content: "Categoría: ";
    }

    #tabla-productos td:nth-of-type(3)::before {
        content: "Ubicación: ";
    }

    #tabla-productos td:nth-of-type(4)::before {
        content: "Stock: ";
    }

    #tabla-productos td:nth-of-type(5)::before {
        content: "Mínimo: ";
    }

    #tabla-productos td:nth-of-type(6)::before {
        content: "Estado: ";
    }

    #tabla-productos td:nth-of-type(7)::before {
        content: "Caducidad: ";
    }

    #tabla-productos td:nth-of-type(8)::before {
        content: "Acciones: ";
    }

    /* Acciones en móvil */
    .acciones-tabla {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
        padding-left: 0 !important;
    }

    .acciones-tabla::before {
        display: none !important;
    }

    .acciones-tabla button {
        flex: 1;
        min-width: 80px;
    }

    /* Resumen de stock responsive */
    .resumen-stock {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .resumen-item {
        padding: 0.75rem;
    }

    .resumen-numero {
        font-size: 1.5rem;
    }

    /* Tabla comparativa responsive */
    .tabla-comparativa {
        font-size: 0.8rem;
    }

    .tabla-comparativa th,
    .tabla-comparativa td {
        padding: 0.4rem;
    }

    .precio-info {
        flex-direction: column;
    }

    /* Formularios responsive */
    .form-row {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
    }

    .precios-section {
        padding: 1rem;
    }

    /* Modal responsive */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }

    /* Admin grid responsive */
    .admin-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Responsive para pantallas muy pequeñas */
@media (max-width: 480px) {
    .tab {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }

    .btn-small {
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .resumen-stock {
        grid-template-columns: 1fr;
    }

    .producto-info-completa {
        font-size: 0.9rem;
    }
}

/* Badge para lista de compra */
.badge-lista {
    display: inline-block;
    background-color: #9b59b6;
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: middle;
    white-space: nowrap;
}