.container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex-direction: column;
    gap: 20px;
}

.inventory-container h2 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 20px;
}

.inventory-container p {
    font-size: 16px;
    color: #555;
    margin-bottom: 30px;
}

.inventory-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.inventory-table th,
.inventory-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.inventory-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

#search-input {
    flex: 2;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

#category-filter {
    flex: 1;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

#btn-reset {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

#btn-add {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #1e1e1e;
    /* Ajustado a tu tema oscuro */
    padding: 25px;
    border-radius: 8px;
    width: 400px;
    color: white;
}

.modal-content h3 {
    margin-bottom: 10px;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    margin-bottom: 15px;
    padding: 10px;
    background: #2d2d2d;
    border: 1px solid #444;
    color: white;
    border-radius: 4px;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.btn-save {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    flex: 1;
}

.btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
}

.btn-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
}

#qr-reader {
    border: 2px solid #444 !important;
    background: #000;
}

/* Estilo para el botón de "Detener" que la librería crea automáticamente */
#qr-reader button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px;
    margin: 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* --- Media Queries para Responsividad --- */

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    /* Ajuste de filtros: de horizontal a vertical */
    .filters {
        flex-direction: column;
        gap: 10px;
    }

    #search-input,
    #category-filter,
    #btn-add {
        width: 100%;
        flex: none;
    }

    /* --- Transformación de la Tabla a "Tarjetas" --- */
    /* Esto evita el scroll horizontal infinito */
    .inventory-table,
    .inventory-table thead,
    .inventory-table tbody,
    .inventory-table th,
    .inventory-table td,
    .inventory-table tr {
        display: block;
    }

    /* Ocultamos el encabezado original de la tabla */
    .inventory-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .inventory-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .inventory-table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50% !important;
        /* Espacio para el "título" */
        text-align: right;
    }

    .inventory-table td:last-child {
        border-bottom: 0;
    }

    /* Insertamos los nombres de las columnas antes de cada dato */
    .inventory-table td::before {
        position: absolute;
        left: 15px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        content: attr(data-label);
        /* Necesitarás agregar data-label en tu JS */
        font-weight: bold;
        text-align: left;
        color: var(--primary-color);
    }

    /* Ajuste del Modal para móviles */
    .modal-content {
        width: 90%;
        padding: 15px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions button {
        width: 100%;
    }
}