/* ========================================================================== 
   GRUNDEINSTELLUNGEN
   Entfernt die Standardabstände aller Elemente, verwendet ein einheitliches
   Box-Modell und legt Arial als Standardschrift der Anwendung fest.
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

/* ========================================================================== 
   SEITENLAYOUT
   Zentriert die Anwendung auf einem hellgrauen Hintergrund und sorgt für
   einen Außenabstand zum Rand des Browserfensters.
   ========================================================================== */
body {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #ececec;
}

/* ========================================================================== 
   APP-CONTAINER
   Begrenzt die App auf eine für mobile Geräte geeignete Breite und stellt
   den weißen, abgerundeten Inhaltsbereich bereit.
   ========================================================================== */
.app-container {
    width: 100%;
    max-width: 420px;
    min-height: 90vh;
    padding: 20px;
    background: white;
    border-radius: 20px;
	position: relative;
	padding-bottom: 90px;
}

/* ========================================================================== 
   BILDSCHIRMSTEUERUNG
   Blendet alle Ansichten standardmäßig aus. app.js setzt die Klasse "active"
   jeweils auf jene Ansicht, die aktuell sichtbar sein soll.
   ========================================================================== */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* ========================================================================== 
   KOPFBEREICH UND ÜBERSCHRIFTEN
   Zentriert den Kopfbereich und definiert Größe beziehungsweise Abstand eines
   optionalen Kopfbildes sowie der Hauptüberschrift.
   ========================================================================== */
.header {
    margin-bottom: 30px;
    text-align: center;
}

.header img {
    height: 60px;
    margin-bottom: 10px;
}

h1 {
    font-size: 28px;
}

/* ========================================================================== 
   PRIMÄRE SCHALTFLÄCHEN
   Kennzeichnet Hauptaktionen mit rotem Hintergrund, weißer Schrift und einer
   großen Bedienfläche für die Nutzung auf mobilen Geräten.
   ========================================================================== */
.btn-primary {
    width: 100%;
    margin: 10px 0;
    padding: 18px;
    color: white;
    background: #e40521;
    border: none;
    border-radius: 12px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

/* ========================================================================== 
   SEKUNDÄRE SCHALTFLÄCHEN
   Stellt weniger hervorgehobene Aktionen, beispielsweise Abbrechen oder
   Zurückkehren, in neutralem Grau dar.
   ========================================================================== */
.btn-secondary {
    width: 100%;
    margin-top: 10px;
    padding: 18px;
    color: #555;
    background: #dcdcdc;
    border: none;
    border-radius: 12px;
    font-weight: bold;
}

/* ========================================================================== 
   DEAKTIVIERT DARGESTELLTE SCHALTFLÄCHEN
   Zeigt derzeit nicht verfügbare Funktionen optisch zurückgenommen an. Die
   Klasse verändert nur die Darstellung und deaktiviert kein HTML-Element.
   ========================================================================== */
.btn-disabled {
    width: 100%;
    margin-top: 25px;
    padding: 18px;
    color: #888;
    background: #efefef;
    border: none;
    border-radius: 12px;
    font-size: 20px;
}

/* ==========================================================================
   WEITERE SCHALTFLÄCHEN DER STARTSEITE
   "Meine Zählungen" und der nur für Admins sichtbare Link zum Admin-Bereich.
   ========================================================================== */
.btn-start-extra {
    margin-top: 25px;
    font-size: 20px;
}

.btn-admin {
    display: block;
    box-sizing: border-box;
    text-align: center;
    text-decoration: none;
    font-size: 20px;
}

.btn-admin[hidden] {
    display: none;
}

/* ========================================================================== 
   FORMULARFELDER
   Sorgt für gleichmäßige Abstände und eine einheitliche Darstellung von
   Beschriftungen, Eingabefeldern und Auswahllisten.
   ========================================================================== */
.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

input,
select {
    width: 100%;
    padding: 14px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 18px;
}

/* ========================================================================== 
   ZÄHLANZEIGE UND PLUS-/MINUS-STEUERUNG
   Hebt den aktuellen Zählwert groß hervor und ordnet die beiden Zähltasten
   mit gleichem Platz nebeneinander an.
   ========================================================================== */
.counter-display {
    margin: 20px 0;
    font-size: 60px;
    font-weight: bold;
    text-align: center;
}

.counter-buttons {
    display: flex;
    margin-bottom: 20px;
}

/* Abstand per margin statt "gap": flexbox-gap fehlt in Chrome < 84. */
.counter-buttons > * + * {
    margin-left: 15px;
}

.counter-btn {
    flex: 1;
    height: 100px;
    border: none;
    border-radius: 12px;
    font-size: 60px;
}

.counter-btn.red {
    color: white;
    background: #e40521;
}

/* ========================================================================== 
   LISTE BEREITS ERFASSTER WAGEN
   Trennt die Wagenübersicht vom Eingabebereich und stellt jeden gespeicherten
   Wagen als eigenen Listeneintrag mit roter Markierung dar.
   ========================================================================== */
.counted-wagons {
    margin-top: 25px;
}

.counted-wagons h3 {
    margin-bottom: 12px;
}

#wagen-liste-anzeige {
    padding: 0;
    list-style: none;
}

