html { font-family: sans-serif; font-size: 1rem; background: #ccc;}
body { margin: 0;}
header { background-color: orange; padding: 10px;}
/* Desktop only */
@media screen and (min-width: 800px) {
    header { position: sticky; top: 0; background-color: orange; padding: 10px; z-index: 1000;}
}

#content_container, #priority-list {
    box-sizing: border-box;
}

#header-container {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    gap: 10px; /* Added gap for better spacing when wrapping */
    position: relative;
    justify-content: space-between;
    min-height: 55px;
    width: 100%;
}

#header-buttons, #logout-button{
    display: flex;
    flex-direction: row;
    min-height: 50px;
    a {
        line-height: 40px;
        padding: 5px;
    }
    a:hover {
        background-color: #00000015;
        border-radius: 10px;
        .fa-house {color: #ffffff;}
    }
    button{
        cursor: pointer;
        border-radius: 3px;
        border: 1px solid #000000;
    }
    button:hover{
        background-color: #b9b9b9;
    }
}

#driver, #vehicle, #account {
    margin-right: 5px;
}

#changepwd-button {
    font-size: 16px;                 
    padding: 12px 20px;              
    width: 50px;                    
    height: 50px;                    
    border: none;                   
    border-radius: 5px;              
    cursor: pointer;                 
    display: flex;                    
    align-items: center;              
    justify-content: center;          
    transition: background-color 0.3s, transform 0.2s; 
}

#changepwd-button:hover {
    background-color: #f00;   
    transform: scale(1.05);       
}

#logout-button {
    background-color: #ff0;       
    color: white;                    
    font-size: 16px;                 
    padding: 12px 20px;              
    width: 80px;                    
    height: 50px;                    
    border: none;                   
    border-radius: 5px;              
    cursor: pointer;                 
    display: flex;                    
    align-items: center;              
    justify-content: center;          
    transition: background-color 0.3s, transform 0.2s; 
}

#logout-button i {
    margin-right: 8px;    
}

#logout-button:hover {
    background-color: #0056b3;   
    transform: scale(1.05);       
}

#driver-dialog-form #driver,
#driver-dialog-form #current_leave,
#driver-dialog-form #past_leave,
#vehicle-dialog-form #vehicle,
#vehicle-dialog-form #current_maintenance,
#vehicle-dialog-form #past_maintenance {
    width: auto;
    margin: auto;
}

#logo {
    height: 55px;
    left: 50%;
}

#week-navigator, #day-navigator {
    height: 50px;
    line-height: 50px;
    background-color: #ffffff;
    border: 1px solid #000000;
    button {
        height: 98%;
        min-width: 30px;
        border: none;
        background-color: inherit;
    }
    button:hover{
        background-color: #ccc;
    }
}

#week-range, #day-display {
    padding: 7% 0 7%;

}

#day-navigator{
    transform: translateX(-100%);
}

#content_container {
    padding: 10px; /* Changed from margin to padding */
}

.table-container {
    overflow-x: auto; /* Make the table scrollable on small screens */
    display: flex;
    flex-flow: row wrap;
    gap: 8px; /* Added gap for more consistent spacing between tables */
}
.table {
    margin: 0; /* Removed margin since we're using gap in the container */
    width: 32.9%;
    table-layout: auto
}

table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    background-color: #f0f0f0;
}

caption {
    text-align: left;
    padding-left: 5px;
    height: 25px;
    line-height: 25px;
    border: 1px solid #000000;
    border-bottom: none;
    background-color: #e0e0e0;
}

.clickable-caption {
    cursor: pointer;    
}
.clickable-caption:hover {
    background-color: #ffcb6a;   
}

table .day-of-week {
    font-size: 1.2rem; /* Make the day of the week slightly larger */
    color: #007BFF; /* Blue color for the day of the week */
    font-weight: bold; /* Bold the day name */
  }
  
  table .formatted-date {
    font-size: 1rem; /* Keep the date a bit smaller */
    color: #555; /* Slightly lighter text for the date */
  }

