/* ============================================================================
 * Truck Checks — Unified Stylesheet
 * Mobile-first, touch-friendly
 * Brand colour: #12044C
 * ============================================================================ */

/* --- Reset & Base --- */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    background-color: #f7f7f7;
    color: #333;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
}

h2, h3 {
    margin-top: 30px;
    font-size: 20px;
    text-align: center;
}

/* --- Buttons --- */

.button.touch-button {
    display: inline-block;
    padding: 15px 30px;
    margin: 10px;
    font-size: 18px;
    text-decoration: none;
    color: white;
    background-color: #12044C;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    touch-action: manipulation;
}

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

.submit-button {
    display: block;
    margin: 20px auto;
    padding: 15px 30px;
    font-size: 18px;
    background-color: #12044C;
    color: white;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
}

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

.button-bar {
    text-align: center;
    margin-top: 40px;
}

/* --- Forms --- */

select,
input[type="text"],
textarea,
button {
    padding: 10px;
    font-size: 16px;
    margin: 5px 0;
    border-radius: 5px;
    border: 1px solid #ccc;
    width: 100%;
    box-sizing: border-box;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background: #fff url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%23000000' d='M0 0l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center;
    background-size: 10px 6px;
}

label {
    display: block;
    font-weight: bold;
    margin-top: 15px;
}

/* --- Dashboard: Truck Listings --- */

.truck-listing {
    border: 2px solid #ddd;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 10px;
    background-color: #f9f9f9;
}

