@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

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

:root {
    --glass:        rgba(255,255,255,0.07);
    --glass-md:     rgba(255,255,255,0.11);
    --glass-hover:  rgba(255,255,255,0.15);
    --border:       rgba(255,255,255,0.14);
    --border-glow:  rgba(99,179,237,0.5);
    --text:         #EEF2FF;
    --text-muted:   rgba(255,255,255,0.55);
    --accent:       #63B3ED;
    --accent-glow:  rgba(99,179,237,0.35);
    --blur:         blur(18px);
}

body {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 800px;
}

/* ── Aurora background ─────────────────────────────────────── */
.aurora-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, #060d20 0%, #0d1f3c 55%, #111f3a 100%);
    overflow: hidden;
}
.aurora-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 36px 36px;
    pointer-events: none;
}
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    animation: blob-drift 22s ease-in-out infinite alternate;
    will-change: transform;
}
.blob-1 {
    width: 70vw; height: 60vh;
    top: -20vh; left: -15vw;
    background: radial-gradient(circle, rgba(59,130,246,0.5) 0%, transparent 70%);
}
.blob-2 {
    width: 55vw; height: 70vh;
    bottom: -25vh; right: -12vw;
    background: radial-gradient(circle, rgba(139,92,246,0.45) 0%, transparent 70%);
    animation-delay: -11s;
    animation-duration: 28s;
}
.blob-3 {
    width: 50vw; height: 45vh;
    top: 45vh; left: 20vw;
    background: radial-gradient(circle, rgba(6,182,212,0.3) 0%, transparent 70%);
    animation-delay: -5s;
    animation-duration: 18s;
}
@keyframes blob-drift {
    0%   { transform: translate(0, 0) scale(1); }
    25%  { transform: translate(5vw, 3vh) scale(1.07); }
    50%  { transform: translate(-3vw, 7vh) scale(0.95); }
    75%  { transform: translate(6vw, -2vh) scale(1.05); }
    100% { transform: translate(-2vw, -5vh) scale(1.08); }
}

/* ── Entrance animations ───────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.app-header { animation: fadeIn 0.4s ease both; }
.car-panel  { animation: fadeUp 0.45s 0.05s ease both; }
.car-card   { animation: fadeUp 0.35s ease both; }
.car-list .car-card:nth-child(1)   { animation-delay: 0.08s; }
.car-list .car-card:nth-child(2)   { animation-delay: 0.14s; }
.car-list .car-card:nth-child(3)   { animation-delay: 0.20s; }
.car-list .car-card:nth-child(4)   { animation-delay: 0.26s; }
.car-list .car-card:nth-child(5)   { animation-delay: 0.32s; }
.car-list .car-card:nth-child(6)   { animation-delay: 0.38s; }
.car-list .car-card:nth-child(7)   { animation-delay: 0.44s; }
.car-list .car-card:nth-child(n+8) { animation-delay: 0.50s; }
.right-panel > *:nth-child(1) { animation: fadeUp 0.4s 0.10s ease both; }
.right-panel > *:nth-child(2) { animation: fadeUp 0.4s 0.20s ease both; }
.right-panel > *:nth-child(3) { animation: fadeUp 0.4s 0.30s ease both; }

/* ── Stats row ─────────────────────────────────────────────── */
.stats-row {
    display: flex;
    gap: 12px;
}
.stat-chip {
    flex: 1;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 18px;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.08);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.stat-chip:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2), 0 0 18px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.08);
}
.stat-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.5px;
}
.stat-accent { color: var(--accent); }
.stat-green  { color: #86efac; }
.stat-purple { color: #C084FC; }

/* ── No-car hint ───────────────────────────────────────────── */
.no-car-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(99,179,237,0.07);
    border: 1px dashed rgba(99,179,237,0.35);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px;
    transition: opacity 0.25s;
}
.no-car-hint-icon { font-size: 18px; opacity: 0.7; }

/* ── Header ────────────────────────────────────────────────── */
.app-header {
    background: rgba(255,255,255,0.06);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--border);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    flex-shrink: 0;
    box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.header-title {
    background: linear-gradient(135deg, #fff 20%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.header-stats {
    display: flex;
    gap: 8px;
    align-items: center;
}
.header-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 12px;
    backdrop-filter: var(--blur);
    transition: border-color 0.2s;
}
.header-stat:hover { border-color: var(--accent); }
.hstat-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}
.hstat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.header-right { display: flex; align-items: center; gap: 14px; }
.header-user  { font-size: 13px; color: var(--text-muted); font-weight: 500; }

