/* The scrollable container */
.scrollable-table {
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #ccc;
    border-radius: 8px;
}

/* Basic table styling */
table {
    width: 100%;
    border-collapse: collapse; /* Makes borders look clean */
}

/* Table header styling */
thead th {
    background-color: #004a7c; /* A professional blue */
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: bold;
    
    /* This makes the header stick to the top when you scroll! */
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Table body cells */
tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
}

tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

tbody tr:hover {
    background-color: #f1f1f1;
}

.no-data {
    text-align: center;
    padding: 20px;
    color: #777;
    font-style: italic;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

h1, h2 {
    color: #004a7c; 
}

a {
    color: #004a7c; 
    text-decoration: none;
} 

.title-bar {
    background-color: #004a7c; 
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
}

.title-bar h1 {
    margin: 0;
    font-size: 1.5rem;
    color: white;
}

nav {
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

nav ul {
    display: flex;
    list-style-type: none; 
    margin: 0;
    padding: 0;
    justify-content: center; 
}

nav a {
    display: block;
    padding: 1rem 1.5rem; 
    color: #333;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
    border-bottom: 3px solid transparent; 
}

nav a:hover {
    background-color: #f0f0f0;
    color: #004a7c;
}

.form-container {
    max-width: 1000px;       
    margin: 50px auto;     
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.form-container h1 {
    padding: 12px;
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

form p {
    padding: 12px;
    margin-bottom: 1rem;
}

form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

form input[type="text"],
form input[type="password"],
form input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

form input[type="text"]:focus,
form input[type="password"]:focus,
form input[type="email"]:focus {
    outline: none;
    border-color: #004a7c; 
    box-shadow: 0 0 5px rgba(0, 74, 124, 0.3);
}

form input[type="submit"] {
    width: 100%;
    padding: 12px;
    background-color: #004a7c; 
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

form input[type="submit"]:hover {
    background-color: #003a6c; 
}

.flash-error {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    background-color: #f8d7da;
    color: #721c24;
    text-align: center;
}

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

.modal-content {
    background-color: #fefefe;
    margin: 15% auto; 
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 1000px;
    border-radius: 8px;
    position: relative;
}

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

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

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.button-primary,
.button-danger,
button {
    margin-top: 10px;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    text-align: center;
    transition: background-color 0.3s ease;
}

.button-primary, button {
    background-color: #004a7c;
}

.button-primary:hover {
    background-color: #003a6c;
}

.button-danger {
    background-color: #dc3545;
}

.button-danger:hover {
    background-color: #c82333;
}


.flex-container-horizontal {
    display: flex;
    gap: 20px;
    height: 80vh; 
}

.flex-container-vertical {
    display: flex;
    flex-direction: column; 
    gap: 20px;
}

.flex-container-horizontal > div {
    flex: 1;
}

.flex-container-vertical > div {
    flex: 1;
}

.table-wrapper {
    display: flex;
    flex-direction: column; /* Stacks the table on top of the controls */
    min-height: 0; 
}

/* This makes the scrollable table inside the wrapper fill the available space */
.table-wrapper .scrollable-table {
    flex-grow: 1; /* Allows the table to grow */
    margin-top: 0;  /* Reset margin as wrapper provides space */
}

.table-controls {
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    border-top: none; 
    border-radius: 0 0 8px 8px;
    display: flex;
    gap: 10px;
}

.header-container {
    display: flex; 
    justify-content: space-between;
    align-items: center;
}

.search-form {
    margin: 0; 
}

.text-danger {
    color: #dc3545 !important;
}

.logo-container {
    display: flex;          
    align-items: center;    
    justify-content: center;
    gap: 15px;              
    margin-bottom: 20px; 
    margin-top: 100px;   
}

.logo-image {
    width: 400px;           
    height: auto;          
}

.logo-text {
    margin: 0;             
    font-size: 1.0rem;     
}

.modal {
    overscroll-behavior: contain;
}

.available-pallets-table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
}

.shipment-pallets {
    max-width: 95%; 
    width: 1200px;
}

.shipment-edit {
    display: flex; 
    gap: 20px; 
    flex-wrap: wrap;
}

.product-layout-grid {
    display: flex;
    gap: 20px;
}

.table-wrapper {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.scrollable-table.inventory-main {
    max-height: 600px;
    overflow-y: auto;
    flex-grow: 1;
}

.scrollable-table.sidebar-table {
    max-height: 300px;
    overflow-y: auto;
}

.table-wrapper > form {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

.table-controls {
    flex-shrink: 0;
    margin-top: 10px;
}

.custom-select-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.custom-select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    padding: 10px 40px 10px 12px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-select-wrapper::after {
    content: "▼";
    font-size: 0.8rem;
    color: #666;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none; 
}

main {
    padding: 0 20px; 
    margin-bottom: 40px; 
}

nav ul, .title-bar h1 {
    padding-left: 20px;
    padding-right: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 15px 30px;
    margin-bottom: 20px;
}

.form-grid .full-width {
    grid-column: span 2;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid .full-width {
        grid-column: span 1;
    }
}