/* Main container for inventory management */
.inventory-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Wrapper for table to prevent horizontal scroll */
.inventory-table-wrapper {
    overflow-x: hidden;
    margin-bottom: 20px;
}

/* Inventory table styling */
.inventory-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.inventory-table th,
.inventory-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.inventory-table th {
    background-color: #f4f4f4;
}

.inventory-table button {
    margin-right: 5px;
    padding: 5px 10px;
    cursor: pointer;
    white-space: nowrap;
}

/* Modal overlay */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 50%);
    z-index: 1000;
}

/* Modal content */
.modal-content {
    background: #fff;
    margin: 5% auto;
    padding: 20px;
    width: 80%;
    max-width: 500px;
    border-radius: 5px;
}

/* Modal buttons */
.modal-buttons {
    margin-top: 20px;
    text-align: right;
}

.modal-buttons button {
    margin-left: 10px;
}

/* Hidden elements */
#user-selection,
#exit-form-container,
#edit-modal,
#history-modal {
    display: none;
}

/* Error message */
#error-message {
    color: red;
    display: none;
}

/* Scrollable batches */
#batches-scroll {
    overflow-y: auto;
    max-height: 180px;
}

/* Scrollable history table */
#history-table-scroll {
    overflow: auto;
    max-height: 400px;
}

/* Form styling */
.inventory-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.inventory-form label {
    font-weight: bold;
}

input, select, #user-select-form > select, #expiry-date, #exit-form > input[type=number] {
    margin-bottom: 8px;
	display: block;
}

.inventory-form input,
.inventory-form select,
.inventory-form button {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    box-sizing: border-box;
}

.inventory-form button {
    background-color: #007bff;
    color: #fff;
    border: none;
    cursor: pointer;
}

.inventory-form button:hover {
    background-color: #0056b3;
}

/* Responsive design for tablets and smaller */
@media screen and (width <= 768px) {
    .inventory-container {
        padding: 5px;
    }

    .inventory-table-wrapper {
        overflow-x: hidden;
    }

    .inventory-table {
        width: 100%;
    }

    .inventory-table thead {
        display: none;
    }

    .inventory-table tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #ddd;
    }

    .inventory-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px;
        border: none;
        border-bottom: 1px solid #ddd;
        flex-wrap: wrap;
        overflow-wrap: break-word;
    }

    .inventory-table td::before {
        content: attr(data-label);
        font-weight: bold;
        width: 45%;
        min-width: 100px;
    }

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

    .inventory-table button {
        padding: 4px 8px;
        font-size: 12px;
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Add product form button */
#add-product-form > button {
    margin-top: 8px;
}

/* Responsive design for smaller tablets */
@media screen and (width <= 480px) {
    .inventory-table td::before {
        width: 40%;
        min-width: 80px;
    }

    .inventory-table td {
        font-size: 14px;
        padding: 5px;
    }

    .inventory-table button {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* Responsive design for mobile phones */
@media screen and (width <= 360px) {
    .inventory-table td {
        font-size: 12px;
        flex-direction: column;
        align-items: flex-start;
    }

    .inventory-table td::before {
        content: attr(data-label);
        font-weight: bold;
        width: 100%;
        min-width: 70px;
        margin-bottom: 5px;
    }

    .inventory-table button {
        max-width: 80px;
    }
}

/* Pagination */
.inventory-pagination {
    margin-top: 20px;
    text-align: center;
}

.inventory-pagination a,
.inventory-pagination span {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.inventory-pagination a:hover {
    background-color: #f5f5f5;
}

.inventory-pagination .current {
    background-color: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Stock alerts */
.low-stock {
    background-color: #fff3cd;
    color: #856404;
}

.expiring-soon {
    background-color: #f8d7da;
    color: #721c24;
}

.critical {
    background-color: #dc3545;
    color: #fff;
}

/* Responsive pagination */
@media screen and (width <= 768px) {
    .inventory-pagination a,
    .inventory-pagination span {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* Search input styling */
.inventory-search {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

#inventory-search-input {
    padding: 8px;
    width: 100%;
    max-width: 300px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.inventory-search input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.inventory-filters {
    display: flex;
    gap: 15px;
    align-items: center;
}

.inventory-filters label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}