/* ═══════════════════════════════════════════
   Hookah Auto — Dark Fleet Dashboard
   Palette: #D9EF92 / #000 / #808284 / #FFF
   Font: Gantari (Google Fonts)
   ═══════════════════════════════════════════ */

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

:root {
    --lime: #D9EF92;
    --lime-dim: rgba(217, 239, 146, 0.15);
    --lime-mid: rgba(217, 239, 146, 0.3);
    --black: #000000;
    --bg: #0a0a0a;
    --surface: #141414;
    --surface-2: #1c1c1c;
    --surface-3: #252525;
    --border: #2a2a2a;
    --border-light: #333;
    --gray: #808284;
    --gray-light: #a0a2a4;
    --white: #ffffff;
    --text: #e8e8e8;
    --text-muted: #808284;

    --ok: #4ade80;
    --warning: #facc15;
    --danger: #f87171;

    --radius: 14px;
    --radius-sm: 8px;
    --radius-xs: 6px;
}

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

body {
    font-family: 'Gantari', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
}

/* ═══════ Sidebar Nav ═══════ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.5rem;
}

.sidebar-brand .brand-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--white);
    letter-spacing: -0.02em;
}

.sidebar-brand .brand-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 0.15rem;
}

.nav-links {
    flex: 1;
    padding: 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}
.nav-link:hover {
    background: var(--surface-2);
    color: var(--white);
}
.nav-link.active {
    background: var(--lime-dim);
    color: var(--lime);
}
.nav-link .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.nav-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-bottom {
    padding: 0 0.75rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.nav-link.nav-logout { color: var(--danger); }
.nav-link.nav-logout:hover { background: rgba(248, 113, 113, 0.1); }

/* Main content */
.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 2rem 2.5rem;
    max-width: 1400px;
}

/* ═══════ Page Header ═══════ */
.page-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 2rem;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.03em;
}

h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.date-badge {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* ═══════ Vehicle Grid ═══════ */
.vehicles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}

/* ═══════ Vehicle List (compact rows) ═══════ */
.vehicles-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 2.5rem;
}

.vehicle-row {
    display: grid;
    grid-template-columns: 40px 160px 100px 150px 100px 80px 80px 50px;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.1rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.vehicle-row:hover {
    border-color: var(--border-light);
    background: var(--surface-2);
}

.vr-photo { flex-shrink: 0; }
.vr-photo img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }
.vr-photo-ph { width: 40px; height: 40px; background: var(--surface-3); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }

.vr-identity { }
.vr-plate { display: block; font-size: 0.95rem; font-weight: 700; color: var(--white); letter-spacing: 0.03em; }
.vr-name { display: block; font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

.vr-metric { }
.vr-label { display: block; font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 0.1rem; }
.vr-value { display: block; font-size: 0.85rem; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

.vr-status { display: flex; align-items: center; gap: 0.5rem; justify-content: flex-end; }

.vehicle-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.vehicle-card:hover {
    border-color: var(--border-light);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 0;
}

.vehicle-photo img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
}
.photo-placeholder {
    width: 56px;
    height: 56px;
    background: var(--surface-3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 8px currentColor;
}
.status-green, .status-ok { background: var(--ok); color: var(--ok); }
.status-yellow, .status-warning { background: var(--warning); color: var(--warning); }
.status-red, .status-danger { background: var(--danger); color: var(--danger); }

.card-body { padding: 1rem 1.25rem 1.25rem; }

.plate-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}

.vehicle-name {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.card-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}
.card-stat .label { color: var(--text-muted); }
.card-stat .value { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

.progress-bar {
    height: 4px;
    background: var(--surface-3);
    border-radius: 2px;
    margin-top: 0.75rem;
    overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.progress-green { background: var(--ok); }
.progress-yellow { background: var(--warning); }
.progress-red { background: var(--danger); }

.incidents-badge {
    display: inline-block;
    margin-top: 0.6rem;
    background: rgba(248, 113, 113, 0.12);
    color: var(--danger);
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-weight: 600;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 4rem 2rem;
    font-size: 0.95rem;
}

/* ═══════ Alerts Panel ═══════ */
.alerts-panel { margin-bottom: 2.5rem; }

.alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    transition: border-color 0.15s;
}
.alert-item:hover { border-color: var(--border-light); }

.alert-info { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.alert-plate { font-weight: 700; color: var(--white); }
.alert-type {
    font-size: 0.65rem;
    background: var(--surface-3);
    color: var(--text-muted);
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.alert-message { color: var(--text-muted); font-size: 0.85rem; }

.alert-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.inline-form { display: inline; }

/* ═══════ Buttons ═══════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.1rem;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    letter-spacing: -0.01em;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.75rem; }

.btn-primary {
    background: var(--lime);
    color: var(--black);
}
.btn-primary:hover { background: #e4f5a0; box-shadow: 0 4px 16px rgba(217, 239, 146, 0.25); }

.btn-success { background: var(--ok); color: var(--black); }
.btn-warning { background: var(--warning); color: var(--black); }
.btn-danger { background: var(--danger); color: var(--white); }

.btn-muted {
    background: var(--surface-3);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-muted:hover { background: var(--border-light); color: var(--text); }

/* ═══════ Events Feed ═══════ */
.events-list { list-style: none; }
.event-item {
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
}
.event-time { color: var(--text-muted); font-family: 'Gantari', monospace; font-variant-numeric: tabular-nums; }
.event-actor { font-weight: 600; color: var(--lime); }
.event-details { color: var(--text-muted); }

/* ═══════ Login ═══════ */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.form-group { margin-bottom: 1.1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--lime);
    box-shadow: 0 0 0 3px var(--lime-dim);
}
.form-group input::placeholder { color: var(--gray); }

.login-card .btn { width: 100%; margin-top: 0.5rem; padding: 0.7rem; font-size: 0.95rem; }

.alert-danger {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-xs);
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ═══════ Data Tables ═══════ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    font-size: 0.85rem;
}
.data-table th, .data-table td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--surface-2); }

/* ═══════ Form Card ═══════ */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.form-card select {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
}

/* ═══════ Status Banner ═══════ */
.status-banner {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}
.status-banner-green { background: rgba(74, 222, 128, 0.08); border: 1px solid rgba(74, 222, 128, 0.2); color: var(--ok); }
.status-banner-yellow { background: rgba(250, 204, 21, 0.08); border: 1px solid rgba(250, 204, 21, 0.2); color: var(--warning); }
.status-banner-red { background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.2); color: var(--danger); }

/* ═══════ Section spacing ═══════ */
.section { margin-bottom: 2rem; }

/* ═══════ Photo Grid ═══════ */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.photo-slot {
    aspect-ratio: 4/3;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
}
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .placeholder { color: var(--text-muted); font-size: 0.8rem; font-weight: 500; }

/* ═══════ Chart container ═══════ */
.chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

/* ═══════ Metric cells (drivers) ═══════ */
.metric-collecting {
    cursor: help;
}
.metric-collecting .metric-label {
    color: var(--text-muted);
    font-size: 0.8rem;
}
.metric-value-warning { color: var(--warning); font-weight: 600; }
.metric-value-danger { color: var(--danger); font-weight: 600; }

/* ═══════ Utilities ═══════ */
[hidden] { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-lime { color: var(--lime); }
.font-mono { font-variant-numeric: tabular-nums; }

/* ═══════ Responsive ═══════ */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 1.25rem; }
    .vehicles-grid { grid-template-columns: 1fr; }
    .photo-grid { grid-template-columns: repeat(2, 1fr); }
    .alert-item { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
}