.btn-logout {
    background: rgba(255,255,255,0.08);
    color: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
    backdrop-filter: var(--blur);
}
.btn-logout:hover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.3);
}

/* ── Flash messages ────────────────────────────────────────── */
.flash-container { flex-shrink: 0; padding: 10px 20px 0; }
.alert {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
}
.alert-success { background: rgba(34,197,94,0.15);  color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.alert-error   { background: rgba(239,68,68,0.15);   color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }

/* ── Main layout ───────────────────────────────────────────── */
.app-content { display: flex; flex: 1; overflow: hidden; min-height: 0; }

/* ── Left: car panel ───────────────────────────────────────── */
.car-panel {
    width: 38%;
    min-width: 320px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-right: 1px solid var(--border);
    overflow: hidden;
    background: rgba(0,0,0,0.12);
}
.panel-heading {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── Filter buttons ────────────────────────────────────────── */
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
    background: var(--glass);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
    backdrop-filter: var(--blur);
}
.filter-btn:hover {
    background: var(--glass-hover);
    color: var(--text);
    border-color: var(--accent);
}
.filter-btn.active {
    background: rgba(99,179,237,0.2);
    color: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
    box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Car list ──────────────────────────────────────────────── */
.car-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}
.car-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: stretch;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.22s;
    flex-shrink: 0;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
}
.car-card:hover {
    background: var(--glass-hover);
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow), 0 4px 20px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}
.car-card.selected {
    background: rgba(99,179,237,0.15);
    border: 1.5px solid var(--accent);
    box-shadow: 0 0 25px var(--accent-glow), 0 4px 20px rgba(0,0,0,0.3);
}

.car-badge-strip {
    width: 76px;
    min-width: 76px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: white;
    padding: 10px 0;
}
.car-icon     { font-size: 24px; }
.car-ev-badge {
    font-size: 9px;
    font-weight: 700;
    min-height: 12px;
    background: rgba(255,255,255,0.2);
    padding: 1px 5px;
    border-radius: 4px;
}

.car-info     { flex: 1; padding: 10px 12px; }
.car-name     { font-weight: 600; font-size: 13px; color: var(--text); }
.car-detail   { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.car-availability {
    font-size: 10px;
    font-weight: 600;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}
.avail-ok   { background: rgba(34,197,94,0.2);  color: #86efac; }
.avail-busy { background: rgba(239,68,68,0.2);   color: #fca5a5; }

.car-price-badge {
    background: rgba(99,179,237,0.15);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    padding: 5px 11px;
    border-radius: 12px;
    margin: auto 12px auto 6px;
    white-space: nowrap;
    align-self: center;
    border: 1px solid rgba(99,179,237,0.3);
}

/* ── Right panel ───────────────────────────────────────────── */
.right-panel {
    flex: 1;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    min-width: 0;
    min-height: 0;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--glass-md);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    box-shadow: 0 8px 32px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}
.card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
    letter-spacing: -0.1px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
    flex-shrink: 0;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ── Form elements ─────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="password"] {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    color: var(--text);
    background: var(--glass);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    transition: all 0.2s;
    color-scheme: dark;
}
.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--glass-md);
}
.form-group input::placeholder { color: var(--text-muted); }

.date-row { display: flex; gap: 16px; }
.date-row .form-group { flex: 1; }

.price-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(99,179,237,0.08);
    border-radius: 10px;
    border: 1px solid rgba(99,179,237,0.2);
}
.price-label { font-size: 16px; font-weight: 700; color: var(--accent); }
.availability-badge { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.badge-available   { background: rgba(34,197,94,0.2);  color: #86efac; }
.badge-unavailable { background: rgba(239,68,68,0.2);  color: #fca5a5; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 9px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
    letter-spacing: 0.1px;
    position: relative;
    overflow: hidden;
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, #2B6CB0, #4299E1);
    color: white;
    box-shadow: 0 4px 15px rgba(66,153,225,0.4);
    border: 1px solid rgba(255,255,255,0.15);
}
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 55%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}
.btn-primary:hover::after  { left: 160%; }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(66,153,225,0.6); }

