/**
 * Art on Tour / SmartHomeConsulting - Header Stylesheet
 * Name: Arthur Peter Lorenzen
 * Adresse: Bachtelstrasse 68, 8342 Wernetshausen, Schweiz
 * E-Mail: info@art-on-tour.ch / info@smarthomeconsulting.ch
 * Web: www.art-on-tour.ch / www.smarthomeconsulting.ch
 */

/* ======================================= */
/*   1. HEADER-GRUNDSTRUKTUR               */
/* ======================================= */

/* 1.1 Header-Container */
.header {
    /* Basisstile sind in global.css definiert, hier nur Erweiterungen */
    background-color: var(--primary-color); /* Abweichend von global.css */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 1.2 Header-Inhalt */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
}

/* 1.3 Logo-Container */
.logo-container {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* 1.4 Header-Logo */
.header-logo {
    max-height: 36px;
    margin-right: 15px;
    display: block;
}

/* 1.5 Header-Titel */
.header-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-color-inverted);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 180px); /* Platz für Logo und Hamburger */
    text-align: center;
}

/* ======================================= */
/*   2. HAMBURGER-MENÜ                     */
/* ======================================= */

/* 2.1 Hamburger-Menü-Button */
.hamburger-menu {
    display: flex;
    flex-direction: column;
    gap: 6px; /* Abstand zwischen den Strichen */
    cursor: pointer;
    margin-left: auto; /* Hält es rechts */
    background: none;
    /* Rahmen hinzufügen */
    border: 1px solid var(--text-color-inverted);
    /* Innenabstand für die Striche */
    padding: 5px; /* Gleichmäßiger Innenabstand */
    /* Abrundung */
    border-radius: var(--border-radius-small); /* Oder z.B. 4px */
    /* Neue Größe (inkl. Padding & Border) */
    /* Ursprüngliche Strich-Area: 24x18 */
    /* Padding: 5px * 2 = 10px */
    /* Border: 1px * 2 = 2px */
    /* Total Width = 24 + 10 + 2 = 36px */
    /* Total Height = 18 + 10 + 2 = 30px */
    width: 36px;
    height: 30px;
    box-sizing: border-box; /* Padding & Border in width/height einrechnen */

    z-index: var(--z-index-hamburger, var(--z-index-nav-toggle));
    position: relative;
    flex-shrink: 0; /* Verhindert Schrumpfen */
    /* Zentriert die Striche im gepaddeten Bereich */
    align-items: center;
    justify-content: center;
}

/* 2.2 Hamburger-Button-Streifen */
.hamburger-menu span {
    display: block;
    height: 2px;
    /* Breite der Striche (etwas kleiner als die innere Breite des Containers) */
    width: calc(100% - 10px); /* Beispiel: 100% minus 2*Padding */
    /* Oder feste Breite, wenn bevorzugt: */
    /* width: 24px; */ /* Originalbreite der Striche */
    background-color: var(--text-color-inverted);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
    /* Striche brauchen kein Flex-Verhalten mehr */
    flex-shrink: 0; /* Sicherstellen, dass sie nicht schrumpfen */
}

/* 2.3 Animation zum X bei aktivem Menü */
/* Die translateX/Y Werte bleiben gleich, da sie sich auf die Striche beziehen */
body.nav-open .hamburger-menu span:nth-child(1) {
    transform: translateY(8px) rotate(45deg); /* 6px gap + 2px Höhe */
}
body.nav-open .hamburger-menu span:nth-child(2) {
    opacity: 0;
}
body.nav-open .hamburger-menu span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}
/* ======================================= */
/*   3. MOBILES MENÜ                       */
/* ======================================= */

/* 3.1 Overlay für mobiles Menü */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: var(--z-index-mobile-overlay, var(--z-index-side-menu-overlay));
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s, visibility 0s 0.3s linear;
}

.mobile-overlay.active {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s, visibility 0s 0s linear;
}