th, td {
    padding: 8px;
    text-align: left;
    border: 1px solid #000000;
}
.schedule th {
    height:60px;
}
.schedule td {
    height:75px;
}

/* Added styling for the legend box */
.table-container > div:last-child {
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 10px;
    margin-top: 5px;
    display: inline-block; /* Make it wrap content only */
    align-self: flex-start; /* Align to the top of the container */
    height: auto; /* Let height be determined by content */
}

.table-container > div:last-child table {
    background-color: transparent;
    border: none;
}

.table-container > div:last-child table td {
    padding: 5px 10px;
}

#priority-list {
    position: absolute;
    right: 5px;
    width: 20%;
    height: 50%;
    padding: 10px;
    background-color: #ffffff;
    border: 1px solid #000000;
    h4 {
        margin: 5px;
    }  
    .content {
        display: block;
    }
}

#toggle-priority {
    display: none;
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #c0bfbf;
    border: none;
    cursor: pointer;
}
.open #toggle-priority {
    background-color: #3a3a3a;
    color: white;
}

.fa-solid {
    color: #000000;
}
.fa-circle-arrow-left:hover {
    color: #ffffff;
}

@media screen and (max-width: 800px) {
    html {
        min-width: 240px;
        font-size: 0.85rem; /* Reduce base font size for mobile */
    }
    
    /* Simplified header layout for mobile */
    #header-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        padding: 5px;
        text-align: center;
    }
    
    #logo {
        height: 45px;
        margin: 5px auto -55px auto; /* Using negative bottom margin to pull elements closer */
        display: block;
        width: auto; /* Changed from 100% to auto to maintain aspect ratio */
        max-width: 100%; /* Ensure it doesn't overflow container */
    }
    
    #week-navigator {
        width: 90%;
        height: 40px;
        line-height: 40px;
        margin: 0 auto 5px auto; /* Kept top margin at 0 */
        text-align: center;
    }
    
    #header-buttons {
        position: static;
        width: 100%;
        display: flex;
        justify-content: center;
        margin: 5px auto;
    }
    
    #header-buttons button {
        display: none;
    }
    
    /* Fix the key and logout buttons */
    #changepwd-button, #logout-button {
        margin: 5px;
        height: 50px;
        width: 40px;
        padding: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 40px;
    }
    
    #logout-button i, #changepwd-button i, #refresh-button i {
        margin: 0;
        font-size: 1.2rem;
    }

    /* Fix for table layout in mobile view */
    .table {
        width: 100%; /* Full width for mobile */
        margin-bottom: 10px;
        max-width: 100%; /* Prevent tables from exceeding container width */
    }
    
    .table-container {
        flex-direction: column; /* Stack tables vertically on mobile */
        align-items: center; /* Center tables horizontally */
        gap: 10px; /* Consistent spacing between tables */
    }
    
    /* Fix for legend alignment in mobile view */
    .table-container > div:last-child {
        width: auto; /* Auto width to wrap content */
        max-width: 100%;
        margin: 10px auto; /* Center the legend */
        box-sizing: border-box;
        display: table; /* Make it only as wide as its content */
    }
    
    .table-container > div:last-child table {
        width: auto; /* Auto width to fit content */
        margin: 0 auto; /* Center the table */
    }
    
    table {
        width: 100%;
        table-layout: fixed; /* Fixed layout to prevent right-side spacing */
        margin: 0; /* Remove margin to avoid inconsistency */
        font-size: 0.8rem; /* Smaller font size for table content */
    }
    
    /* Reduce cell padding to fit more content */
    th, td {
        padding: 3px 4px;
        word-wrap: break-word; /* Allow text to wrap in cells */
    }
    
    /* Reduce row heights to fit more rows */
    .schedule th {
        height: 40px;
    }
    .schedule td {
        height: 45px; /* Reduced from 75px to fit more rows */
    }
    
    /* Make day header more compact */
    caption {
        height: 20px;
        line-height: 20px;
        font-size: 0.9rem;
    }
    
    table .day-of-week {
        font-size: 0.95rem; /* Smaller day of week text */
    }
    
    table .formatted-date {
        font-size: 0.85rem; /* Smaller date text */
    }

    #priority-list {
        position: initial;
        padding: 0;
        width: 100%;
        h4, .content {
            display: none;
        }
    }
    #toggle-priority {
        display: block;
        height: 30px;
        text-align: left;
        font-size: 16px;
        font-weight: bold;
    }

    #priority-list.open .content {
        display: block;
        padding: 10px;
    }

    #toggle-priority .toggle-icon {
        position: absolute;
        left: 95%;
    }

    #scrollable-box{
        display: none;
    }
    .clickable-caption {
        pointer-events: none; 
    }
}

