html, body {
    height: auto; /* important for window.scrollY */
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    /* Prevent unwanted scrolling on landscape */
    overflow-x: hidden;
    /* Ensure background covers under notches */
}

body {
    /* Padding for iOS safe areas */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    min-height: 100vh;
    box-sizing: border-box;
}

@media (orientation: landscape) {
    html, body {
        min-height: 100vh;
        min-width: 100vw;
    }
    body {
        /* Extra: ensure a minimum height for landscape, useful for iPhone 14/Pro/Plus */
        min-height: 100vh;
    }
}
.card, .navbar { border-radius: 1.25rem; }
/*.form-control { font-size: 1.15rem; }*/
/*.btn-primary { font-size: 1.15rem; }*/
/*.alert, .btn-link { font-size: 1.12rem; }*/
.address-list {  margin: 0 auto; padding-bottom: 2rem; }
/*.list-group-item { font-size: 1.15rem; padding: 1.25rem 1.2rem; border-radius: 6px; margin-bottom: 0.75rem; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }*/
.list-group-item { padding: 1.25rem 1.2rem; border-radius: 6px; margin-bottom: 0.75rem; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.list-group-item+.list-group-item {border: var(--bs-list-group-border-width) solid var(--bs-list-group-border-color); border-top-width: var(--bs-list-group-border-width)!important; }
.sticky-header { position: sticky; top: 0; z-index: 10; padding-top: 1.5rem; padding-bottom: 0.5rem; margin-bottom: 1rem; }
.sticky-header a { text-decoration:none; }
/*.sticky-header i { font-size: 1.8em; vertical-align: middle; }*/
.sticky-header i { vertical-align: middle; }
.run-btn { margin: 0.2rem; }
.run-selector { margin-bottom: 1.2rem; }
.run-link.list-group-item {padding: 1.5rem; }
.page { display: none; }
.page.active { display: block; }
.back-btn { margin-bottom: 1rem; font-size: inherit!important; }
.btn-run { min-width: 8.5rem; }
.btn-run .badge{ background-color: cornflowerblue; }
@media (min-width: 992px) {.row.row-cols-lg-7>* {flex: 0 0 auto; width: 13%;}}
.drop-link .features span { margin-right: 0.5rem; }
.drop-link .features i { -webkit-text-stroke: .02em; }
.runs {
    /*font-size: calc(.4rem + 3.3vw);*/
    /*font-size: clamp(1rem, calc(1vw + 1vh + 0.5rem), 34px);*/
    font-size: clamp(1rem, calc(.4rem + 3.3vw), 34px);
}
button[type="button"] {
    -webkit-appearance: none;
    border-radius: --bs-border-radius-lg!important;
    -webkit-border-radius: --bs-border-radius-lg!important;
    /* Remove default iOS shadow as well if needed: */
    box-shadow: none !important;
}

.auto-grow {
    min-height: calc(2 * 1.5em); /* 2 lines */
    max-height: calc(5 * 1.5em); /* 5 lines */
    overflow-y: auto;
}
.drop-status-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    /*background: rgba(0,0,0,0.35);*/
    color: rgba(255,255,255,0.7);
    text-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 1px 0 rgba(0,0,0,0.3);
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border-radius: 6px;
    text-transform: capitalize;
    pointer-events: none;
    font-weight: bold;
}
.drop-status-lozenge {
    display: inline-block;
    padding: 0.3em 1.2em;
    border-radius: 999px;
    font-weight: bold;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.35);
    text-transform: capitalize;
    font-size: 1em;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 0.5em;
}
.drop-status-complete {
    background: rgba(40,167,69,0.1); /* green */
    /*background: color-mix(in srgb, var(--bs-success), transparent 80%); !* green *!*/
}
.drop-status-incomplete {
    background: rgba(255,193,7,0.1); /* yellow */
}
.drop-status-failed {
    background: rgba(220,53,69,0.1); /* red */
}
[data-bs-theme="light"] .drop-status-complete {
    background: rgba(40,167,69,0.7); /* green */
}
[data-bs-theme="light"] .drop-status-incomplete {
    background: rgba(255,193,7,0.7); /* yellow */
}
[data-bs-theme="light"] .drop-status-failed {
    background: rgba(220,53,69,0.7); /* red */
}
.drop-status-lozenge.drop-status-{
    background-color: transparent;
}

/* Part state highlighting (for order items) */
.part-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}
.part-row.part-state-good td {
    background-color: rgba(40, 167, 69, 0.18); /* subtle green */
}
.part-row.part-state-issue td {
    background-color: rgba(255, 193, 7, 0.2); /* subtle yellow/amber */
}
.part-row.part-state-problem td {
    background-color: rgba(220, 53, 69, 0.18); /* subtle red */
}

