/* ============================================================
   KFZBuddy.eu — Stylesheet
   Cockpit/Bordbuch-Look: Graphit-Dunkel, Warnlicht-Amber,
   Digital-Readout-Teal. Mobil-optimiert, installierbar als PWA.
   ============================================================ */

:root {
    /* Flächen */
    --bg:        #0d1014;
    --bg-2:      #12171d;
    --surface:   #1a212a;
    --surface-2: #212b36;
    --line:      #2a333f;
    --line-soft: #222b35;

    /* Text */
    --ink:   #e8edf1;
    --ink-2: #9aa7b4;
    --ink-3: #6b7886;

    /* Akzente */
    --amber:      #ffb627;
    --amber-700:  #d99412;
    --amber-soft: rgba(255, 182, 39, 0.12);
    --teal:       #34d3c0;
    --teal-soft:  rgba(52, 211, 192, 0.12);
    --danger:     #ff5a5f;
    --danger-soft:rgba(255, 90, 95, 0.12);

    --font-display: 'Chakra Petch', system-ui, sans-serif;
    --font-body:    'Inter', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, monospace;

    --radius:    14px;
    --radius-sm: 10px;
    --shadow:    0 8px 30px rgba(0, 0, 0, 0.45);
    --maxw:      1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(1100px 600px at 85% -10%, rgba(255, 182, 39, 0.06), transparent 60%),
        radial-gradient(900px 500px at -10% 0%, rgba(52, 211, 192, 0.05), transparent 55%),
        var(--bg);
    background-attachment: fixed;
    line-height: 1.55;
    min-height: 100vh;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.2px; margin: 0; }
