/* ==========================================================
   Just Ride Mysore - global styles
   Place at: src/main/resources/static/css/style.css
   ========================================================== */

:root {
    --ink: #10201b;
    --silk: #1d5c46;
    --silk-dark: #14402f;
    --marigold: #f5a623;
    --marigold-dark: #dd9112;
    --paper: #fbfbf8;
    --line: #d5dad3;
    --muted: #5d6b64;
    --danger: #b3261e;
    --radius: 12px;
    --header-h: 72px;
    --font: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }
.is-hidden { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;

    /*color: #fff;
    background-color: var(--silk-dark); background-image:
        linear-gradient(rgba(10, 24, 19, 0.45), rgba(10, 24, 19, 0.55)),
        url('../images/just_ride_mysore_logo.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;*/

    color: var(--ink);
        background:
            linear-gradient(
                180deg,
                #f4f7f3 0%,
                #ffffff 50%,
                #f4f7f3 100%
            );
}

:focus-visible {
    outline: 3px solid var(--marigold);
    outline-offset: 2px;
}

/* ---------------- Header / Navbar ---------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    background: #173f32;
    color: #fff;
    border-bottom: 3px solid var(--marigold);
    box-shadow: 0 5px 18px rgba(16, 32, 27, 0.14);
}

.site-header__inner {
    width: min(100% - 40px, 1360px);
    min-height: 82px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 0;
}

.brand__logo {
    display: block;
    width: auto;
    height: 58px;
    max-width: 180px;
    object-fit: contain;
    border-radius: 4px;
}

.site-header__menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1 1 auto;
    min-width: 0;
    gap: 28px;
}

.site-header__links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #f7faf7;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .16);
}

.auth-nav {
    flex: 0 0 auto;
    min-width: 0;
}

.auth-nav__group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.greeting {
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    color: #f7faf7;
    font-size: .95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.greeting strong { font-weight: 700; color: #fff; }

.nav-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 12px;
    color: #fff;
    background: rgba(255, 255, 255, .08);
    cursor: pointer;
}

.nav-toggle__icon,
.nav-toggle__icon::before,
.nav-toggle__icon::after {
    display: block;
    width: 21px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .18s ease;
}

.nav-toggle__icon { position: relative; }
.nav-toggle__icon::before,
.nav-toggle__icon::after { content: ""; position: absolute; left: 0; }
.nav-toggle__icon::before { transform: translateY(-6px); }
.nav-toggle__icon::after { transform: translateY(6px); }

.nav-toggle-input:checked + .nav-toggle .nav-toggle__icon { background: transparent; }
.nav-toggle-input:checked + .nav-toggle .nav-toggle__icon::before { transform: rotate(45deg); }
.nav-toggle-input:checked + .nav-toggle .nav-toggle__icon::after { transform: rotate(-45deg); }
.nav-toggle-input:focus-visible + .nav-toggle { outline: 3px solid var(--marigold); outline-offset: 3px; }

/* ---------------- Buttons ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 11px 19px;
    border: 2px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-size: .95rem;
    font-weight: 650;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[disabled] { opacity: .65; cursor: not-allowed; transform: none; }

.btn--primary {
    background: var(--marigold);
    color: #17251f;
    border-color: var(--marigold);
    box-shadow: 0 3px 10px rgba(245, 166, 35, .18);
}
.btn--primary:hover { background: #ffc04d; border-color: #ffc04d; }

.btn--outline {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, .72);
}
.btn--outline:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }

.btn--block { display: flex; width: 100%; min-height: 48px; padding: 14px 18px; border-radius: 12px; }
.btn--ghost { background: transparent; color: var(--silk); border-color: var(--silk); }
.btn--ghost:hover { background: rgba(29, 92, 70, .08); }

.link-btn {
    display: inline;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: var(--silk);
    font: inherit;
    font-size: inherit;
    font-weight: 650;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.link-btn:hover { color: var(--silk-dark); }
.link-btn:disabled, .link-btn[disabled] { color: var(--muted); cursor: default; text-decoration: none; }

/* ---------------- Dialog ---------------- */

