:root {
    /* Immer Light-Theme erzwingen */
    color-scheme: light;

    --bg:#f5f5f5;        /* Seitenhintergrund */
    --card:#ffffff;      /* Box-Hintergrund */
    --txt:#1f2937;       /* Haupt-Text (fast schwarz) */
    --muted:#6b7280;     /* Grautext */
    --ok:#145214;        /* grüner Button */
    --err:#7a0000;       /* roter Button */
    --brd:#e5e7eb;       /* Rahmen */
}

/* iOS Safari / Browser Darkmode ausbremsen */
html {
    color-scheme: light;
    background: var(--bg) !important;
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: var(--bg) !important;   /* hellgrau, nicht abdunkeln lassen */
    color: var(--txt);
    margin: 0;
    padding: 14px;
}

/* Hülle um den ganzen Inhalt */
.container {
    max-width: 640px;
    margin: 0 auto;
    background: var(--card) !important;  /* immer weiß */
    padding: 18px;
    border-radius: 12px;
    border: 1px solid var(--brd);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .06);
}

/* =========================================================
   TOPBAR (zweizeilig)
   Zeile 1: Logo links, Sprache rechts
   Zeile 2: Titel ("An-/Abmeldung") volle Breite
   ========================================================= */
.topbar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--card) !important; /* immer weiß */
    border: 1px solid var(--brd);
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
    margin-bottom: 8px;
}

.topbar-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.topbar-row1 .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.topbar-row1 .logo {
    height: 32px;
    width: auto;
    display: block;
}

.topbar-row2 {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.topbar-row2 .title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--txt);
}

/* =========================================================
   Sprachumschalter-Dropdown
   ========================================================= */
.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,.08);
    background: var(--card) !important; /* fix weiß */
    cursor: pointer;
}

.lang-switcher-btn img {
    height: 22px;
    width: auto;
    display: block;
    border-radius: 1px;
}

.lang-switcher-list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 180px;
    background: var(--card) !important;
    border: 1px solid var(--brd);
    border-radius: 10px;
    padding: 6px;
    list-style: none;
    margin: 0;
    display: none;
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
}

.lang-switcher-list li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    font-size: 15px;
    background: var(--card) !important;
}

.lang-switcher-list li a img {
    height: 18px;
    width: auto;
    border-radius: 1px;
}

.lang-switcher-list li a:hover {
    background: rgba(0,0,0,.04) !important;
    text-decoration: none;
}

.lang-switcher:focus-within .lang-switcher-list,
.lang-switcher:hover .lang-switcher-list {
    display: block;
}

/* =========================================================
   Hinweisbox (wenn kein gültiger QR-Scan/keine Session)
   ========================================================= */
.qr-hint {
    background: var(--card) !important;
    border: 1px dashed var(--brd);
    border-radius: 12px;
    padding: 18px;
    margin: 6px 0 10px;
    color: var(--txt);
}
.qr-hint h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: var(--txt);
}
.qr-hint p {
    margin: 6px 0;
    color: var(--txt);
}
.qr-hint .muted {
    font-size: 14px;
    color: var(--muted);
}

/* =========================================================
   Info-Leiste (Standort / Anlage)
   ========================================================= */
.info {
    background: var(--card) !important;          /* fix weiß */
    border: 1px solid var(--brd);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;

    display: flex;
    flex-direction: column;
    gap: 5px;

    font-size: 15px;
    line-height: 1.4;
    color: var(--txt);
}

.info strong {
    font-weight: 600;
    color: var(--txt);
}

/* =========================================================
   Feedback-Meldung nach Form-Submit (grün)
   ========================================================= */
.feedback {
    background: #e8f7e8;
    border: 1px solid #8ac98a;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
    color: #145214;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

/* =========================================================
   Zusammenfassung nach erfolgreicher Meldung (optional)
   ========================================================= */
.summary-box{
    background-color:#ffffff !important;
    border:1px solid var(--brd);
    border-radius:12px;
    padding:12px;
    margin-bottom:14px;
    font-size:15px;
    line-height:1.4;
    color:var(--txt);
}
.summary-box h3{
    margin:0 0 8px;
    font-size:1rem;
    font-weight:600;
    color:var(--txt);
}
.summary-box ul{
    margin:8px 0 0 18px;
    padding:0;
}
.summary-box li{
    margin-bottom:6px;
}

/* =========================================================
   Formular-Felder
   ========================================================= */
.row {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    color: var(--txt);
}

.row label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--txt);
    line-height: 1.4;
}

.row input,
.row textarea,
.row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--brd);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;

    background: #ffffff !important;        /* immer weiß */
    color: #1f2937 !important;             /* dunkler Text */
    caret-color: #1f2937;

    -webkit-appearance: none;              /* iOS Darkmode-Hack */
    appearance: none;
    box-shadow: none;
}

.row textarea {
    min-height: 80px;
    resize: vertical;
}

.row input[type="time"] {
    padding: 8px 10px;
}

