/* Fliegen ohne Flugleiter – Responsive Web Design */

:root {
    --primary: #1a5276;
    --primary-light: #2e86c1;
    --accent: #EB5B07;  /* Westküste Orange (RGB 235-91-7) */
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #dfe6e9;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ── Navigation ──────────────────────────────────────────── */

.navbar {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand a { color: white; text-decoration: none; }
.nav-icon { font-size: 1.4rem; }

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

.nav-aerodrome {
    margin-left: auto;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icao-badge {
    background: var(--accent);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
}

/* ── Container & Sections ────────────────────────────────── */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

h2 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.subtitle {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.section {
    margin-bottom: 2rem;
}

/* ── Statistik-Karten ────────────────────────────────────── */

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

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
}

a.stat-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

a.stat-card-link:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* ── Source Badges ────────────────────────────────────────── */

.source-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.source-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* ADS-B Familie: Blautoene, lokaler dump1090 dunkler als Cloud-Quellen */
.source-adsb         { background: #d6eaf8; color: #1a5276; }
.source-adsbexchange { background: #ebf5fb; color: #2874a6; }
.source-opensky      { background: #ebf5fb; color: #2874a6; }
/* FLARM Familie: Gruentoene, lokal dunkler als Internet */
.source-flarm        { background: #d4efdf; color: #186a3b; }
.source-ogn          { background: #eafaf1; color: #1e8449; }
.source-ogn_local    { background: #d4efdf; color: #186a3b; }
.source-radio        { background: #fef9e7; color: #9a7d0a; }
.source-camera       { background: #f5eef8; color: #6c3483; }

/* Hinweis-Zaehler bei Mehrfach-Quellen (Fusion-Bonus) */
.source-multi-hint {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    background: #f4ecf7;
    color: #6c3483;
    font-size: 0.7rem;
    font-weight: 700;
    vertical-align: middle;
    cursor: help;
}

/* ── Status Badges ───────────────────────────────────────── */

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pilot { background: #d5f5e3; color: #1e8449; }
.status-auto { background: #ebf5fb; color: #2e86c1; }
.status-open { background: #fdebd0; color: #ca6f1e; }

/* Circuit-Count-Badge: Touch-and-Gos im gleichen Flug */
.circuit-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #eef3ff;
    color: #2c3e75;
    white-space: nowrap;
}

/* Confirm-Seite: pro Eintrag eine klar abgegrenzte Karte mit Header,
   Feldern, und Aktions-Footer. Wichtig: die Bestaetigen/Speichern-Buttons
   sitzen jetzt am ENDE der Karte (statt rechts oben), damit der User bei
   langen Listen immer sieht zu welcher Karte die Buttons gehoeren. */
.confirm-card {
    border-left: 4px solid #ff9800;
    padding: 1rem;
    margin-bottom: 1rem;
}
.confirm-card-header {
    margin-bottom: 0.6rem;
}
.confirm-card-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}
.confirm-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.2rem;
    margin: 0.4rem 0;
    align-items: flex-end;
}
.confirm-fields label {
    display: flex;
    flex-direction: column;
    font-size: 0.95rem;
    color: #444;
    gap: 0.15rem;
}
.confirm-fields label span {
    font-weight: 500;
}
/* Start/Landung/Quellen-Zeile auf gleiche Groesse + Farbe wie die
   Field-Labels darunter — User-Wunsch 2026-05-18 (Klar-lesbare Zeiten,
   keine Mini-Mausfont mehr). */
.confirm-card-meta {
    font-size: 0.95rem;
    color: #444;
    margin-top: 0.3rem;
    line-height: 1.4;
}
.confirm-fields-aerodrome label {
    min-width: 14rem;
}
.aerodrome-lookup-field input.aerodrome-input {
    font-family: Menlo, Consolas, monospace;
    font-size: 0.9rem;
    padding: 0.3rem 0.5rem;
    width: 100%;
}
.confirm-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.8rem;
    padding-top: 0.6rem;
    border-top: 1px solid #eee;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.confirm-card-id {
    font-size: 0.78rem;
    color: #888;
    font-family: Menlo, Consolas, monospace;
}
.confirm-card-buttons {
    display: flex;
    gap: 0.5rem;
}
.confirm-card-done {
    border-left-color: #4caf50 !important;
    opacity: 0.55;
}
.confirm-card-saved {
    background: #f0fff4;
    transition: background 0.4s ease;
}

/* Aerodrom-Profil-Wechsel-Marker im Flugbuch (Variante B 2026-05-18).
   Wird zwischen Eintraegen eingeblendet die zeitlich vor/nach dem
   Switch entstanden. Klare visuelle Zaesur, kein Alarm. */
.profile-switch-row {
    background: linear-gradient(90deg, #f4f6fb 0%, #e8edf5 50%, #f4f6fb 100%);
}
.profile-switch-row td {
    text-align: center;
    padding: 0.5rem !important;
    border-top: 1px dashed #b8c3d8;
    border-bottom: 1px dashed #b8c3d8;
}
.profile-switch-marker {
    font-size: 0.85rem;
    color: #4a5a78;
    letter-spacing: 0.5px;
}
.profile-switch-marker strong {
    color: #2d3a55;
    font-family: Menlo, Consolas, monospace;
}
.profile-switch-services {
    font-size: 0.75rem;
    color: #7a8aa6;
    margin-left: 0.4rem;
    font-style: italic;
}

/* Gast-Badge: Aircraft das NICHT in der lokalen Heimat-Flotte des
   aktiven Platzes ist. Dezent, kein roter Alarm — nur ein Hinweis
   damit Flugplatzbetreiber Gastlandungen sehen (Landegebuehren-Diff). */
.gast-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.08rem 0.45rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 500;
    background: #fef5e7;
    color: #b9770e;
    border: 1px solid #f6dfb1;
    white-space: nowrap;
}

/* F-Schlepp-Badges */
.tow-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}
.tow-badge.tow-tug    { background: #ffeacb; color: #6e4500; }
.tow-badge.tow-glider { background: #d4ecf8; color: #1a4b6e; }

/* ── Tabellen ────────────────────────────────────────────── */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.flugbuch-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.flugbuch-table thead {
    background: var(--primary);
    color: white;
}

.flugbuch-table th {
    padding: 0.75rem 0.6rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.flugbuch-table td {
    padding: 0.6rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.flugbuch-table tbody tr:hover {
    background: #f8f9fa;
}

.row-confirmed { border-left: 3px solid var(--success); }
.row-auto { border-left: 3px solid var(--primary-light); }
.row-unconfirmed { border-left: 3px solid var(--warning); }

.callsign {
    font-weight: 700;
    font-family: "SF Mono", "Fira Code", monospace;
}

.empty-row {
    text-align: center;
    color: var(--text-light);
    padding: 2rem !important;
}

.entry-count {
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* ── Datum-Filter ────────────────────────────────────────── */

.date-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.date-filter label {
    font-weight: 600;
    font-size: 0.9rem;
}

.date-filter input[type="date"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

/* ── Buttons ─────────────────────────────────────────────── */

button, .btn-primary, .btn-secondary, .btn-export {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.btn-primary, button[type="submit"] {
    background: var(--primary);
    color: white;
}

.btn-primary:hover, button[type="submit"]:hover {
    background: var(--primary-light);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #c8d6e5;
}

.btn-export {
    background: var(--success);
    color: white;
}

.btn-export:hover {
    background: #229954;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* ── Pilot-Karten ────────────────────────────────────────── */

.pilot-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.pilot-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

.pilot-card-header {
    background: var(--primary);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.callsign-large {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: "SF Mono", "Fira Code", monospace;
}

.aircraft-type {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
}

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

.flight-info { margin-bottom: 1rem; }

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.85rem;
}

.info-value { font-weight: 500; }

.pilot-card-sources {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pilot-card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

/* ── Formular ────────────────────────────────────────────── */

.edit-form {
    max-width: 700px;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
}

legend {
    font-weight: 700;
    color: var(--primary);
    padding: 0 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(46,134,193,0.15);
}

.form-group input:disabled {
    background: #f0f0f0;
    color: var(--text-light);
}

.form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.5rem;
}

/* ── Empty State ─────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 1rem;
}

/* ── Footer ──────────────────────────────────────────────── */

.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

.footer-credit {
    display: inline-flex;
    align-items: flex-end;
    gap: 6px;
    margin-top: 0.5rem;
}

.footer-credit a {
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-credit a:hover {
    color: var(--text);
}

.footer-logo {
    height: 28px;
}

.footer-product {
    margin-top: 0.5rem;
}

.footer-product a {
    display: inline-block;
    padding: 0.3rem 1rem;
    background: #fef4ee;
    border: 1px solid #f5c9a8;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.footer-product a:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .nav-aerodrome {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .pilot-cards {
        grid-template-columns: 1fr;
    }

    .date-filter {
        flex-direction: column;
        align-items: stretch;
    }

    h1 { font-size: 1.4rem; }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .container {
        padding: 1rem;
    }
}
