/* ===================================================================
   Lewell Besucher-Anmeldung — Glaseffekt-Theme (iOS 26-inspiriert)
   =================================================================== */

:root {
    --lewell-green-1: #ccff66;
    --lewell-green-2: #99c100;
    --lewell-green-dark: #7aa016;
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-bg-strong: rgba(255, 255, 255, 0.3);
    --glass-border: rgba(255, 255, 255, 0.45);
    --glass-shadow:
        inset 0 0.5px 0.5px rgba(255, 255, 255, 0.9),
        inset 0 1px 3px rgba(255, 255, 255, 0.5),
        inset 0 -1px 2px rgba(0, 0, 0, 0.08),
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.06);
}

html, body {
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: var(--lewell-green-2);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
    color: #1a2810;
    touch-action: manipulation;
}

.center-stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1rem;
}

/* ====== Glas-Karte (Liquid-Glass-Look, iOS 26) ====== */
.glass {
    position: relative;
    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.5) 0%,
            transparent 50%),
        var(--glass-bg);
    -webkit-backdrop-filter: blur(20px) saturate(180%) brightness(1.1) contrast(1.1);
    backdrop-filter: blur(20px) saturate(180%) brightness(1.1) contrast(1.1);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: var(--glass-shadow);
    padding: 2.25rem 1.75rem;
    max-width: 720px;
    width: 100%;
    color: #1a2810;
    overflow: hidden;
    isolation: isolate;
}

/* Lichtkante oben — feiner Specular-Highlight wie bei echtem Glas */
.glass::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 10%,
        rgba(255, 255, 255, 0.85) 50%,
        transparent 90%);
    border-radius: 28px 28px 0 0;
    pointer-events: none;
    z-index: 1;
}

/* Lichtbrechung — Glanz oben links (Lichtquelle-Simulation) */
.glass::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 30% 20%,
        rgba(255, 255, 255, 0.45) 0%,
        transparent 50%);
    border-radius: 28px;
    pointer-events: none;
    z-index: 0;
}

.glass > * { position: relative; z-index: 2; }

.glass-strong {
    --glass-bg: rgba(255, 255, 255, 0.3);
}

@supports not ((-webkit-backdrop-filter: blur(20px)) or (backdrop-filter: blur(20px))) {
    .glass { background: rgba(255, 255, 255, 0.92); }
}

.glass h1, .glass h2, .glass h3 {
    color: #1a2810;
    font-weight: 600;
}

.glass .lewell-logo {
    width: 220px;
    max-width: 60%;
    margin: 0 auto 1.25rem;
    display: block;
}

.hinweis {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #2a3a18;
}

.branch-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    font-size: 0.95rem;
    color: #1a2810;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.hinweis-box {
    background: rgba(255, 255, 255, 0.35);
    border-left: 4px solid #ef5350;
    border-radius: 0 12px 12px 0;
    padding: 1rem 1.25rem;
    font-size: 1.2rem;
    line-height: 1.6;
    color: #2a3a18;
}

.sync-status {
    font-size: 0.8rem;
    color: rgba(26, 40, 16, 0.5);
}

.liste-link {
    display: inline-block;
    margin-top: 1.25rem;
    padding: 0.4rem 0.9rem;
    color: rgba(26, 40, 16, 0.65);
    font-size: 0.95rem;
    text-decoration: none;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease;
}
.liste-link:hover, .liste-link:focus {
    color: #1a2810;
    background: rgba(255, 255, 255, 0.25);
}

.pdf-container {
    width: 100%;
    max-height: 55vh;
    overflow: auto;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.6);
}
.pdf-container canvas {
    width: 100% !important;
    height: auto !important;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    background: #fff;
}