#scrollable-box {
    width: 600px; /* Width of the visible box */
    height: 50px; /* Height of the box */
    overflow: hidden; /* Hide overflowing content */
    border: 5px solid #ccc; /* Default border if no items */
    position: relative;
    background-color: white;
    cursor: pointer;
}

#scrollable-box.has-items {
    border: 5px solid #ec0707; /* Red border if there are items */
}

#content {
    display: flex; /* Arrange items horizontally */
    animation: scroll-left 2s linear infinite; /* Placeholder animation timing */
}

.item {
    flex: none; /* Prevent items from shrinking */
    width: 200px; /* Width of each item */
    height: 50px; /* Height of each item */
    text-align: center; /* Center text horizontally */
    box-sizing: border-box;
    overflow: hidden; 
    display: flex;
    justify-content: center; /* Horizontal centering */
    align-items: center; /* Vertical centering */
}
  

  .unavailable-container {
    border: 2px solid red;
    background-color: #ffbaba;
}

.unavailable-section {
    margin-bottom: 10px;
}

.unavailable-section h5 {
    margin-bottom: 5px;
    font-size: 1em;
    color: #555;
}

.unavailable-section ul {
    list-style-type: disc;
    margin-left: 20px;
    padding-left: 0;
}

.unavailable-section ul li {
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #333;
}

  
.unavailable {
    color: red;
}

.future-record {
    color: blue;  
}

.action-column{
    width:111px;
}

th.third-trip, td.third-trip, .schedule tr td:nth-child(4) {
    display: none;
}

.status-completed {
    color: green;
    font-weight: bold;
}

.status-not-ready {
    color: #FF4433;
}

.status-uncertain, .status-plant-2 {
    color: blue;
}

.status-default {
    color: black;
}

.highlight-row {
    border: 2px solid blue;; /* Highlight color */
}


/* Overlay background */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent background */
    backdrop-filter: blur(8px); /* Applies the blur effect */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Popup content */
.popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    width: 300px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    margin-top: 60px;
    z-index: 10001;
}

/* Form styling */
#login-form, #changepwd-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ui-dialog {
    top: 150px !important;
}

#login-form input, #changepwd-form input {
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#login-form button, #changepwd-form button {
    padding: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#login-form button:hover, #changepwd-form button:hover {
    background-color: #0056b3;
}

.last-original {
    border-right: 1px solid gray; /* Right border for the last original item */
}

.first-duplicate {
    border-left: 1px solid gray; /* Left border for the first duplicate item */
}

.clickable {
    cursor: pointer;
}

/* Style for the refresh button */
#refresh-button {
    background-color: white;
    /* White background */
    color: black;
    /* Black text */
    padding: 12px 15px;
    /* Increased padding for larger button */
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    border: 1px solid #000000;
    /* Added border to match other buttons */
    transition: all 0.3s ease;
    min-width: 80px;
    /* Ensure minimum width */
    height: 50px;
    /* Match height of other buttons */
}

#refresh-button:hover {
    background-color: #b9b9b9;
    /* Light gray on hover, similar to other buttons */
}

#refresh-button i {
    margin-left: 5px;
    font-size: 1.2rem;
    /* Slightly larger icon */
}

/* Style for the countdown text */
#countdown {
    font-size: 0.9em;
    margin-right: 5px;
    font-weight: normal;
}