.btn-danger {
    background: linear-gradient(135deg, #C53030, #FC8181);
    color: white;
    box-shadow: 0 4px 15px rgba(239,68,68,0.3);
}
.btn-success {
    background: linear-gradient(135deg, #276749, #48BB78);
    color: white;
    box-shadow: 0 4px 15px rgba(72,187,120,0.3);
}
.btn-secondary {
    background: var(--glass-md);
    color: var(--text);
    border: 1px solid var(--border);
    backdrop-filter: var(--blur);
}
.btn-full { width: 100%; padding: 11px; font-size: 14px; }
.btn-sm   { padding: 4px 10px; font-size: 11px; border-radius: 6px; }

/* ── Bookings table ────────────────────────────────────────── */
.bookings-card { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.table-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.table-controls label { color: var(--text-muted); }
.table-controls select,
.table-controls input[type="text"],
.table-controls input[type="date"] {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    background: var(--glass);
    color: var(--text);
    backdrop-filter: var(--blur);
    cursor: pointer;
    color-scheme: dark;
}
.table-controls input[type="text"]:focus,
.table-controls input[type="date"]:focus,
.table-controls select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}
.booking-search { width: 130px; cursor: text; }
.date-sep { color: var(--text-muted); }

.table-wrapper {
    flex: 1;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
}
.bookings-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bookings-table th {
    text-align: left;
    padding: 10px 10px;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: var(--blur);
}
.bookings-table td {
    padding: 10px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    vertical-align: middle;
    color: var(--text);
}
.bookings-table tr:last-child td { border-bottom: none; }
.bookings-table tbody tr:hover td {
    background: rgba(99,179,237,0.07);
}

.status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    display: inline-block;
}
.status-confirmed { background: rgba(99,179,237,0.2);  color: #90CDF4; border: 1px solid rgba(99,179,237,0.3); }
.status-cancelled { background: rgba(239,68,68,0.15);  color: #FCA5A5; border: 1px solid rgba(239,68,68,0.3); }
.status-completed { background: rgba(34,197,94,0.15);  color: #86EFAC; border: 1px solid rgba(34,197,94,0.3); }

/* ── Auth page ─────────────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: auto;
    height: auto;
}
.auth-container { width: 100%; max-width: 430px; padding: 20px; }
.auth-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 24px;
    padding: 44px;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: 0 30px 70px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.15);
    animation: fadeUp 0.5s ease both;
}
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-header::after {
    content: '';
    display: block;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    margin: 18px auto 0;
    border-radius: 2px;
    opacity: 0.7;
}

/* ── Auth logo circle ──────────────────────────────────────── */
.auth-logo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
}
.logo-bg {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, rgba(99,179,237,0.3) 0%, rgba(59,130,246,0.12) 65%, transparent 100%);
    border: 1px solid rgba(99,179,237,0.4);
    box-shadow: 0 0 24px rgba(99,179,237,0.2), inset 0 1px 0 rgba(255,255,255,0.15);
}
.logo-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(99,179,237,0.2);
    animation: logo-pulse 3s ease-in-out infinite;
}
.logo-ring-2 {
    position: absolute;
    inset: -24px;
    border-radius: 50%;
    border: 1px solid rgba(99,179,237,0.09);
    animation: logo-pulse 3s ease-in-out 0.6s infinite;
}
@keyframes logo-pulse {
    0%, 100% { transform: scale(1);    opacity: 1; }
    50%       { transform: scale(1.06); opacity: 0.35; }
}
.auth-icon { font-size: 36px; position: relative; z-index: 1; display: block; line-height: 1; }

.auth-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 20%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-tagline {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 5px;
    font-weight: 400;
    letter-spacing: 0.1px;
}

.tab-bar {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 22px;
    background: rgba(0,0,0,0.2);
    padding: 3px;
    gap: 3px;
}
.tab-btn {
    flex: 1;
    padding: 9px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.18s;
    border-radius: 7px;
}
.tab-btn.active {
    background: rgba(99,179,237,0.2);
    color: var(--accent);
    box-shadow: 0 0 14px rgba(99,179,237,0.3), inset 0 1px 0 rgba(99,179,237,0.25);
    border: 1px solid rgba(99,179,237,0.3);
}

/* ── Date warning ──────────────────────────────────────────── */
#dateWarning {
    background: rgba(239,68,68,0.15) !important;
    border: 1px solid rgba(239,68,68,0.3) !important;
    color: #fca5a5 !important;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.35); }

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, .blob { animation: none !important; transition: none !important; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 960px) {
    body { height: auto; min-height: 100vh; overflow-y: auto; overflow-x: hidden; min-width: unset; }
    .app-content { flex-direction: column; overflow: visible; height: auto; }
    .car-panel { width: 100%; min-width: unset; border-right: none; border-bottom: 1px solid var(--border); overflow: visible; }
    .car-list { max-height: 320px; }
    .right-panel { overflow-y: visible; }
    .bookings-card { min-height: unset; }
    .table-wrapper { overflow-x: auto; }
    .header-stats { display: none; }
}