#wagen-liste-anzeige li {
    margin-bottom: 8px;
    padding: 12px;
    background: white;
    border-left: 5px solid #e40521;
    border-radius: 10px;
    font-size: 16px;
}

/* ========================================================================== 
   ABSCHLUSSÜBERSICHT DER FAHRGASTZÄHLUNG
   Formatiert die gespeicherten Wagenstände und hebt die Gesamtsumme am Ende
   der abgeschlossenen Zählung hervor.
   ========================================================================== */
#summary-list {
    margin: 20px 0;
}

.summary-entry {
    margin-bottom: 8px;
    padding: 12px;
    background: white;
    border-left: 5px solid #e40521;
    border-radius: 8px;
}

#summe-fahrgaeste {
    margin: 20px 0;
    text-align: center;
}

/* ==========================================================================
   LOGO IM TITELBEREICH
   ========================================================================== */

.title-row {
    display: flex;
    align-items: center;      
    justify-content: center;
}

.title-row > * + * {
    margin-left: 14px;
}

.header-logo {
    width: 75px;             
    height: auto;
    max-height: none;
    margin-top: 6px;
    flex-shrink: 0;
}

.title-row h1 {
    /* Browser-Standardabstände entfernen; der Abstand links zum Logo bleibt. */
    margin-top: 0;
    margin-bottom: 0;
    padding: 0;
    line-height: 1;
    font-size: 28px;
}


/* ==========================================================================
   FOOTER
   Wird dauerhaft am unteren Rand des App-Containers angezeigt.
   ========================================================================== */



.app-footer {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 20px;

    display: flex;
    align-items: center;
	justify-content: center;
}

.app-footer > * + * {
    margin-left: 12px;
}

.footer-logo {
    width: 60px;
    height: auto;
    flex-shrink: 0;
	margin-top: -4px;
}

.footer-text {
    font-size: 11px;
    line-height: 1.2;
	text-align: center;
}

.footer-text strong {
    font-size: 12px;
}



/* ==========================================================================
   ÜBERTRAGUNGSSTATUS
   Fixe Leiste am unteren Rand: grün = alles übertragen, gelb = ausstehend,
   rot = Fehler. Antippen startet die Übertragung sofort.
   ========================================================================== */
.sync-status {
    position: fixed;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    width: calc(100% - 20px);
    max-width: 400px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    background: #e8f5e9;
    color: #1b5e20;
}

.sync-status.pending {
    background: #fff8e1;
    color: #7a5600;
}

.sync-status.error {
    background: #fdecea;
    color: #a4161a;
}

.session-info {
    margin-top: 20px;
    text-align: center;
    color: #555;
    font-size: 15px;
}

.link-btn {
    margin-left: 8px;
    padding: 4px;
    border: none;
    background: none;
    color: #e40521;
    font-size: 15px;
    text-decoration: underline;
    cursor: pointer;
}

.hint {
    margin: 15px 0 5px;
    color: #555;
    font-size: 14px;
}

/* ==========================================================================
   ANMELDUNG
   Vollflächige Ebene über der App; sichtbar mit der Klasse "active".
   ========================================================================== */
.login-overlay {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    background: #ececec;
    overflow-y: auto;
}

.login-overlay.active {
    display: flex;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    background: white;
    border-radius: 20px;
}

.login-message {
    min-height: 20px;
    margin: 10px 0;
    color: #a4161a;
}

/* Platz für die Statusleiste unter dem App-Container */
body {
    padding-bottom: 60px;
}

/* ==========================================================================
   UHRZEITFELDER
   Natives Uhrzeitfeld (öffnet am Smartphone die System-Zeitauswahl) mit
   einer großen "Jetzt"-Taste daneben.
   ========================================================================== */
