/* ============================================================
   Tankbuch – Stylesheet (mobile-first)
   ============================================================ */

:root {
    --bg: #eef1f5;
    --card: #ffffff;
    --text: #1a2437;
    --muted: #64748b;
    --primary: #1e3a5f;
    --primary-dark: #162c49;
    --accent: #2a78d6;
    --accent-dark: #1c5cab;
    --border: #dfe4eb;
    --danger: #dc2626;
    --danger-bg: #fdf1f1;
    --success: #15803d;
    --success-bg: #f0f9f2;
    --info: #1c5cab;
    --info-bg: #eef4fc;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20, 30, 50, 0.08);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

a {
    color: var(--accent-dark);
}

h1 {
    font-size: 1.45rem;
    margin: 0;
}

h2 {
    font-size: 1rem;
    margin: 0 0 0.85rem;
    color: var(--primary);
}

.muted {
    color: var(--muted);
    font-size: 0.875rem;
}

/* ------------------------------------------------------------
   Topbar / Navigation
   ------------------------------------------------------------ */

.topbar {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.55rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.main-nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.main-nav a {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    font-size: 0.95rem;
}

.main-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.main-nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
}

.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-email {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    word-break: break-all;
}

/* ------------------------------------------------------------
   Layout
   ------------------------------------------------------------ */

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.25rem 1rem 2.5rem;
    flex: 1;
}

.container-auth {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    max-width: 480px;
}

.site-footer {
    text-align: center;
    padding: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
}

.empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
}

.empty .btn {
    margin-top: 0.5rem;
}

.empty-note {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0;
}

/* ------------------------------------------------------------
   Flash-Messages
   ------------------------------------------------------------ */

.flash {
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.flash-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(21, 128, 61, 0.25);
}

.flash-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.25);
}

.flash-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: rgba(28, 92, 171, 0.25);
}

/* ------------------------------------------------------------
   Formulare
   ------------------------------------------------------------ */