/* ====== Inputs (iOS-freundlich) ====== */
.form-control, .form-select {
    /* iOS Safari zoomt bei <16px in Inputs hinein — daher mind. 16px */
    font-size: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
.form-control:focus, .form-select:focus {
    background: rgba(255, 255, 255, 1);
    border-color: var(--lewell-green-2);
    box-shadow: 0 0 0 0.2rem rgba(153, 193, 0, 0.25);
}

.form-label {
    font-weight: 500;
    font-size: 1.15rem;
    margin-bottom: 0.4rem;
}

.input-group-text {
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px 0 0 12px;
    color: var(--lewell-green-dark);
}
.input-group .form-control {
    border-radius: 0 12px 12px 0;
}

/* ====== Buttons (Touch-freundlich, ≥44px) ====== */
.btn {
    font-size: 1.05rem;
    padding: 0.85rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    min-height: 48px;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.btn:active {
    transform: scale(0.97);
}

.btn-anmeldung {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(46, 125, 50, 0.35);
}
.btn-anmeldung:hover, .btn-anmeldung:focus {
    background: linear-gradient(135deg, #43a047, #2e7d32);
    color: #fff;
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.45);
}

.btn-abmeldung {
    background: linear-gradient(135deg, #ef5350, #c62828);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(198, 40, 40, 0.35);
}
.btn-abmeldung:hover, .btn-abmeldung:focus {
    background: linear-gradient(135deg, #e53935, #c62828);
    color: #fff;
    box-shadow: 0 6px 20px rgba(198, 40, 40, 0.45);
}

.btn-liste {
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: #1a2810;
    border: 1px solid rgba(255, 255, 255, 0.8);
}
.btn-liste:hover, .btn-liste:focus {
    background: rgba(255, 255, 255, 0.75);
    color: #1a2810;
}

/* ====== Suchergebnisse (Abmeldung) ====== */
.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #1a2810;
    border-radius: 14px;
    margin-bottom: 0.5rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.6);
    width: 100%;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    animation: resultFadeIn 0.3s ease both;
}
.result-item:hover, .result-item:focus {
    background: linear-gradient(135deg, #43a047, #2e7d32);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}
.result-item:active { transform: scale(0.97); }

@keyframes resultFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ====== Einblend-Animation ====== */
.glass-enter {
    animation: glassEnter 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes glassEnter {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ====== Toast-Bar (Erfolgsmeldung) ====== */
.toast-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 500;
    z-index: 9999;
    animation: toastSlideIn 0.4s ease-out;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.toast-bar.toast-hide {
    opacity: 0;
    transform: translateY(-100%);
}
.toast-success {
    background: linear-gradient(135deg, #43a047, #2e7d32);
    color: #fff;
}
.toast-info {
    background: linear-gradient(135deg, #1e88e5, #1565c0);
    color: #fff;
}
@keyframes toastSlideIn {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

/* ====== Badge (Besucherzähler) ====== */
.badge-count {
    position: absolute;
    top: -6px; right: -6px;
    background: #fff;
    color: #c62828;
    font-size: 0.75rem;
    font-weight: 700;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ====== Anwesenheitsliste ====== */
.list-page {
    background: linear-gradient(140deg, #f5f7fa 0%, #e8ecef 100%);
    background-attachment: fixed;
}

.list-page .glass {
    max-width: 1200px;
    background: rgba(255, 255, 255, 0.7);
    padding: 1.5rem 1.25rem;
}

.list-page table th {
    background: var(--lewell-green-2);
    color: #fff;
    font-weight: 600;
}

.list-page table tbody tr:hover {
    background: rgba(204, 255, 102, 0.2);
}

/* Sticky Header */
.list-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.list-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.5rem 0 0.75rem;
    display: flex;
    align-items: center;
}

/* Mobile Karten */
.list-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}
.list-card-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: #1a2810;
}
.list-card-details {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #555;
    margin-top: 0.2rem;
}
.list-card-sub {
    font-size: 0.85rem;
    color: #777;
    margin-top: 0.2rem;
}
.list-card-status {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    background: rgba(153, 193, 0, 0.15);
    color: var(--lewell-green-dark);
    white-space: nowrap;
}

/* Mobile Anpassungen */
@media (max-width: 767.98px) {
    .list-page .glass {
        border-radius: 16px;
        padding: 1rem 0.75rem;
        margin: 0 0.25rem;
    }
    .list-section-title { font-size: 1rem; }
}

/* ====== Druckansicht für die Liste (kompakt für Feuerwehr) ====== */
@media print {
    @page { margin: 8mm 10mm; }

    body, .list-page {
        background: #fff !important;
        color: #000 !important;
        font-size: 9pt !important;
    }
    .no-print, .btn, form, .glass-shadow,
    .glass::before, .glass::after {
        display: none !important;
    }
    .glass {
        background: #fff !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
    .container-xxl { padding: 0 !important; max-width: 100% !important; }

    h1 { font-size: 13pt !important; margin: 0 0 4pt !important; color: #000 !important; page-break-after: avoid; }
    h2 { font-size: 11pt !important; margin: 6pt 0 2pt !important; color: #000 !important; page-break-after: avoid; }
    h2 .bi { display: none !important; }

    table {
        border-collapse: collapse;
        width: 100%;
        page-break-inside: auto;
        margin-bottom: 4pt !important;
    }
    table th, table td {
        border: 1px solid #666 !important;
        padding: 1pt 4pt !important;
        font-size: 9pt !important;
        line-height: 1.15 !important;
        background: #fff !important;
        color: #000 !important;
        vertical-align: top !important;
    }
    table th {
        font-weight: 700 !important;
        background: #e8e8e8 !important;
    }
    table thead { display: table-header-group; }
    tr { page-break-inside: avoid; }
    .table-striped > tbody > tr:nth-of-type(odd) > * {
        background: #f3f3f3 !important;
        color: #000 !important;
    }
    .table-responsive { overflow: visible !important; }
}

/* ====== Dark Mode (nur aktiv mit Klasse .dark-mode auf <body>) ====== */
body.dark-mode {
    --glass-bg: rgba(0, 0, 0, 0.25);
    --glass-bg-strong: rgba(0, 0, 0, 0.35);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow:
        inset 0 0.5px 0.5px rgba(255, 255, 255, 0.25),
        inset 0 1px 3px rgba(255, 255, 255, 0.1),
        inset 0 -1px 2px rgba(0, 0, 0, 0.3),
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.2);
    background: #2d4a10;
    color: #e8f0d8;
}
body.dark-mode .glass {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
        var(--glass-bg);
}
body.dark-mode .glass::after {
    background: radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
}
body.dark-mode .glass h1,
body.dark-mode .glass h2,
body.dark-mode .glass h3 { color: #e8f0d8; }
body.dark-mode .hinweis { color: #d0dcc0; }
body.dark-mode .form-control,
body.dark-mode .form-select {
    background: rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e8f0d8;
}
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background: rgba(0, 0, 0, 0.45);
    color: #e8f0d8;
}
body.dark-mode .form-control::placeholder { color: rgba(232, 240, 216, 0.5); }
body.dark-mode .input-group-text {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--lewell-green-1);
}
body.dark-mode .btn-liste {
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.15);
    color: #d0dcc0;
}
body.dark-mode .btn-liste:hover,
body.dark-mode .btn-liste:focus {
    background: rgba(0, 0, 0, 0.35);
    color: #e8f0d8;
}
body.dark-mode .liste-link { color: rgba(232, 240, 216, 0.5); }
body.dark-mode .liste-link:hover { color: #e8f0d8; background: rgba(255, 255, 255, 0.08); }
body.dark-mode .result-item { background: linear-gradient(135deg, #2e7d32, #1b5e20); }
body.dark-mode .result-item:hover { background: linear-gradient(135deg, #388e3c, #2e7d32); }
body.dark-mode.list-page { background: #1a2810; }
body.dark-mode .list-page .glass { background: rgba(0, 0, 0, 0.4); }

/* ====== Große Screens (Lobby-Displays) ====== */
@media (min-width: 1400px) {
    .glass {
        max-width: 840px;
        padding: 3rem 2.5rem;
        border-radius: 32px;
    }
    .glass h1 { font-size: 2rem; }
    .glass .lewell-logo { width: 280px; }
    .hinweis { font-size: 1.15rem; }
    .btn-lg { font-size: 1.15rem; padding: 1rem 2rem; }
}
