/* ===== Tokens ===== */
:root {
    --bg: #0f1522;
    --panel: rgba(255, 255, 255, .06);
    --panel-border: rgba(255, 255, 255, .12);
    --text: #fff;
    --muted: rgba(255, 255, 255, .75);
    --muted-2: rgba(255, 255, 255, .6);

    --card-bg: rgba(255, 255, 255, .09);
    --card-border: rgba(255, 255, 255, .18);
    --card-hover: rgba(255, 255, 255, .14);

    --ok: #37d67a;
    --pending: #ffcc00;

    --r-xl: 16px;
    --r-lg: 12px;
    --r-pill: 999px;

    --shadow-1: 0 8px 24px rgba(0, 0, 0, .25);
}

/* ===== Shell (keeps app-page) ===== */
.app-page.unit-search {
    background: linear-gradient(180deg, #0b1020 0%, #0f1522 60%, #0f1522 100%);
    padding: clamp(12px, 2vw, 24px);
    color: var(--text);
}

.unit-shell {
    max-width: 980px;
    margin: 0 auto;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--r-xl);
    padding: clamp(14px, 2.6vw, 28px);
    box-shadow: var(--shadow-1);
}

/* ===== Header ===== */
.unit-header {
    text-align: center;
    margin-bottom: 12px;
}

.unit-title {
    margin: 0;
    font-size: clamp(1.25rem, 2.2vw, 1.6rem);
    font-weight: 800;
}

.unit-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

/* ===== Search (no button) ===== */
.searchbar {
    display: grid;
    grid-template-columns: 36px 1fr;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid var(--panel-border);
    border-radius: var(--r-lg);
    padding: 10px;
}

.search-icon {
    display: grid;
    place-items: center;
    color: var(--muted-2);
}

.searchbar input {
    appearance: none;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    padding: 8px 6px;
    min-width: 0;
}

.searchbar input::placeholder {
    color: rgba(255, 255, 255, .5);
}

/* ===== Recently washed ===== */
.recent {
    margin-top: 20px;
}

.recent-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

/* Mobile: vertical column with its own scroll
   Tablet/desktop: grid */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 48vh;
    /* adjust if needed */
    overflow-y: auto;
    /* vertical scroll on mobile */
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    /* room for scrollbar */
}

.recent-list::-webkit-scrollbar {
    width: 8px;
}

.recent-list::-webkit-scrollbar-thumb {
    background: var(--panel-border);
    border-radius: 8px;
}

@media (min-width:720px) {
    .recent-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 12px;
        max-height: none;
        /* let the page scroll */
        overflow: visible;
        padding-right: 0;
    }
}

/* ===== Card ===== */
.recent-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--r-lg);
    padding: 14px;
    transition: background .12s ease, transform .08s ease, box-shadow .12s ease;
}

.recent-card:hover {
    background: var(--card-hover);
    transform: translateY(-1px);
}

/* Header inside card: Fleet/Rego primary, Type beneath */
.veh-header {
    margin-bottom: 8px;
}

.veh-id {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.id-sep {
    opacity: .6;
}

.veh-type {
    margin-top: 2px;
    color: var(--muted);
    font-size: .9rem;
}

/* Owner + Location row */
.veh-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    color: var(--muted);
    font-size: .85rem;
    margin-bottom: 10px;
}

.veh-owner,
.veh-location {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width:640px) {
    .veh-details {
        grid-template-columns: 1fr 1fr;
    }
}

/* Wash tags */
.wash-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.wash-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--r-pill);
    border: 1px solid var(--panel-border);
    padding: 6px 10px;
    font-size: .82rem;
    color: var(--text);
    background: rgba(255, 255, 255, .06);
}

.wash-tag::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .15) inset;
}

.wash-tag.done::before {
    background: var(--ok);
}

.wash-tag.pending::before {
    background: var(--pending);
}

/* Time-ago line */
.time-ago {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .8rem;
    color: var(--muted-2);
}

.time-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted-2);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .15) inset;
}

/* Motion prefs */
@media (prefers-reduced-motion:reduce) {
    .recent-card {
        transition: none;
    }
}

/* Container wrapper for each autocomplete item */
.aa-item-wrapper {
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
}

/* Top row: title + type */
.aa-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

/* SearchIndex (main title) */
.aa-item-title {
    font-weight: 600;
    font-size: 15px;
    color: #222;
    margin-right: 8px;
}

/* Type (aligned to right) */
.aa-item-type {
    font-size: 13px;
    color: #666;
    text-transform: capitalize;
}

/* Owner (beneath, smaller and lighter) */
.aa-item-owner {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.aa-no-results {
    padding: 0;
    margin: 0;
}

/* Make the button span full width of the dropdown row */

/* Reset Algolia's dropdown styles for the button */
.aa-no-results {
    padding: 8px;
    background: #fff;
    text-align: center;
}

/* Force the Bootstrap look */
.aa-btn-fix.btn {
    display: block !important;
    width: 100% !important;
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #fff !important;
    padding: 0.5rem 1rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    border-radius: 0.375rem !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Hover & focus states */
.aa-btn-fix.btn:hover,
.aa-btn-fix.btn:focus {
    background-color: #0b5ed7 !important;
    border-color: #0a58ca !important;
    color: #fff !important;
}

/* Remove weird Algolia transitions / shadows */
.aa-btn-fix {
    box-shadow: none !important;
    transition: background-color 0.15s ease-in-out;
}

.site-cards {
    display: grid;
    grid-template-columns: 1fr;
    /* one full-width column */
    gap: 12px;
}

.site-heading-wrap {
    margin-bottom: .5rem;
}

.site-heading {
    margin: 0 .5rem 0 0;
    display: inline-block;
}

.site-subheading {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    align-items: center;
}

.site-date {
    opacity: .85;
}

.wash-tallies {
    display: inline-flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.wash-tally {
    font-size: .875rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, .06);
}

.site-cards {
    display: grid;
    gap: 12px;
}

@media (min-width:768px) {
    .site-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width:1200px) {
    .site-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

#recentlyWashedSearchList {
    display: block;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* consistent space between site groups */
}

.aa-preferred-badge {
    display: inline-block;
    background-color: #28a745;
    /* Bootstrap “success” green */
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 9999px;
    /* full pill shape */
    padding: 3px 10px;
    margin-left: 8px;
    line-height: 1;
    letter-spacing: 0.4px;
    box-shadow: 0 1px 3px rgba(40, 167, 69, 0.3);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.aa-preferred-badge:hover {
    background-color: #218838;
    /* slightly darker green */
    box-shadow: 0 2px 5px rgba(33, 136, 56, 0.4);
}