.truck-button {
    display: block;
    background-color: #12044C;
    color: white;
    padding: 20px 30px;
    font-size: 22px;
    font-weight: bold;
    text-align: left;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 20px;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.truck-button:hover {
    background-color: #0056b3;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* --- Dashboard: Locker Grid --- */

.locker-container {
    position: relative;
    width: 100%;
}

.locker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.locker-cell {
    position: relative;
    padding: 20px;
    text-align: center;
    font-size: 18px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    overflow: visible;
}

.badge {
    background-color: cyan;
    color: red;
    padding: 7px 14px;
    border-radius: 50%;
    font-size: 20px;
    position: absolute;
    top: -15px;
    right: -15px;
    display: inline-block;
    line-height: 1;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.relief-truck-indicator {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    background-color: rgba(216, 211, 211, 0.9);
    color: rgb(12, 4, 76);
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    padding: 10px;
    border-radius: 5px;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    margin-top: 10px;
}

/* --- Check Page: Item Grid --- */

.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.item-card {
    padding: 20px;
    text-align: center;
    font-size: 18px;
    border-radius: 8px;
    border: 2px solid #000;
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
    background-color: #f0f0f0;
    color: #333;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
    user-select: none;
    -webkit-user-select: none;
}

.item-card.checked {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.item-card.checkedCB {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.hidden-checkbox {
    display: none;
}

/* --- Check Page: Info --- */

.days-since-check {
    display: inline-block;
    padding: 5px 10px;
    border: 2px solid #007bff;
    border-radius: 5px;
    box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
    background-color: #f8f9fa;
    color: #333;
    font-weight: bold;
    text-align: center;
}

.center-container {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.last-checks {
    color: grey;
    font-size: small;
}

/* --- Modal --- */

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

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    text-align: center;
    border-radius: 10px;
}

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

.close-button:hover {
    color: black;
}

/* --- Find Page --- */

.find-results {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.find-results th,
.find-results td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.find-results th {
    background-color: #f2f2f2;
}

.no-results {
    text-align: center;
    color: #888;
    margin-top: 20px;
}

/* --- Changeover Page --- */

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.truck-selection {
    margin-bottom: 20px;
}

.truck-relief-toggle {
    margin: 20px 0;
    padding: 10px;
    background-color: #e9f5fd;
    border-radius: 8px;
    border: 1px solid #b8daff;
}

.relief-instructions {
    padding: 10px;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    margin-bottom: 20px;
}

.locker-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.locker-header {
    background-color: #f8f8f8;
    padding: 10px;
    margin: -15px -15px 15px -15px;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #ddd;
}

.item-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.item-name {
    flex-grow: 1;
}

.relief-status {
    width: 150px;
}

/* --- Switch Toggle (Changeover) --- */

.switch-flat {
    position: relative;
    display: inline-block;
    width: 100px;
    height: 34px;
}

.switch-flat .switch-input {
    display: none;
}

.switch-flat .switch-label {
    position: relative;
    display: block;
    height: inherit;
    font-size: 10px;
    text-transform: uppercase;
    background: #FFF;
    border: solid 2px #eceeef;
    border-radius: 4px;
}

.switch-flat .switch-label:before,
.switch-flat .switch-label:after {
    position: absolute;
    top: 50%;
    margin-top: -.5em;
    line-height: 1;
    transition: inherit;
}

.switch-flat .switch-label:before {
    content: attr(data-off);
    right: 11px;
    color: #000;
}

.switch-flat .switch-label:after {
    content: attr(data-on);
    left: 11px;
    color: #0088cc;
    opacity: 0;
}

.switch-flat .switch-handle {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 22px;
    height: 22px;
    background: #dadada;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.switch-flat .switch-input:checked ~ .switch-label {
    border-color: #0088cc;
}

.switch-flat .switch-input:checked ~ .switch-label:before {
    opacity: 0;
}

.switch-flat .switch-input:checked ~ .switch-label:after {
    opacity: 1;
}

.switch-flat .switch-input:checked ~ .switch-handle {
    left: 72px;
    background: #0088cc;
}

/* --- Quiz Page --- */

.quiz-container {
    text-align: center;
    padding: 0 5vw;
}

.quiz-question {
    font-size: 5vw;
    margin-bottom: 2vh;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.quiz-options button {
    margin: 1vh 0;
    padding: 1vh 0;
    font-size: 5vw;
    cursor: pointer;
    width: 35vw;
    max-width: 130px;
    height: 35vw;
    max-height: 130px;
    border: none;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3);
    background-color: #f0f0f0;
}

.quiz-options button.correct {
    background-color: green;
    color: white;
}

.quiz-options button.wrong {
    background-color: red;
    color: white;
}

.score-container {
    margin-top: 2vh;
    padding: 1vh;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    display: inline-block;
    background-color: #f9f9f9;
    font-size: 5vw;
    width: 40vw;
    max-width: 200px;
    text-align: left;
}

.score-container p {
    margin: 0.1em 0;
    padding: 0;
    font-size: 0.8em;
}

/* --- Auth Banner --- */

.auth-banner {
    text-align: center;
    padding: 12px;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    margin-bottom: 20px;
}

.auth-banner a {
    color: #12044C;
    font-weight: bold;
}

.error-banner {
    text-align: center;
    padding: 12px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #721c24;
}

/* --- Station Auth --- */

.station-auth-success,
.station-auth-fail {
    text-align: center;
    padding: 40px;
}

.station-auth-success h1 {
    color: #28a745;
}

.station-auth-fail h1 {
    color: #dc3545;
}

/* --- Settings --- */

.setting-label {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    cursor: pointer;
}

.setting-label input[type="checkbox"] {
    width: 24px;
    height: 24px;
}

/* --- Footer --- */

footer {
    text-align: center;
    margin-top: 40px;
    font-size: 14px;
    color: #777;
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .item-card {
        padding: 25px;
        font-size: 20px;
    }

    .submit-button {
        padding: 20px 40px;
        font-size: 20px;
    }

    .button.touch-button {
        padding: 20px;
        font-size: 20px;
        margin: 15px;
    }

    .truck-button {
        font-size: 20px;
        padding: 15px 20px;
    }

    .locker-cell {
        padding: 15px;
        font-size: 16px;
    }

    .modal-content {
        width: 90%;
    }

    h1 { font-size: 22px; }
    h2, h3 { font-size: 18px; }
}

@media (min-width: 768px) {
    .quiz-question { font-size: 2rem; }
    .quiz-options button { font-size: 1.5rem; width: 300px; height: 300px; }
    .score-container { font-size: 1.5rem; width: 300px; }
}

@media (min-width: 1200px) {
    .quiz-question { font-size: 2.5rem; }
    .quiz-options button { font-size: 2rem; width: 350px; height: 350px; }
    .score-container { font-size: 2rem; width: 350px; }
}