/* Light mode adjustments for better visibility */
[data-bs-theme="light"] .part-row.part-state-good td {
    background-color: rgba(40, 167, 69, 0.28);
}
[data-bs-theme="light"] .part-row.part-state-issue td {
    background-color: rgba(255, 193, 7, 0.35);
}
[data-bs-theme="light"] .part-row.part-state-problem td {
    background-color: rgba(220, 53, 69, 0.3);
}

.item-highlight {
    border: 2px solid #007bff!important;
    transition: border 0.2s;
}
[data-bs-theme="light"] .item-highlight {
    border: 2px solid var(--bs-dark-text-emphasis)!important;
}

label.btn.like-disabled {
    pointer-events: auto !important;
    opacity: 0.65;
}

/* Image Thumbnail Styles */
.thumbnail-container {
    position: relative;
    display: inline-block;
    margin: 5px;
}

.thumbnail-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: block;
}

.thumbnail-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background-color: rgba(255, 0, 0, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    font-weight: bold;
}

.thumbnail-remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background-color: rgba(255, 165, 0, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    font-weight: bold;
}

.thumbnail-label {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    background-color: rgba(0, 150, 0, 0.8);
    color: white;
    font-size: 9px;
    text-align: center;
    padding: 2px 1px;
    border-radius: 2px;
}

/* Vehicle selection buttons */
.vehicle-btn {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    border: 2px solid #0d6efd;
    transition: all 0.2s ease-in-out;
}

.vehicle-btn:hover {
    background-color: #0d6efd;
    color: white;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.2);
}

.vehicle-btn.active {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.vehicle-btn.active:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

/* Help Button Styles */
.help-button {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 1050;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: rgba(13, 110, 253, 0.9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.help-button:hover {
    background-color: rgba(13, 110, 253, 1);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    color: white;
}

.help-button i {
    font-size: 1.5rem;
}

/* Modal help button (for feedback modal) */
.modal-help-button {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    z-index: 1060;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: rgba(13, 110, 253, 0.9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.modal-help-button:hover {
    background-color: rgba(13, 110, 253, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    color: white;
}

.modal-help-button i {
    font-size: 1.2rem;
}

/* Help modal content styling */
#helpModalBody h5 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #0d6efd;
    font-size: 1.1rem;
}

#helpModalBody h5:first-child {
    margin-top: 0;
}

#helpModalBody ul {
    margin-bottom: 1rem;
}

#helpModalBody li {
    margin-bottom: 0.5rem;
}

#helpModalBody p {
    margin-bottom: 0.75rem;
}

#helpModalBody .badge {
    vertical-align: middle;
}

#helpModalBody .drop-status-overlay {
    margin: 0 0.25rem;
}

[data-bs-theme="light"] .help-button,
[data-bs-theme="light"] .modal-help-button {
    background-color: rgba(13, 110, 253, 0.95);
}

[data-bs-theme="light"] .help-button:hover,
[data-bs-theme="light"] .modal-help-button:hover {
    background-color: rgba(11, 94, 215, 1);
}

[data-bs-theme="light"] #helpModalBody h5 {
    color: #0b5ed7;
}

/* Standalone instructions layout */
.standalone-instructions {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.08), rgba(13, 110, 253, 0.02));
}

.standalone-instructions-card {
    max-width: 420px;
    width: 100%;
    border-radius: 1.5rem;
}

.standalone-instructions ol {
    padding-left: 1.2rem;
}

.standalone-instructions li + li {
    margin-top: 0.4rem;
}

@media (min-width: 768px) {
    .standalone-instructions {
        padding: 4rem 2rem;
    }
}

/* Fuel Receipt Styles */
.fuel-receipt-item {
    display: inline-block;
    position: relative;
}

.fuel-receipt-time {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    text-align: center;
    padding: 2px 1px;
    border-radius: 0 0 3px 3px;
}

.fuel-receipt-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: none;
    border: none;
    color: #dc3545;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    text-shadow: 0 0 3px rgba(255,255,255,0.8);
}

.fuel-receipt-delete-btn:hover {
    color: #c82333;
}

.fuel-receipt-pending-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background-color: rgba(255, 193, 7, 0.9);
    color: #000;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.fuel-receipt-uploaded-badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background-color: rgba(40, 167, 69, 0.9);
    color: #fff;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

/* Refresh button rotation animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotating {
    animation: rotate 0.6s linear;
}