/* =====================================================
   VEHICLE INFO PAGE – CONSISTENT DESKTOP + MOBILE LAYOUT
   ===================================================== */
:root {
    --vi-gap: 12px;
    --vi-card-radius: 10px;
    --vi-card-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    --vi-max-width: 1100px;
    --vi-footer-gap: 7px;
}

/* Reset base gutters from the shared .app-page styles */
#vehicleInfoPage.app-page {
    overflow-x: hidden;
    padding: 0;
    margin: 0;
}

#vehicleInfoPage.app-page>* {
    margin: 0;
}

/* Flex column so header/main/buttons stack consistently */
#vehicleInfoPage.app-page.active {
    display: flex;
    flex-direction: column;
    min-height: 90dvh;
}

#vehicleInfoPage .container-fluid1 {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    max-width: var(--vi-max-width);
    margin: 0 auto;
    padding: var(--vi-gap);
    box-sizing: border-box;
    gap: var(--vi-gap);
}

/* =====================================================
   HEADER
   ===================================================== */
.vehicle-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: var(--vi-card-radius);
    padding: 16px;
    box-shadow: var(--vi-card-shadow);
    position: relative;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--vi-gap);
    font-size: 13px;
}

.detail-item1 {
    background: rgba(255, 255, 255, 0.2);
    padding: 9px 11px;
    border-radius: 6px;
}

.detail-label {
    font-size: 11px;
    opacity: 0.85;
}

.detail-value {
    font-size: 14px;
    font-weight: 600;
}

.btn-edit {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 12px;
    padding: 5px 12px;
}

/* =====================================================
   MAIN PANEL
   ===================================================== */
.vi-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--vi-gap);
}

.vi-page,
.vi-page-washes,
.vi-page-history {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.vi-mobile-hint {
    font-size: 11px;
    color: #666;
    text-align: center;
}

/* Shared surface styling for washes + history cards */
.vi-page-washes,
.vi-page-history {
    background: #fff;
    border-radius: var(--vi-card-radius);
    padding: var(--vi-gap);
    box-shadow: var(--vi-card-shadow);
    gap: var(--vi-gap);
}

/* =====================================================
   ACTION BUTTONS
   ===================================================== */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--vi-gap);
    /* margin-top: var(--vi-gap); */
}

#vehicleInfoPage .action-buttons {
    width: 100%;
}

#vehicleInfoPage .btn {
    font-size: 13px;
    font-weight: 600;
    padding: 11px 16px;
}

/* =====================================================
   PRE-WASH MODAL
   ===================================================== */
.prewash-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

.prewash-section {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    background: #fafbff;
}

.prewash-section h6 {
    margin-bottom: 6px;
    font-weight: 600;
}

.prewash-detail {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    border: 1px dashed rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 8px 10px;
}

.prewash-upload .btn {
    min-width: 190px;
}

.prewash-photo-preview {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
}

.prewash-id-preview {
    min-height: 50px;
}

.prewash-photo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.prewash-photo-thumb {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    background: #fff;
}

.prewash-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.prewash-photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    border: none;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border-radius: 999px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 12px;
    cursor: pointer;
}

/* =====================================================
   VEHICLE ID CAMERA OVERLAY
   ===================================================== */
.vehicle-id-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 24px;
}