a { color: var(--amber); text-decoration: none; }
.muted { color: var(--ink-2); font-weight: 400; }
small.muted { font-size: 0.8em; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    font-family: var(--font-display); font-weight: 600; font-size: 14px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 11px 16px; min-height: 42px; cursor: pointer;
    transition: transform .06s ease, background .15s ease, border-color .15s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 34px; padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

.btn-primary { background: var(--amber); color: #1a1206; border-color: var(--amber); }
.btn-primary:hover { background: #ffc24d; }

.btn-soft { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-soft:hover { border-color: var(--amber); color: #fff; }

.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-2); }

.btn-danger-ghost { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); }

.btn-google { background: #fff; color: #1f1f1f; border-color: #fff; }
.btn-google:hover { background: #f1f1f1; }

/* ============================================================
   AUTH (Login / Registrierung)
   ============================================================ */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    padding: 24px 18px; min-height: 100vh; min-height: 100dvh;
}
.auth-shell { width: 100%; max-width: 420px; }
.auth-card {
    background: linear-gradient(180deg, var(--surface), var(--bg-2));
    border: 1px solid var(--line);
    border-radius: 20px; padding: 30px 26px 28px;
    box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.auth-logo { display: inline-flex; filter: drop-shadow(0 4px 12px rgba(255, 182, 39, 0.3)); }
.auth-title { font-size: 26px; letter-spacing: 0.5px; }
.auth-title span { color: var(--amber); }
.auth-sub { margin: 2px 0 0; color: var(--ink-2); font-size: 13.5px; }

.tab-bar {
    display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line);
    border-radius: 12px; padding: 4px; margin-bottom: 20px;
}
.tab-btn {
    flex: 1; border: 0; background: transparent; color: var(--ink-2);
    font-family: var(--font-display); font-weight: 600; font-size: 14px;
    padding: 10px; border-radius: 9px; cursor: pointer; transition: all .15s ease;
}
.tab-btn.active { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

.tab-content { display: none; flex-direction: column; gap: 14px; }
.tab-content.active { display: flex; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); font-family: var(--font-display); }
.field.inline { flex-direction: row; align-items: center; gap: 10px; }
.field.inline > span { white-space: nowrap; }

input, select, textarea {
    width: 100%; font-family: var(--font-body); font-size: 15px; color: var(--ink);
    background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 12px 13px; transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-soft);
}
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239aa7b4' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}

.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 12px; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.auth-foot { text-align: center; margin: 18px 0 0; font-size: 12px; }

.alert { border-radius: var(--radius-sm); padding: 11px 13px; font-size: 13.5px; margin-bottom: 16px; }
.alert-error { background: var(--danger-soft); color: #ffb3b5; border: 1px solid rgba(255, 90, 95, 0.3); }

/* ============================================================
   APP-LAYOUT
   ============================================================ */
.appbar {
    position: sticky; top: 0; z-index: 30;
    background: rgba(13, 16, 20, 0.85); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.appbar-inner {
    max-width: var(--maxw); margin: 0 auto; padding: 12px 18px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: inline-flex; }
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: 0.5px; color: var(--ink); }
.brand-text span { color: var(--amber); }

.appbar-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.avatar-fallback {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--amber-soft); color: var(--amber); font-family: var(--font-display);
    font-weight: 700; font-size: 14px;
}
.user-name { font-size: 14px; font-weight: 500; }

/* Tabs */
.tabs { border-bottom: 1px solid var(--line); background: rgba(13, 16, 20, 0.6); }
.tabs-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 10px; display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.tabs-inner::-webkit-scrollbar { display: none; height: 0; }
.nav-tab {
    border: 0; background: transparent; color: var(--ink-2);
    font-family: var(--font-display); font-weight: 600; font-size: 14.5px;
    padding: 13px 16px; cursor: pointer; position: relative; white-space: nowrap;
    transition: color .15s ease;
}
.nav-tab::after {
    content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px;
    background: var(--amber); border-radius: 2px; transform: scaleX(0); transition: transform .18s ease;
}
.nav-tab:hover { color: var(--ink); }
.nav-tab.active { color: var(--ink); }
.nav-tab.active::after { transform: scaleX(1); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 24px 18px 60px; }

.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.view-head h1 { font-size: clamp(24px, 5vw, 32px); }
.section-title { font-size: 16px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 1.5px; margin: 26px 0 14px; }

/* ---------- Erinnerungen-Panel (Warnlicht) ---------- */
.reminders-panel {
    background: linear-gradient(180deg, rgba(255, 182, 39, 0.07), rgba(255, 182, 39, 0.02));
    border: 1px solid rgba(255, 182, 39, 0.25); border-radius: var(--radius);
    padding: 16px 18px;
}
.panel-label { font-family: var(--font-display); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.dot-warn {
    width: 10px; height: 10px; border-radius: 50%; background: var(--amber);
    box-shadow: 0 0 0 4px var(--amber-soft); animation: pulse 2.2s infinite;
}
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px var(--amber-soft); } 50% { box-shadow: 0 0 0 8px rgba(255, 182, 39, 0.05); } }

.reminders-list { display: flex; flex-direction: column; gap: 8px; }
.reminder {
    display: grid; grid-template-columns: 150px 1fr auto; gap: 14px; align-items: center;
    background: var(--surface); border: 1px solid var(--line-soft); border-left: 3px solid var(--amber);
    border-radius: var(--radius-sm); padding: 11px 14px;
}
.reminder-when { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; color: var(--amber); }
.reminder-main { display: flex; flex-direction: column; gap: 1px; }
.reminder-main strong { font-size: 15px; }
.reminder-target { font-size: 12.5px; }
.empty-inline { color: var(--ink-2); font-size: 14px; margin: 4px 0; }

/* ---------- Fahrzeug-Karten ---------- */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.v-card {
    background: linear-gradient(180deg, var(--surface), var(--bg-2));
    border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
    display: flex; flex-direction: column; gap: 10px; transition: border-color .15s ease, transform .1s ease;
}
.v-card:hover { border-color: rgba(255, 182, 39, 0.4); }
.v-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.v-type { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--teal); font-family: var(--font-display); }
.v-type svg { color: var(--teal); }
.v-name { font-size: 20px; font-weight: 700; }
.v-name span { color: var(--ink-2); font-weight: 500; }
.v-meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }
.v-vin { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); word-break: break-all; }
.v-stats { display: flex; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line-soft); margin-top: 2px; }
.v-stats span { font-size: 13px; color: var(--ink-2); }
.v-stats b { font-family: var(--font-display); color: var(--ink); font-size: 15px; }
.v-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.v-card.clickable { cursor: pointer; }

/* Eigenschaften-Vorschau auf der Karte */
.v-props { display: flex; flex-direction: column; gap: 5px; padding: 9px 0 1px; border-top: 1px solid var(--line-soft); }
.v-prop { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; }
.v-prop-name { color: var(--ink-2); font-weight: 600; font-family: var(--font-display); }
.v-prop-val { color: var(--ink); font-family: var(--font-mono); font-size: 12.5px; text-align: right; word-break: break-word; }

