/*
Made for "Digitales Wachbuch" from IT Tobias Meindl by FaKu. - For more Information ask IT Tobias Meindl
*/

/* === Überschriften-Balken === */
.uberschrift {
    width: 100%;
    background-color: #ddd;
    position: relative;      /* Ankerpunkt für absolut positionierten Switch */
    z-index: 50;             /* Stacking Context über dem Seiteninhalt → Dropdown sichtbar */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Titel nimmt volle Breite → text-align:center wirkt über den ganzen Balken */
.uberschrift > a {
    flex: 1;
    text-align: center;
    pointer-events: none;    /* Kein Klick-Blocking der Nav-Links dahinter */
}

/* h1 selbst bleibt klickbar (navigiert zu index.php) */
.uberschrift > a h1 {
    pointer-events: auto;
}

/* === Switch: absolut links im Balken, vertikal zentriert === */
.switch {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 1px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    padding: 2px;
}

/* === Buttons: klein, leicht, iOS Segment-Control-Stil === */
.switch1button {
    padding: 3px 12px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #444;
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.5;
    transition: background 0.12s, color 0.12s;
}

.switch1button:hover:not(.active) {
    background: rgba(0, 0, 0, 0.07);
    color: #111;
}

/* Aktiver Button: weißer Chip, leichter Drop-Shadow */
.switch1button.active {
    background: #fff;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    cursor: default;
}

/* === Dropdown-Variante (>3 Locations) === */
.switch .dropdown {
    display: flex;
    align-items: center;
}

/* Wenn eine Location aktiv ist: Toggle leicht hervorheben */
.switch .dropdown-toggle.location-active {
    background: rgba(255, 255, 255, 0.35);
    color: #222;
}

/* Dropdown-Menü */
.switch .dropdown-menu {
    min-width: 160px;
    font-size: 0.85rem;
}

/* Ausgewählte Location im Menü */
.switch .dropdown-item.active,
.switch .dropdown-item:active {
    background-color: rgba(0, 100, 0, 0.12);
    color: rgb(0, 80, 0);
}

/* === Schmale Bildschirme: Switch unter den Titel statt darüber === */
/*
 * Absolut positioniert kennt der Switch die Breite des Titels nicht; sobald beide
 * zusammen breiter sind als der Balken, liegt er auf dem Text. Darunter steht er im
 * Fluss. Die Titelgröße steht hier fest, weil Bootstraps h1 auf dem Handy noch rund 1,7rem
 * groß ist und der Titel daneben keinen Platz mehr ließe.
 */
@media (max-width: 767.98px) {
    .uberschrift {
        flex-direction: column;
        gap: 4px;
        padding: 6px 6px 8px;
    }

    .uberschrift > a {
        flex: none;
        align-self: stretch;
    }

    .uberschrift > a h1 {
        font-size: 1.5rem;
        margin-bottom: 0;
    }

    .switch {
        position: static;
        transform: none;
        order: 1;                /* nach dem Titel, direkt über dem Inhalt, den er umschaltet */
        flex-wrap: wrap;         /* bis zu vier Knöpfe (Technik + 3 Standorte) dürfen umbrechen */
        justify-content: center;
        max-width: 100%;
    }
}