.vehicle-id-overlay-content {
    width: min(900px, 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.vehicle-id-overlay-header {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.vehicle-id-label {
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 220px;
    text-align: center;
}

.vehicle-id-overlay-actions {
    display: flex;
    gap: 8px;
}

.vehicle-id-video-wrap {
    position: relative;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    min-height: 320px;
}

.vehicle-id-video-wrap video,
.vehicle-id-video-wrap canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vehicle-id-guidelines {
    width: clamp(200px, 70%, 460px);
    aspect-ratio: 5 / 2;
    border: 2px dashed rgba(255, 255, 255, 0.85);
    border-radius: 14px;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.vehicle-id-overlay-error {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(248, 113, 113, 0.95);
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 13px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.vehicle-id-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.vehicle-id-marker {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding: 20px;
}

.vehicle-id-marker.vehicle-id-marker-top {
    justify-content: flex-start;
    padding-top: 24px;
    align-items: flex-start;
}

.vehicle-id-floating-label {
    background: rgba(15, 23, 42, 0.82);
    padding: 8px 14px;
    border-radius: 12px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    pointer-events: auto;
    color: #fff;
    font-weight: 600;
    margin-bottom: 14px;
    text-align: center;
    min-width: 180px;
}

.vehicle-id-label.vehicle-id-label-multi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 14px;
}

.vehicle-id-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.vehicle-id-label-controls {
    pointer-events: auto;
}

.vehicle-id-label-controls .btn-group-sm .btn {
    font-size: 12px;
    padding: 6px 12px;
}

body.vehicle-id-overlay-open {
    overflow: hidden;
}

@media (max-width: 600px) {
    .vehicle-id-overlay {
        padding: 12px;
    }

    .vehicle-id-label {
        width: 100%;
    }

    .vehicle-id-overlay-actions {
        width: 100%;
        justify-content: space-between;
    }
}

.complete-btn {
    font-size: 11px;
    padding: 5px 10px;
}

.load-more-btn {
    width: 100%;
    font-size: 11px;
    padding: 6px;
}

/* =====================================================
   WASH CARD CONTENT
   ===================================================== */
.wash-types-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border-radius: var(--vi-card-radius);
}

.wash-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px 12px 12px 52px;
    margin-bottom: 10px;
    border-left: 4px solid #28a745;
    box-shadow: var(--vi-card-shadow);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
}



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

.wash-title {
    font-size: 14px;
    font-weight: 600;
}

.badge {
    font-size: 11px;
    padding: 3px 8px;
}

.wash-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    font-size: 12px;
    color: #666;
}

.wash-detail-item span {
    display: block;
    font-size: 10px;
    color: #999;
}

.wash-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.wash-card.wash-ok {
    border-left: 6px solid #28a745;
    background: rgba(40, 167, 69, 0.12);
}

.wash-card.wash-not-due {
    border-left: 6px solid #dc3545;
    background: rgba(220, 53, 69, 0.12);
}

/* =====================================================
   HISTORY TABLE
   ===================================================== */
.history-section {
    display: flex;
    flex-direction: column;
    gap: var(--vi-gap);
    flex: 1;
    min-height: 0;
}

.history-title {
    font-weight: 600;
}

.history-table-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.history-table {
    font-size: 12px;
    width: 100%;
}

.history-table th {
    background: #f8f9fa;
    padding: 6px;
    font-size: 11px;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.history-table td {
    padding: 6px;
    border-bottom: 1px solid #f0f0f0;
}

/* =====================================================
   SWIPE MASK
   ===================================================== */
.wash-swipe-mask {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: -18px;
    width: 36px;
    border-radius: 999px;
    background: rgba(40, 167, 69, 0.25);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.wash-card.wash-instance-active .wash-swipe-mask {
    display: flex;
}

.swipe-arrows {
    display: inline-flex;
    gap: 2px;
}

.swipe-arrows span {
    opacity: 0;
    font-size: 13px;
}

@keyframes viSwipeHint {
    0% {
        opacity: 0;
        transform: translateX(0);
    }

    40% {
        opacity: 1;
        transform: translateX(2px);
    }

    80% {
        opacity: 1;
        transform: translateX(6px);
    }

    100% {
        opacity: 0;
        transform: translateX(8px);
    }
}

.wash-card.swipe-hint .swipe-arrows span:nth-child(1) {
    animation: viSwipeHint 1.2s infinite;
}

.wash-card.swipe-hint .swipe-arrows span:nth-child(2) {
    animation: viSwipeHint 1.2s infinite 0.15s;
}

.wash-card.swipe-hint .swipe-arrows span:nth-child(3) {
    animation: viSwipeHint 1.2s infinite 0.3s;
}

.wash-card.swipe-completed .wash-swipe-mask {
    left: 0;
    right: 0;
    width: auto;
    border-radius: 6px;
    background: #28a745;
}

.wash-card.swipe-completed .swipe-arrows::after {
    content: "  ✓";
}

/* =====================================================
   OTHER WASH PICKER
   ===================================================== */
.wash-card-add-other {
    border-left-color: #17a2b8;
    background: rgba(23, 162, 184, 0.08);
}

.other-wash-scroller {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.other-wash-scroller::-webkit-scrollbar {
    height: 6px;
}

.other-wash-scroller::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 999px;
}

.other-wash-pill {
    flex: 0 0 150px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #2fa4d9;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: normal;
    cursor: pointer;
    box-shadow: var(--vi-card-shadow);
    border: none;
}

@media (hover: hover) {
    .other-wash-pill:hover {
        background: #2486b3;
    }
}

.add-other-badge {
    background: #e9f7fb;
    color: #117a8b;
    border-radius: 999px;
}

/* =====================================================
   DESKTOP / TABLET ≥768px
   ===================================================== */
@media (min-width: 821px) {
    .vi-main {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--vi-gap);
    }

    .vi-mobile-hint {
        display: none;
    }

    .wash-types-wrapper,
    .history-table-wrapper {
        flex: 1;
        min-height: 0;
    }

    .wash-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .wash-card-header {
        grid-column: 1 / -1;
    }

    .wash-card-actions {
        margin-top: 0;
        justify-content: flex-end;
        align-items: center;
    }

    #addOtherWashCard .add-wash-select-state {
        max-height: 260px;
        overflow-y: auto;
        padding-right: 6px;
        overscroll-behavior: contain;
    }
}

/* =====================================================
   MOBILE <768px
   ===================================================== */
@media (max-width: 820.98px) {
    /* #vehicleInfoPage .container-fluid1 {
        padding-bottom: calc(var(--vi-footer-gap) * 6);
    } */

    .vi-main {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
    }

    .vi-page-washes,
    .vi-page-history {
        flex: 0 0 100%;
        scroll-snap-align: start;
        min-width: 100%;
        min-height: 0;
    }

    .vi-page-washes .wash-types-wrapper,
    .vi-page-history .history-table-wrapper {
        padding-bottom: calc(var(--vi-gap) * 6);
        min-height: 0;
        flex: 1;
    }

    .wash-card {
        display: block;
        cursor: pointer;
    }

    .wash-card-actions {
        display: none;
    }

    .wash-card-add-other .wash-card-actions {
        display: flex;
        justify-content: flex-end;
    }

    /* #vehicleInfoPage .action-buttons {
        position: sticky;
        bottom: calc(var(--vi-footer-gap) + env(safe-area-inset-bottom, 0));
        background: inherit;
        padding-bottom: env(safe-area-inset-bottom, 0);
        z-index: 20;
    } */
}
.prewash-upload-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.prewash-upload-tile {
    width: 100px;
    height: 100px;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 5px;
    cursor: pointer;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.prewash-upload-tile i {
    font-size: 30px;
    color: #333;
}

.prewash-uploaded-image {
    width: 100px;
    height: 100px;
    position: relative;
    margin: 5px;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.prewash-uploaded-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.prewash-uploaded-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 999px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 12px;
    cursor: pointer;
}