.dialog {
    width: min(440px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: var(--paper);
    color: var(--ink);
    overflow: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.dialog[open] { animation: dialog-in 0.18s ease-out; }
.dialog::backdrop {
    background: rgba(10, 24, 19, 0.6);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

@keyframes dialog-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

.dialog__panel { position: relative; padding: 15px 24px 24px; }

.dialog__close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}
.dialog__close:hover { background: #eceee9; color: var(--ink); }

.dialog__title { margin: 0 32px 6px 0; font-size: 1rem; line-height: 1.2; font-weight: 700; color: #006400;}
.dialog__sub { margin: 0 0 20px; color: var(--muted); font-size: 0.95rem; }
.dialog__switch { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 0.925rem; }
.dialog__row { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 0.925rem; }

/* ---------------- Form fields ---------------- */

.field { margin-bottom: 14px; flex: 1; min-width: 0; }
.field-row { display: flex; gap: 12px; }

.field label { display: block; /*margin-bottom: 6px;*/ font-size: 0.9rem; font-weight: 500; }
.optional { color: var(--muted); font-weight: 400; }

.field input {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    font-size: 1rem; /* 16px+ stops iOS zoom on focus */
    color: var(--ink);
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { outline: none; border-color: var(--silk); box-shadow: 0 0 0 3px rgba(29, 92, 70, 0.2); }
.field input[aria-invalid="true"] { border-color: var(--danger); }

.field__error,
.form-error {
    margin: 5px 0 0;
    min-height: 0;
    font-size: 0.85rem;
    color: var(--danger);
}
.field__error:empty,
.form-error:empty { display: none; }
.form-error { margin: 0 0 12px; font-size: 0.9rem; }

/* ---------------- OTP ---------------- */

.otp { display: flex; gap: 8px; margin-bottom: 16px; }

.otp__digit {
    flex: 1;
    min-width: 0;
    max-width: 56px;
    height: 58px;
    padding: 0;
    text-align: center;
    font: inherit;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink);
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 10px;
}
.otp__digit:focus { outline: none; border-color: var(--silk); box-shadow: 0 0 0 3px rgba(29, 92, 70, 0.2); }
.otp--error .otp__digit { border-color: var(--danger); }

/* ---------------- Toast ---------------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 100;
    max-width: calc(100vw - 32px);
    padding: 12px 20px;
    border-radius: 999px;
    background: var(--ink);
    color: #fff;
    font-size: 0.95rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- Responsive navbar and small screens ---------------- */

@media (max-width: 900px) {
    .site-header__inner {
        position: relative;
        width: calc(100% - 32px);
        min-height: 76px;
        gap: 16px;
        flex-wrap: wrap;
    }

    .brand__logo { height: 52px; }
    .nav-toggle { display: inline-flex; margin-left: auto; }

    .site-header__menu {
        display: none;
        flex: 0 0 100%;
        width: 100%;
        padding: 4px 0 18px;
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .nav-toggle-input:checked ~ .site-header__menu { display: flex; }

    .site-header__links {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        gap: 4px;
    }

    .nav-link {
        justify-content: flex-start;
        width: 100%;
        min-height: 44px;
        padding: 11px 14px;
    }

    .auth-nav { width: 100%; }
    .auth-nav__group {
        width: 100%;
        justify-content: stretch;
        flex-wrap: wrap;
        gap: 10px;
    }

    .auth-nav__group > .btn { flex: 1 1 120px; }
    .greeting {
        max-width: 100%;
        flex: 1 1 100%;
        padding: 4px 2px;
    }
}

@media (max-width: 520px) {
    :root { --header-h: 68px; }
    .site-header__inner { width: calc(100% - 24px); min-height: 68px; gap: 12px; }
    .brand__logo { height: 46px; max-width: 150px; }
    .nav-toggle { width: 42px; height: 42px; }
    .btn { padding: 10px 14px; font-size: 0.9rem; }
    .field-row { flex-direction: column; gap: 0; }
    body { background-attachment: scroll; }
}

@media (prefers-reduced-motion: reduce) {
    .dialog[open] { animation: none; }
    .toast, .btn, .field input { transition: none; }
}

/* ==========================================================
   HOME PAGE - VEHICLE SEARCH
   ========================================================== */

.home-page {
    min-height: calc(100vh - var(--header-h));
}

/* ==========================================================
   VEHICLES PAGE
   ========================================================== */

.vehicles-page { max-width: 1200px; margin: 0 auto; padding: 24px 20px 48px; }

.vehicles-toolbar {
    display: flex; flex-wrap: wrap; align-items: center;
    justify-content: space-between; gap: 12px; margin-bottom: 18px;
}
.vehicles-title { margin: 0; font-size: 1.75rem; }
.vehicles-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.search-input {
    width: min(320px, 100%);
    padding: 11px 16px;
    font: inherit; font-size: 1rem;
    color: var(--ink); background: #fff;
    border: 1.5px solid var(--line); border-radius: 999px;
}
.search-input:focus { outline: none; border-color: var(--silk); box-shadow: 0 0 0 3px rgba(29, 92, 70, 0.2); }

.vehicles-status { min-height: 1.5em; color: var(--muted); margin: 0 0 12px; }

.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }

.vehicle-card {
    display: flex; flex-direction: column;
    background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
    box-shadow: 0 2px 8px rgba(16, 32, 27, 0.06);
}
.vehicle-card__media {
    position: relative; aspect-ratio: 16 / 10;
    background: #e9eee8; display: grid; place-items: center;
}
.vehicle-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vehicle-card__noimg { font-size: 3rem; }

.badge {
    position: absolute; top: 10px; left: 10px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600; color: #fff;
}
.badge--on { background: var(--silk); }
.badge--off { background: var(--muted); }

.vehicle-card__body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; }
.vehicle-card__name { margin: 0; font-size: 1.15rem; line-height: 1.25; }
.vehicle-card__meta { margin: 0; color: var(--muted); font-size: 0.9rem; text-transform: capitalize; }
.vehicle-card__loc { margin: 0; font-size: 0.9rem; }

.vehicle-card__prices {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
    margin: 8px 0 12px; padding: 10px 0 0; border-top: 1px dashed var(--line);
}
.vehicle-card__prices div { text-align: center; min-width: 0; }
.vehicle-card__prices dt { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.vehicle-card__prices dd { margin: 0; font-size: 0.85rem; font-weight: 600; }
.vehicle-card__body .btn { margin-top: auto; }

.btn--ghost { background: transparent; color: var(--silk); border-color: var(--silk); }
.btn--ghost:hover { background: rgba(29, 92, 70, 0.08); }

/* dialog additions */
.dialog--wide { width: min(640px, calc(100vw - 24px)); }
.field-row--4 .field { min-width: 0; }
.form-section { margin: 6px 0 8px; font-size: 0.85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.field select,
.field input[type="file"] {
    width: 100%; padding: 11px 14px; font: inherit; font-size: 1rem;
    color: var(--ink); background: #fff;
    border: 1.5px solid var(--line); border-radius: 10px;
}
.field select:focus { outline: none; border-color: var(--silk); box-shadow: 0 0 0 3px rgba(29, 92, 70, 0.2); }

.image-preview { display: block; margin-top: 10px; max-width: 100%; max-height: 160px; border-radius: 10px; border: 1px solid var(--line); }
.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 16px; font-size: 0.95rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--silk); }

@media (max-width: 520px) {
    .vehicles-page { padding: 16px 12px 40px; }
    .vehicles-tools { width: 100%; }
    .search-input { flex: 1; }
    .field-row--4 { flex-direction: row; flex-wrap: wrap; gap: 12px; }
    .field-row--4 .field { flex: 1 1 calc(50% - 6px); }
}