/* 3.2 Mobiles Menü Container */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -300px; /* Startposition außerhalb des Bildschirms */
    width: 280px;
    max-width: 85%;
    height: 100%;
    background-color: var(--primary-color);
    z-index: var(--z-index-mobile-menu, var(--z-index-side-menu));
    transition: right 0.3s ease-in-out;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Safe Area Padding */
    padding-top: var(--safe-area-inset-top);
    padding-bottom: var(--safe-area-inset-bottom);
    padding-right: var(--safe-area-inset-right);
}

.mobile-menu.active {
    right: 0;
}

/* 3.3 Mobiler Menü-Header */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background-color: var(--primary-color);
    color: var(--text-color-inverted);
    flex-shrink: 0;
}

.mobile-menu-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    color: white;
    cursor: pointer;
    padding: 0 5px;
    margin: 0;
}

/* 3.4 Mobiler Menü-Inhalt */
.mobile-menu-content {
    padding: 0;
    flex-grow: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: var(--container-bg-color);
}

.mobile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-list li {
    border-bottom: 1px solid var(--border-color-light);
}

.mobile-menu-list li:last-child {
    border-bottom: none;
}

.mobile-menu-list a,
.mobile-menu-list .install-app-button {
    display: block;
    padding: 14px 20px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
    background: none;
    border: none;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.4;
}

.mobile-menu-list a:hover,
.mobile-menu-list .install-app-button:hover {
    background-color: var(--background-color);
    color: var(--text-color-dark);
}

.mobile-menu-list li.active > a,
.mobile-menu-list li.active > .install-app-button {
    color: var(--primary-color);
    font-weight: bold;
    background-color: var(--primary-color-light);
}

/* ======================================= */
/*   4. RESPONSIVE ANPASSUNGEN             */
/* ======================================= */

/* 4.1 Tablet & kleinere Desktops (bis 992px) */
@media (max-width: 992px) {
    .header {
        padding: 12px 20px;
    }
    
    .header-title {
        font-size: 1.3rem;
        max-width: calc(100% - 160px);
    }
    
    .header-logo {
        max-height: 30px;
        margin-right: 12px;
    }
}


/* 4.2 Mobile Geräte (bis 768px) */
@media (max-width: 768px) {
    /* [...] andere Header-Anpassungen */

    .hamburger-menu {
        gap: 5px; /* Kleinerer Abstand */
        padding: 4px; /* Kleineres Padding */
        /* Neue Größe */
        /* Strich-Area: 22x16 */
        /* Padding: 4px * 2 = 8px */
        /* Border: 1px * 2 = 2px */
        /* Total Width = 22 + 8 + 2 = 32px */
        /* Total Height = 16 + 8 + 2 = 26px */
        width: 32px;
        height: 26px;
        border-radius: 4px; /* Evtl. kleinerer Radius */
    }
    .hamburger-menu span {
       width: calc(100% - 8px); /* Breite an Padding anpassen */
       /* width: 22px; */ /* Oder feste Breite */
    }
    /* Angepasste Transformation für X */
    body.nav-open .hamburger-menu span:nth-child(1) {
        transform: translateY(7px) rotate(45deg); /* 5px gap + 2px Höhe */
    }
    body.nav-open .hamburger-menu span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}

/* 4.3 Kleine mobile Geräte (bis 480px) */
@media (max-width: 480px) {
    /* [...] andere Header-Anpassungen */

    .hamburger-menu {
        gap: 4px; /* Noch kleinerer Abstand */
        padding: 4px; /* Padding bleibt gleich oder wird kleiner (z.B. 3px) */
        /* Neue Größe */
        /* Strich-Area: 20x14 */
        /* Padding: 4px * 2 = 8px */
        /* Border: 1px * 2 = 2px */
        /* Total Width = 20 + 8 + 2 = 30px */
        /* Total Height = 14 + 8 + 2 = 24px */
        width: 30px;
        height: 24px;
    }
     .hamburger-menu span {
        width: calc(100% - 8px); /* Breite an Padding anpassen */
        /* width: 20px; */ /* Oder feste Breite */
    }
    /* Angepasste Transformation für X */
     body.nav-open .hamburger-menu span:nth-child(1) {
        transform: translateY(6px) rotate(45deg); /* 4px gap + 2px Höhe */
    }
    body.nav-open .hamburger-menu span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }
}