/* Platzhalter-Farbe stabil halten */
.row input::placeholder,
.row textarea::placeholder {
    color: #6b7280 !important;
    opacity: 1;
}

/* select noch mal absichern */
.row select {
    background-color: #ffffff !important;
    background-image: none !important;
    color: #1f2937 !important;
}

/* Fokus-Style */
.row input:focus,
.row textarea:focus,
.row select:focus {
    outline: 2px solid #dbeafe;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147,197,253,.25);
    background: #ffffff !important;
    color: #1f2937 !important;
}

/* =========================================================
   Buttons (Anmelden / Abmelden)
   ========================================================= */
.buttons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.buttons button {
    flex: 1 1 auto;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    color: #ffffff;
    text-align: center;
    line-height: 1.2;
}

.buttons .anmelden {
    background: var(--ok);
}

.buttons .abmelden {
    background: var(--err);
}

.buttons button:hover {
    filter: brightness(0.95);
}

.buttons button:focus {
    outline: 2px solid #e5e7eb;
    outline-offset: 2px;
}

/* =========================================================
   Sekundärtexte / Footer
   ========================================================= */
.muted {
    color: var(--muted);
    font-size: 14px;
}

.footer {
    margin-top: 16px;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

/* Headline-Style (falls separat genutzt) */
h2.headline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 12px;
    font-weight: 600;
    color: var(--txt);
}
h2.headline span {
    position: relative;
    top: -2px;
    font-size: 22px;
    color: var(--txt);
}

/* =========================================================
   Admin-Tabelle / Übersicht (admin.php)
   ========================================================= */
.admin-table-wrap{
    background:#fff !important;
    border:1px solid var(--brd);
    border-radius:12px;
    box-shadow:0 2px 10px rgba(0,0,0,.05);
    padding:12px;
    overflow-x:auto;
    margin-top:16px;
}

.admin-table{
    width:100%;
    border-collapse:collapse;
    font-size:14px;
    line-height:1.4;
    min-width:800px;
    color: var(--txt);
}

.admin-table th{
    text-align:left;
    white-space:nowrap;
    background:#fff !important;
    border-bottom:1px solid var(--brd);
    font-weight:600;
    color:var(--txt);
    padding:8px 10px;
    font-size:13px;
}

.admin-table td{
    vertical-align:top;
    background:#fff !important;
    border-bottom:1px solid var(--brd);
    padding:8px 10px;
    color:var(--txt);
    word-break:break-word;
    font-size:14px;
    line-height:1.4;
}

.qr-cell img{
    display:block;
    width:120px;
    height:120px;
    max-width:120px;
    max-height:120px;
    border:1px solid var(--brd);
    border-radius:6px;
    background:#fff !important;
    padding:4px;
    box-sizing:border-box;
}

.del-form button{
    background:var(--err);
    color:#fff;
    border:none;
    border-radius:8px;
    font-size:14px;
    font-weight:600;
    padding:8px 10px;
    cursor:pointer;
    line-height:1.2;
}
.del-form button:hover{
    filter:brightness(0.95);
}
.del-form button:focus{
    outline:2px solid #e5e7eb;
    outline-offset:2px;
}

.deleted-info{
    margin-top:12px;
    font-size:14px;
    font-weight:500;
    color:var(--ok);
}
.deleted-info.err{
    color:var(--err);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 640px) {
    .qr-flex {
        flex-direction: column;
    }
    .qr-notes {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .topbar {
        padding: 8px 10px;
    }

    .topbar-row1 .logo {
        height: 32px;
    }

    .topbar-row2 .title {
        font-size: 1.2rem;
    }
}

/* Versuche Browser-Darkmode aktiv wieder zurück auf hell zu zwingen */
@media (prefers-color-scheme: dark) {
    :root {
        /* Wir sagen auch im Dark-Case nochmal explizit: nur light */
        color-scheme: light;
    }

    html,
    body {
        background: #f5f5f5 !important;
        color: #1f2937 !important;
    }

    .container,
    .topbar,
    .info,
    .qr-hint,
    .summary-box,
    .admin-table-wrap,
    .admin-table td,
    .admin-table th {
        background: #ffffff !important;
        color: #1f2937 !important;
        border-color: #e5e7eb !important;
        box-shadow: 0 8px 30px rgba(0,0,0,.06) !important;
    }

    .row input,
    .row textarea,
    .row select {
        background: #ffffff !important;
        color: #1f2937 !important;
        border-color: #e5e7eb !important;
        box-shadow: none !important;
        -webkit-appearance: none;
        appearance: none;
    }

    .row input::placeholder,
    .row textarea::placeholder {
        color: #6b7280 !important;
        opacity: 1;
    }

    .lang-switcher-btn,
    .lang-switcher-list,
    .lang-switcher-list li a {
        background: #ffffff !important;
        color: #1f2937 !important;
        border-color: #e5e7eb !important;
        box-shadow: 0 8px 20px rgba(0,0,0,.08) !important;
    }

    .feedback {
        background: #e8f7e8 !important;
        border-color: #8ac98a !important;
        color: #145214 !important;
    }
}