.time-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-column-gap: 10px;
}

.time-row input[type="time"] {
    min-width: 0;
    min-height: 56px;
    font-size: 24px;
    font-variant-numeric: tabular-nums;
    background: white;
    color: inherit;
}

.btn-now {
    min-width: 96px;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    background: #dcdcdc;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.btn-now:active {
    background: #c8c8c8;
}

/* ==========================================================================
   QUALITÄTSINDIKATOR (QI) ALS STERNE
   Fünf große Tippflächen; ausgewählte Sterne rot, übrige grau.
   ========================================================================== */
.star-rating {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 60px)) 1fr;
    grid-column-gap: 4px;
    align-items: center;
}

.star {
    min-width: 0;
    height: 56px;
    padding: 0;
    border: none;
    background: none;
    color: #d0d0d0;
    font-size: 36px;
    font-size: clamp(30px, 11vw, 44px);
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.star.on {
    color: #e40521;
}

.star:focus-visible {
    outline: 3px solid #e40521;
    outline-offset: 2px;
    border-radius: 8px;
}

.star-text {
    justify-self: end;
    padding-left: 4px;
    color: #555;
    font-size: 15px;
    white-space: nowrap;
}

/* ==========================================================================
   HINWEISTEXT UNTER EINEM FELD
   ========================================================================== */
.field-hint {
    margin-top: 6px;
    color: #555;
    font-size: 14px;
}

/* ==========================================================================
   AUSWAHLTASTEN (ANREISE- UND WEITERREISEART)
   Vier große Tasten im 2x2-Raster; die gewählte ist rot hinterlegt.
   ========================================================================== */
.choice-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.choice {
    min-height: 60px;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 12px;
    background: white;
    color: #333;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
}

.choice.selected {
    border-color: #e40521;
    background: #e40521;
    color: white;
}

/* ==========================================================================
   ÜBERTRAGUNGSSTAND AUF DER ZUSAMMENFASSUNG
   ========================================================================== */
.sync-box {
    margin: 20px 0 10px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 17px;
    line-height: 1.4;
    background: #e8f5e9;
    color: #1b5e20;
}

.sync-box.pending {
    background: #fff8e1;
    color: #7a5600;
}

.sync-box.error {
    background: #fdecea;
    color: #a4161a;
}

/* Vorschläge unter Stations- und Gemeindefeldern (statt <datalist>). */
.vorschlaege {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    border: 2px solid #111;
    border-radius: 12px;
    background: white;
    overflow: hidden;
}

.vorschlaege[hidden] {
    display: none;
}

.vorschlaege li {
    padding: 12px 16px;
    font-size: 18px;
    border-top: 1px solid #ddd;
    cursor: pointer;
}

.vorschlaege li:first-child {
    border-top: 0;
}

.vorschlaege li:active {
    background: #fdecea;
}

/* Standort während Zählung und Befragung: gelb = noch keiner, grün = erfasst. */
.standort-status {
    margin: 0 0 12px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 15px;
    background: #fff8e1;
    color: #7a5600;
}

.standort-status.ok {
    background: #e8f5e9;
    color: #1b5e20;
}

.standort-status:empty {
    display: none;
}

/* ==========================================================================
   KLEINE BILDSCHIRME (z. B. 320 px breit)
   Weniger Rand, damit Eingaben und Tasten mehr Platz haben.
   ========================================================================== */
@media (max-width: 360px) {
    body {
        padding: 8px 8px 60px;
    }

    .app-container {
        padding: 16px 14px 90px;
    }

    .header-logo {
        width: 56px;
    }

    .title-row > * + * {
        margin-left: 10px;
    }

    .title-row h1 {
        font-size: 21px;
    }

    .app-footer {
        left: 14px;
        right: 14px;
    }

    .star-text {
        font-size: 13px;
    }
}

/* ==========================================================================
   MEINE ZÄHLUNGEN
   ========================================================================== */
.my-trips {
    margin: 10px 0 20px;
    padding: 0;
    list-style: none;
}

.my-trips li {
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f4f4f4;
    font-size: 17px;
    line-height: 1.4;
}

.my-trips .titel {
    font-weight: bold;
}

.my-trips .stand {
    font-size: 15px;
    color: #1b5e20;
}

.my-trips .stand.pending {
    color: #7a5600;
}

.my-trips .stand.error {
    color: #a4161a;
}

.my-trips-note {
    color: #555;
    font-size: 16px;
}