.form-group {
    margin-bottom: 0.9rem;
    min-width: 0;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

textarea {
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1rem;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group-checkbox {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}

.checkbox input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
}

.form-hint {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 1rem;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1 1 180px;
    margin-bottom: 0;
}

.form-row-action {
    flex: 0 0 auto;
}

/* Filterleiste */
.filter-bar {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-bar .form-group {
    flex: 1 1 150px;
    margin-bottom: 0;
}

.filter-actions {
    display: flex;
    gap: 0.6rem;
    flex: 0 0 auto;
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-danger {
    background: #fff;
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.4);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.85rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ------------------------------------------------------------
   Tabellen
   ------------------------------------------------------------ */

.card-table {
    padding: 0.5rem 0.75rem 0.75rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.card-table table {
    min-width: 860px;
}

th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    padding: 0.6rem 0.6rem;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover {
    background: #f6f8fb;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.actions-head {
    text-align: right;
}

.actions-cell {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
    white-space: nowrap;
}

.actions-cell form {
    display: inline;
}

.note-dot {
    cursor: help;
    font-size: 0.85rem;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--border);
}

.badge-voll {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(21, 128, 61, 0.3);
}

/* ------------------------------------------------------------
   Pagination
   ------------------------------------------------------------ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 0 0.25rem;
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--muted);
    font-size: 0.875rem;
}

/* ------------------------------------------------------------
   KPI-Karten & Diagramme (Dashboard)
   ------------------------------------------------------------ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.kpi {
    margin-bottom: 0;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.kpi-value {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.kpi-unit {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
}

.kpi-sub {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.25rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.charts-grid .card {
    margin-bottom: 0;
}

.chart-box {
    position: relative;
    height: 300px;
}

.table-compact {
    font-size: 0.9rem;
}

/* ------------------------------------------------------------
   Auth-Seiten (Login / Registrierung)
   ------------------------------------------------------------ */

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 1.75rem 1.75rem 1.25rem;
}

.auth-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-sub {
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
    margin: 0 0 1.25rem;
}

.auth-switch {
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
    margin: 1.1rem 0 0;
}

/* ------------------------------------------------------------
   Fahrzeuge
   ------------------------------------------------------------ */

.vehicle-item .vehicle-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 820px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar-user {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .filter-bar .form-group {
        flex: 1 1 100%;
    }

    .filter-actions {
        width: 100%;
    }

    .filter-actions .btn {
        flex: 1;
    }
}

/* ============================================================
   Landing Page (Startseite für nicht eingeloggte Besucher)
   ============================================================ */

.body-landing {
    background: linear-gradient(180deg, #e4ebf5 0%, var(--bg) 420px);
    overflow-x: hidden;
}

.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 1.05rem;
}

.btn-light {
    background: #fff;
    color: var(--primary);
}

.btn-light:hover {
    background: #e6ecf5;
}

/* ---------- Hero ---------- */

.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 2.5rem;
    align-items: center;
    padding: 2.75rem 0 2rem;
}

.hero-badge {
    display: inline-block;
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(28, 92, 171, 0.2);
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.hero h1 {
    font-size: clamp(2.1rem, 5vw, 3.1rem);
    line-height: 1.12;
    margin: 0.9rem 0 0.75rem;
    letter-spacing: -0.02em;
}

.hero h1 .grad {
    background: linear-gradient(90deg, var(--accent), #1baf7a);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-lead {
    font-size: 1.08rem;
    color: var(--muted);
    max-width: 34rem;
    margin: 0;
}

.hero-cta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1.4rem 0 1.1rem;
}

.hero-points {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.4rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.hero-points li::before {
    content: "✓";
    color: var(--success);
    font-weight: 700;
    margin-right: 0.4rem;
}

.hero-text > * {
    animation: fadeUp 0.7s ease both;
}

.hero-text > *:nth-child(2) { animation-delay: 0.08s; }
.hero-text > *:nth-child(3) { animation-delay: 0.16s; }
.hero-text > *:nth-child(4) { animation-delay: 0.24s; }
.hero-text > *:nth-child(5) { animation-delay: 0.32s; }

/* ---------- Hero: Dashboard-Mockup + schwebende Chips ---------- */

.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
}

.hero-visual::before {
    content: "";
    position: absolute;
    inset: -12% -8%;
    background:
        radial-gradient(circle at 72% 25%, rgba(42, 120, 214, 0.18), transparent 58%),
        radial-gradient(circle at 18% 80%, rgba(27, 175, 122, 0.15), transparent 52%);
    z-index: 0;
    pointer-events: none;
}

.mock-card {
    position: relative;
    z-index: 1;
    width: min(340px, 100%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(20, 30, 50, 0.14);
    padding: 1.1rem 1.2rem;
    animation: fadeUp 0.8s 0.25s ease both;
}

.mock-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}

.mock-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
}

.dot-r { background: #f87171; }
.dot-y { background: #fbbf24; }
.dot-g { background: #34d399; }

.mock-title {
    margin-left: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mock-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.mock-kpi {
    background: var(--bg);
    border-radius: 8px;
    padding: 0.5rem 0.55rem;
}

.mock-kpi span {
    display: block;
    font-size: 0.68rem;
    color: var(--muted);
    white-space: nowrap;
}

.mock-kpi strong {
    display: block;
    font-size: 0.98rem;
    color: var(--primary);
}

.mock-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 104px;
}

.mock-bar {
    flex: 1;
    height: var(--h, 50%);
    background: linear-gradient(180deg, #5598e7, #2a78d6);
    border-radius: 4px 4px 0 0;
    transform-origin: bottom;
    animation: growBar 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) both;
    animation-delay: var(--d, 0s);
}

.mock-label {
    font-size: 0.72rem;
    color: var(--muted);
    margin: 0.35rem 0 0.75rem;
}

.mock-spark {
    width: 100%;
    height: 46px;
    display: block;
}

.mock-spark polyline {
    fill: none;
    stroke: #1baf7a;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: drawLine 1.6s 0.7s ease forwards;
}

.float-chip {
    position: absolute;
    z-index: 2;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    animation: floaty 5.5s ease-in-out infinite;
}

.chip-1 { top: 4%; left: -2%; }
.chip-2 { bottom: 14%; right: -4%; animation-delay: 1.4s; }
.chip-3 { top: 40%; right: -9%; animation-delay: 2.8s; }

/* ---------- Fahrendes Auto ---------- */

.road {
    position: relative;
    height: 72px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.road::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    height: 4px;
    background: repeating-linear-gradient(90deg, var(--border) 0 26px, transparent 26px 52px);
    border-radius: 2px;
}

.car {
    position: absolute;
    left: -140px;
    bottom: 8px;
    width: 96px;
    height: auto;
    animation: drive 11s linear 0.6s infinite;
}

.car .wheel {
    animation: spin 0.9s linear infinite;
    transform-box: fill-box;
    transform-origin: center;
}

/* ---------- Landing-Sektionen ---------- */

.landing-section {
    padding: 1.75rem 0;
}

.landing-section h2 {
    font-size: 1.5rem;
    color: var(--text);
    text-align: center;
    margin-bottom: 0.5rem;
}

.landing-sub {
    text-align: center;
    color: var(--muted);
    max-width: 38rem;
    margin: 0 auto 1.75rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.feature-card {
    margin-bottom: 0;
    padding: 1.35rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 28px rgba(20, 30, 50, 0.13);
}

.feature-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    margin-bottom: 0.8rem;
}

.icon-blue   { background: #e3edfb; }
.icon-green  { background: #e2f3e6; }
.icon-amber  { background: #fdf1dc; }
.icon-violet { background: #ebe8fa; }
.icon-rose   { background: #fbe7ee; }
.icon-slate  { background: #e8edf3; }

.feature-card h3 {
    margin: 0 0 0.4rem;
    font-size: 1.02rem;
}

.feature-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.step {
    margin-bottom: 0;
    text-align: center;
    padding: 1.6rem 1.25rem;
}

.step-num {
    width: 44px;
    height: 44px;
    margin: 0 auto 0.8rem;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.step h3 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.step p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.cta-banner {
    background: linear-gradient(135deg, var(--primary), #2a78d6);
    border: none;
    color: #fff;
    text-align: center;
    padding: 2.6rem 1.5rem;
}

.cta-banner h2 {
    color: #fff;
    font-size: 1.45rem;
    margin: 0 0 0.4rem;
}

.cta-banner p {
    color: rgba(255, 255, 255, 0.82);
    margin: 0 0 1.3rem;
}

/* ---------- Scroll-Reveal (Klassen setzt js/app.js) ---------- */

.will-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease var(--rd, 0s), transform 0.6s ease var(--rd, 0s);
}

.will-reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- Keyframes ---------- */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}

@keyframes growBar {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

@keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

@keyframes drive {
    from { left: -140px; }
    to   { left: 100%; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Landing responsive ---------- */

@media (max-width: 900px) {
    .feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding-top: 1.75rem;
    }

    .hero-visual {
        margin-top: 0.5rem;
    }
}

@media (max-width: 640px) {
    .feature-grid,
    .steps-grid {
        grid-template-columns: 1fr;
    }

    .float-chip {
        display: none;
    }
}

/* ---------- Reduzierte Bewegung respektieren ---------- */

@media (prefers-reduced-motion: reduce) {
    .hero-text > *,
    .mock-card,
    .mock-bar,
    .mock-spark polyline,
    .float-chip,
    .car,
    .car .wheel {
        animation: none !important;
    }

    .mock-spark polyline {
        stroke-dashoffset: 0;
    }

    .will-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .feature-card:hover {
        transform: none;
    }
}
