:root {
    --primary-teal: #008080;
    --light-grey: #F5F5F5;
    --dark-text: #333333;
}

body {
    font-family: sans-serif;
    margin: 0;
    background-color: var(--light-grey);
    color: var(--dark-text);
    overflow: hidden;
}

.container {
    display: grid;
    height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: 50px 1fr;
    grid-template-areas:
        "header"
        "main";
}

.top-nav {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: white;
    padding: 0 20px;
    border-bottom: 1px solid #ddd;
}

.drawer-toggle button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--dark-text);
    margin: 4px 0;
}

.side-drawer {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100%;
    background-color: #f4f4f4;
    transition: left 0.3s ease-in-out;
    border-right: 1px solid #ddd;
    z-index: 1000;
}

.side-drawer.open {
    left: 0;
}

.logo {
    padding: 20px;
    text-align: center;
}

.logo img {
    max-width: 100%;
    height: auto;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--dark-text);
}

.nav-links li a:hover {
    background-color: var(--primary-teal);
    color: white;
}

.main-content {
    grid-area: main;
    padding: 20px;
    transition: margin-left 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto; /* Enable vertical scrolling */
}

.main-content.drawer-open {
    margin-left: 250px;
}

.button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 50px;
}

.square-btn {
    width: 150px;
    height: 150px;
    background-color: var(--primary-teal);
    color: white;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    font-size: 1.2em;
    text-align: center;
}

/* Login Form Styles */
#login-form {
    width: 100%;
    max-width: 400px;
    margin-top: 50px;
}

.form-group {
    margin-bottom: 1em;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.8em;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

.btn {
    background-color: var(--primary-teal);
    color: white;
    border: none;
    padding: 0.5em 1em;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
}

.btn.primary {
    padding: 0.8em 1.2em;
    font-size: 1em;
    width: 100%;
}

.btn.btn-secondary {
    background-color: #6c757d;
}

#category-radio-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
    font-size: 1.5em;
    display: none; /* Hidden by default */
}

.spinner {
    border: 8px solid rgba(255, 255, 255, 0.3);
    border-top: 8px solid #fff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn.btn-danger {
    background-color: #dc3545; /* A common red color for danger actions */
}

/* Generic table styling */
.inventory-table {
    width: 100%;
    border-collapse: collapse;
}

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

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

.inventory-table .btn {
    margin-right: 5px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-direction: column; /* Stack filters vertically */
    gap: 10px;
    margin-bottom: 20px;
    align-items: flex-start; /* Align items to the start */
}

.filter-bar select,
.filter-bar input {
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ccc;
    width: 100%; /* Make inputs take full width */
    max-width: 300px; /* Limit max width for better appearance */
}

.align-start {
    align-self: flex-start;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.top-controls-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
}

.page-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align items to the right */
    gap: 10px;
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px; /* Increased for wider content like tables */
    border-radius: 10px;
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Ensure tables within modals are responsive */
.modal table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Prevents table from expanding beyond its container */
}

.modal th,
.modal td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    word-wrap: break-word; /* Wraps long words to prevent overflow */
}

.modal-button-container {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Vertically align items */
    margin-top: 15px; /* Add some space above the buttons */
    margin-bottom: 15px; /* Add some space below the buttons */
}