/* EU-Kennzeichen (Signatur-Element) */
.plate {
    display: inline-flex; align-items: stretch; height: 30px; border-radius: 5px; overflow: hidden;
    border: 1.5px solid #11151b; background: #f3f4f2; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.plate-eu {
    background: #003399; color: #ffcc00; font-size: 7px; line-height: 1.05; font-weight: 700;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 0 4px; font-family: var(--font-mono);
}
.plate-no {
    color: #15171a; font-family: var(--font-mono); font-weight: 700; font-size: 14px; letter-spacing: 1px;
    display: flex; align-items: center; padding: 0 9px;
}

/* ---------- Datensatz-Listen (Service / Termine) ---------- */
.filter-row { margin-bottom: 16px; }
.filter-row .field.inline { max-width: 320px; }
.record-list { display: flex; flex-direction: column; gap: 10px; }
.record {
    display: grid; grid-template-columns: 150px 1fr auto; gap: 16px; align-items: start;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.record.is-past { opacity: 0.62; }
.record-date { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--teal); padding-top: 2px; }
.record-body { min-width: 0; }
.record-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.record-desc { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.record-meta { display: flex; gap: 14px; margin-top: 7px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }
.record-meta .cost { color: var(--amber); font-weight: 700; }
.record-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

.chip {
    font-family: var(--font-body); font-size: 11.5px; font-weight: 600; color: var(--teal);
    background: var(--teal-soft); border-radius: 20px; padding: 2px 10px;
}
.chip-muted { color: var(--ink-3); background: rgba(107, 120, 134, 0.15); }

/* ---------- Leerzustände ---------- */
.empty-card {
    grid-column: 1 / -1; text-align: center; padding: 40px 24px;
    background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
    display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.empty-card p { color: var(--ink-2); margin: 0; }

/* ---------- Fahrzeug-Detail (Verlauf & Eigenschaften) ---------- */
.detail-back { margin-bottom: 14px; }
.detail-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 4px;
}
.detail-title h1 { font-size: clamp(24px, 5vw, 32px); margin-top: 4px; }
.detail-title h1 span { color: var(--ink-2); font-weight: 500; }
.detail-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.detail-head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.detail-section { margin-top: 26px; }
.detail-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-section-head .section-title { margin: 0; }

.prop-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.prop-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 14px;
}
.prop-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.prop-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.prop-val { font-family: var(--font-mono); font-size: 13px; color: var(--teal); word-break: break-word; }
.prop-actions { display: flex; gap: 7px; flex-shrink: 0; }

/* ============================================================
   MODALS
   ============================================================ */
.modal {
    position: fixed; inset: 0; z-index: 60; display: none;
    align-items: flex-end; justify-content: center; padding: 0;
    background: rgba(5, 7, 10, 0.7); backdrop-filter: blur(3px);
}
.modal.open { display: flex; animation: fade .15s ease; }
.modal-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 18px 18px 0 0; width: 100%; max-width: 520px;
    max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow);
    animation: slideUp .25s cubic-bezier(.2, .8, .2, 1);
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.modal-head {
    position: sticky; top: 0; background: var(--surface);
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 14px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h3 { font-size: 19px; }
.modal-close { background: transparent; border: 0; color: var(--ink-2); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
    background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
    border-left: 3px solid var(--teal); border-radius: var(--radius-sm);
    padding: 12px 18px; font-size: 14px; font-weight: 500; z-index: 90;
    opacity: 0; pointer-events: none; transition: all .25s ease; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-left-color: var(--danger); }

body.modal-open { overflow: hidden; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 640px) {
    .modal { align-items: center; padding: 24px; }
    .modal-card { border-radius: 18px; }
}

@media (max-width: 560px) {
    .auth-body { align-items: flex-start; padding-top: clamp(28px, 7vh, 72px); }
    .user-name { display: none; }
    .reminder { grid-template-columns: 1fr; gap: 4px; }
    .reminder-when { order: -1; }
    .record { grid-template-columns: 1fr; gap: 10px; }
    .record-actions { justify-content: flex-start; }
    .grid-2 { grid-template-columns: 1fr; }
    .view-head h1 { font-size: 24px; }
    .detail-head-side { align-items: flex-start; }
    .prop-row { flex-direction: column; align-items: flex-start; }
    .prop-actions { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
