/* Oldtimer Fahrtenbuch — elegant classic style */

:root {
  --bg: #14151a;
  --bg-elev: #1c1d20;
  --bg-card: #22242a;
  --bg-input: #2a2c33;
  --border: #32343c;
  --border-soft: #292b33;
  --text: #ece7dd;
  --text-dim: #a9a298;
  --text-muted: #7d7770;
  --cream: #e8dfce;
  --accent: #b8965a;
  --accent-hover: #c9a767;
  --accent-dim: #8a6f42;
  --danger: #c85c4f;
  --success: #7ea86a;
  --warning: #d4a047;
  --serif: 'Cormorant Garamond', 'Playfair Display', 'Georgia', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

.hidden { display: none !important; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0;
}

/* ======== LOGIN ======== */
.login-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at top, #1e2026 0%, #0f1014 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.login-box {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-brand { margin-bottom: 40px; }

.login-emblem, .brand-emblem {
  width: 68px;
  height: 68px;
  margin: 0 auto 20px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 26px;
  color: var(--cream);
  letter-spacing: 2px;
  background: linear-gradient(145deg, #26272e, #191a1e);
}

.brand-emblem {
  width: 42px;
  height: 42px;
  font-size: 16px;
  letter-spacing: 1px;
  margin: 0;
}

.login-brand h1 {
  font-size: 32px;
  color: var(--cream);
  font-weight: 500;
}

.login-sub {
  color: var(--text-dim);
  font-size: 14px;
  font-style: italic;
  margin-top: 8px;
  font-family: var(--serif);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form input {
  padding: 16px 18px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 17px;
  text-align: center;
  letter-spacing: 2px;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-form button {
  padding: 16px;
  background: var(--accent);
  color: #1c1d20;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.login-form button:active { background: var(--accent-hover); }

.login-error {
  color: var(--danger);
  font-size: 14px;
  min-height: 20px;
}

/* ======== APP SHELL ======== */
.app {
  padding-bottom: 88px;
  max-width: 720px;
  margin: 0 auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(20, 21, 26, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-title {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--cream);
  line-height: 1.1;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--serif);
  margin-top: 2px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
}
.icon-btn:active { background: var(--bg-card); }

.main-view {
  padding: 20px;
}

/* ======== BOTTOM NAV ======== */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 21, 26, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 20;
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px;
  transition: color 0.2s;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
}

.nav-btn.active {
  color: var(--accent);
}

.nav-btn:active { background: var(--bg-card); }

/* ======== COMMON UI ======== */

.page-title {
  font-size: 28px;
  color: var(--cream);
  margin-bottom: 6px;
}
.page-sub {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  font-family: var(--serif);
  margin-bottom: 22px;
}

.section {
  margin-bottom: 28px;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-family: var(--sans);
  font-weight: 600;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-card {
  background: linear-gradient(160deg, #25272e, #1d1e24);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  font-weight: 600;
}

.stat-value {
  font-family: var(--serif);
  font-size: 30px;
  color: var(--cream);
  margin-top: 4px;
  line-height: 1.1;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--serif);
  font-size: 15px;
}

/* ======== FORMS ======== */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 14px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-family: var(--sans);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  margin: 0;
}

.checkbox-row label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  flex: 1;
  cursor: pointer;
}

.btn {
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: #1c1d20;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
  font-family: var(--sans);
}

.btn:active { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-wa {
  background: #25D366;
  color: #fff;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.btn-row .btn { flex: 1; }

/* ======== DROPDOWN MIT SUCHE ======== */
.vehicle-picker {
  position: relative;
}

.vehicle-picker-btn {
  width: 100%;
  padding: 14px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vehicle-picker-btn.placeholder { color: var(--text-muted); }

.vehicle-picker-list {
  display: none;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  max-height: 320px;
  overflow-y: auto;
}

.vehicle-picker.open .vehicle-picker-list { display: block; }

.vehicle-picker-search {
  padding: 10px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--bg-card);
}

.vehicle-picker-search input {
  background: var(--bg-input);
  padding: 10px 12px;
  font-size: 15px;
}

.vehicle-picker-option {
  padding: 14px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.vehicle-picker-option:last-child { border-bottom: none; }
.vehicle-picker-option:active { background: var(--bg-input); }
.vehicle-picker-option .vo-name { color: var(--cream); font-weight: 500; }
.vehicle-picker-option .vo-meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ======== LISTS / ITEMS ======== */
.list-item {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
}

.list-item:active { background: var(--bg-input); }

.li-title {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--cream);
  line-height: 1.2;
}

.li-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.li-note {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
  font-style: italic;
  font-family: var(--serif);
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.badge-accent { background: rgba(184, 150, 90, 0.15); color: var(--accent); border: 1px solid rgba(184, 150, 90, 0.3); }
.badge-warning { background: rgba(212, 160, 71, 0.15); color: var(--warning); border: 1px solid rgba(212, 160, 71, 0.3); }
.badge-success { background: rgba(126, 168, 106, 0.15); color: var(--success); border: 1px solid rgba(126, 168, 106, 0.3); }
.badge-danger { background: rgba(200, 92, 79, 0.15); color: var(--danger); border: 1px solid rgba(200, 92, 79, 0.3); }
.badge-muted { background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border); }

/* Vehicle chip row */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
}

.chip {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  color: #1c1d20;
  border-color: var(--accent);
  font-weight: 600;
}

/* ======== FILTER PILLS ======== */
.filter-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.filter-pills::-webkit-scrollbar { display: none; }

.pill {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
  cursor: pointer;
}
.pill.active {
  color: var(--accent);
  border-color: var(--accent);
}

/* ======== MODAL ======== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  background: var(--bg-elev);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

.modal-title {
  font-size: 22px;
  color: var(--cream);
  margin-bottom: 16px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ======== TOAST ======== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent);
  color: #1c1d20;
  padding: 12px 22px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ======== DETAIL VIEW ======== */
.detail-header {
  margin-bottom: 20px;
}

.detail-title {
  font-size: 28px;
  color: var(--cream);
  line-height: 1.15;
}

.detail-sub {
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--serif);
  font-style: italic;
  margin-top: 4px;
}

.back-btn {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0 0 12px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row .kv-k { color: var(--text-muted); }
.kv-row .kv-v { color: var(--text); text-align: right; }

/* ======== SETTINGS ======== */
.settings-link {
  display: block;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text);
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-size: 15px;
  font-family: var(--sans);
}
.settings-link:active { background: var(--bg-input); }

/* ======== PRINT ======== */
@media print {
  body { background: #fff; color: #000; }
  .app-header, .bottom-nav, .modal, .toast, .btn, .back-btn, .no-print { display: none !important; }
  .app { padding: 0; max-width: none; }
  .main-view { padding: 0; }
  .print-page {
    display: block !important;
    padding: 20mm;
    color: #000;
    font-family: 'Georgia', serif;
    background: #fff;
  }
  .print-page h1 {
    font-size: 26pt;
    border-bottom: 2px solid #444;
    padding-bottom: 8pt;
    margin-bottom: 16pt;
    font-family: 'Georgia', serif;
  }
  .print-page h2 {
    font-size: 14pt;
    margin-top: 14pt;
    margin-bottom: 8pt;
  }
  .print-page table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
    margin-bottom: 10pt;
  }
  .print-page table th, .print-page table td {
    border: 1px solid #888;
    padding: 5pt 7pt;
    text-align: left;
  }
  .print-page table th {
    background: #eee;
    font-weight: bold;
  }
  .print-footer {
    margin-top: 30pt;
    font-size: 9pt;
    color: #555;
    text-align: center;
    border-top: 1px solid #aaa;
    padding-top: 10pt;
  }
}

.print-page { display: none; }

/* Dashboard hero */
.hero {
  background: linear-gradient(155deg, #2b2d34 0%, #1a1b20 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  border: 1px solid rgba(184, 150, 90, 0.2);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 120px;
  height: 120px;
  border: 1px solid rgba(184, 150, 90, 0.12);
  border-radius: 50%;
}

.hero-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  font-weight: 600;
}

.hero-title {
  font-size: 30px;
  color: var(--cream);
  font-family: var(--serif);
  margin-top: 4px;
  line-height: 1.15;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 6px;
  font-style: italic;
  font-family: var(--serif);
}

.hero-stats {
  display: flex;
  gap: 24px;
  margin-top: 18px;
  position: relative;
  z-index: 1;
}
.hero-stats > div { flex: 1; }
.hero-stats .sv { font-size: 24px; font-family: var(--serif); color: var(--cream); }
.hero-stats .sl { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }

/* Alert card for inactive vehicles */
.alert-card {
  background: rgba(212, 160, 71, 0.08);
  border: 1px solid rgba(212, 160, 71, 0.3);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--cream);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.alert-card .days { color: var(--warning); font-weight: 600; font-size: 12px; }

/* small helpers */
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
