:root {
    --primary-blue: #005A9C;
    --hover-blue: #00518d;
    --bg-white: #FFFFFF;
    --bg-lightgray: #F5F5F5;
    --text-dark: #333333;
    --border-radius: 8px;
    --search-pill-radius: 999px;
}

html {
    min-height: 100%;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-dark);
    min-height: 100vh;
    background-image: url('hintergundbild.png');
    background-size: cover;
    background-position: top;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.main-header {
    background-color: var(--bg-white);
    color: var(--primary-blue);
    padding: 10px 30px;
    height: 200px;
    position: sticky;
    top: 0;
    z-index: 5000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: visible;
    box-sizing: border-box;
    transition:
        height 0.18s linear,
        padding 0.18s linear,
        box-shadow 0.18s linear;
    will-change: height, padding;
}

.header-container {
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    position: relative;
    box-sizing: border-box;
    z-index: 5001;
}

.search-side {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-self: start;
    min-width: 0;
}

.menu-side {
    position: relative;
    justify-self: end;
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    height: 100%;
    min-width: 220px;
}

.logo-img {
    height: 170px;
    max-height: 100%;
    width: auto;
    display: block;
    object-fit: contain;
    transition: height 0.18s linear;
    will-change: height;
}

.search-container {
    position: relative;
    display: flex;
    align-items: flex-start;
    overflow: visible;
    z-index: 20;
}

.search-shell {
    display: flex;
    align-items: center;
    min-height: 46px;
    background-color: var(--bg-lightgray);
    border-radius: var(--search-pill-radius);
    overflow: hidden;
    position: relative;
    z-index: 2;
    transition: min-height 0.18s linear;
}

.search-bar {
    appearance: none;
    border: none;
    outline: none;
    width: 0;
    height: 46px;
    padding: 0;
    opacity: 0;
    font-size: 16px;
    color: var(--text-dark);
    background-color: var(--bg-lightgray);
    border-radius: var(--search-pill-radius) 0 0 var(--search-pill-radius);
    transition:
        width 0.3s ease,
        padding 0.3s ease,
        opacity 0.3s ease,
        height 0.18s linear,
        font-size 0.18s linear;
}

.search-bar.open {
    width: 200px;
    padding: 0 0 0 16px;
    opacity: 1;
}

.search-bar::placeholder {
    color: #6f6f6f;
}

.search-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    height: 46px;
    padding: 0 14px;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition:
        height 0.18s linear,
        padding 0.18s linear;
}

.search-icon-btn svg {
    width: 22px;
    height: 22px;
    transition:
        width 0.18s linear,
        height 0.18s linear;
}

.search-icon-btn:hover {
    color: var(--hover-blue);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-results-desktop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    min-width: 260px;
    margin: 0;
    padding: 8px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    z-index: 9999;
    display: none;
    box-sizing: border-box;
    overflow: hidden;
}

.search-results-desktop.has-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-result-item {
    background-color: #f5f5f5;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.search-result-item:hover {
    background-color: #e9eef5;
    transform: translateY(-1px);
}

.search-result-title {
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 4px;
}

.search-result-text {
    font-size: 14px;
    color: #555555;
    line-height: 1.4;
}

.lang-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 16px;
    user-select: none;
    white-space: nowrap;
    transition:
        gap 0.18s linear,
        font-size 0.18s linear;
}

.lang-option {
    color: var(--primary-blue);
    cursor: pointer;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.lang-option:hover {
    opacity: 0.7;
}

.lang-option.active {
    text-decoration: underline;
}

.lang-separator {
    color: var(--primary-blue);
    opacity: 0.7;
    font-size: 1.12em;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 44px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 7000;
    transition:
        width 0.18s linear,
        height 0.18s linear;
}

.hamburger-btn span {
    display: block;
    height: 5px;
    width: 100%;
    background-color: var(--primary-blue);
    border-radius: 2px;
    transform-origin: center;
    transition:
        transform 0.35s ease,
        opacity 0.25s ease,
        height 0.18s linear;
}

.hamburger-btn.active span:nth-child(1) {
    transform: translateY(12px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: translateY(-12px) rotate(-45deg);
}

.main-header.header-collapsed .hamburger-btn.active span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.main-header.header-collapsed .hamburger-btn.active span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

.menu {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    width: 220px;
    position: absolute;
    top: calc(100% + 20px);
    right: 0;
    flex-direction: column;
    gap: 0;
    background-color: var(--bg-lightgray);
    border-radius: var(--border-radius);
    transition:
        max-height 0.35s ease,
        opacity 0.25s ease,
        padding 0.25s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
    z-index: 6000;
    display: flex;
    pointer-events: none;
}

.menu.menu-open {
    max-height: 300px;
    opacity: 1;
    pointer-events: auto;
}

.menu button {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-size: 16px;
    cursor: pointer;
    padding: 15px 20px;
    text-align: left;
    width: 100%;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.menu button:last-child {
    border-bottom: none;
}

.menu button:hover {
    text-decoration: underline;
    color: var(--hover-blue);
}

.hero-image-placeholder {
    height: 120px;
    background-color: transparent;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
}

.content-section {
    display: none;
    padding: 40px;
    margin-top: 24px;
    margin-bottom: 0;
    border-radius: var(--border-radius);
    text-align: center;
}

.content-section.active {
    display: block;
}

.bg-white {
    background-color: var(--bg-white);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.bg-gray {
    background-color: var(--bg-white);
}

.main-footer {
    background-color: transparent;
    color: var(--primary-blue);
    text-align: center;
    padding: 30px 20px 60px 20px;
    margin-top: 180px;
    position: relative;
    z-index: 1;
}

.main-footer a {
    color: var(--primary-blue);
    text-decoration: none;
}

.main-footer a:hover {
    color: var(--hover-blue);
    text-decoration: underline;
}

.floating-contact-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-blue);
    color: #ffffff;
    border: 2px solid var(--primary-blue);
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    transition:
        background-color 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.floating-contact-btn:hover {
    background-color: var(--hover-blue);
    border-color: var(--hover-blue);
    color: #ffffff;
}

.popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9000;
}

.popup-inhalt {
    background-color: white;
    max-width: 400px;
    margin: 10% auto;
    padding: 30px;
    border-radius: var(--border-radius);
    position: relative;
    z-index: 9001;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.schliessen-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #666666;
}

.kontakt-formular {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.kontakt-formular input,
.kontakt-formular textarea {
    padding: 12px;
    border: 1px solid #cccccc;
    border-radius: var(--border-radius);
    font-family: inherit;
}

.kontakt-formular button {
    background-color: #ffffff;
    color: var(--primary-blue);
    padding: 12px;
    border: 2px solid var(--primary-blue);
    border-radius: var(--border-radius);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.kontakt-formular button:hover {
    background-color: #f0f0f0;
    color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.no-scroll {
    overflow: hidden;
}

.search-overlay {
    display: none;
}

@media (max-width: 768px) {
    .main-header {
        padding: 14px 16px !important;
        height: auto !important;
        overflow: visible;
        z-index: 5000;
        will-change: auto;
    }

    .header-container {
        max-width: none;
        height: auto;
        min-height: 118px;
        padding: 0;
        display: grid;
        grid-template-columns: 44px 1fr 44px;
        grid-template-rows: 44px 44px;
        align-items: center;
        column-gap: 10px;
        row-gap: 8px;
    }

    .search-side {
        display: contents;
    }

    .menu-side {
        display: contents;
    }

    .logo {
        grid-column: 2;
        grid-row: 1 / span 2;
        min-width: 0;
        min-height: 96px;
    }

    .logo-img {
        height: 130px !important;
        width: auto;
        max-width: none;
        max-height: none;
    }

    .search-container {
        grid-column: 1;
        grid-row: 1;
        width: 44px;
        min-width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .search-shell {
        width: 44px;
        min-width: 44px;
        height: 44px;
        min-height: 44px;
        justify-content: center;
        border-radius: var(--border-radius);
    }

    .search-bar,
    .search-bar.open {
        display: none;
    }

    .search-results-desktop {
        display: none !important;
    }

    .search-icon-btn {
        width: 44px;
        min-width: 44px;
        height: 44px;
        padding: 0;
    }

    .search-icon-btn svg {
        width: 18px;
        height: 18px;
    }

    .lang-switch {
        grid-column: 1;
        grid-row: 2;
        min-width: 44px;
        height: 44px;
        padding: 0;
        font-size: 11px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px !important;
        text-align: center;
        white-space: nowrap;
    }

    .hamburger-btn {
        display: flex !important;
        grid-column: 3;
        grid-row: 1 / span 2;
        width: 44px !important;
        min-width: 44px;
        height: 96px !important;
        padding: 18px 7px;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        align-self: stretch;
        position: relative;
        z-index: 7000;
        visibility: visible;
        opacity: 1;
    }

    .hamburger-btn span {
        height: 3px !important;
        width: 100%;
    }

    .hamburger-btn.active span:nth-child(1) {
        transform: translateY(10px) rotate(45deg);
    }

    .hamburger-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger-btn.active span:nth-child(3) {
        transform: translateY(-10px) rotate(-45deg);
    }

    .menu {
        width: 90vw;
        max-width: 300px;
        right: 0;
        top: calc(100% + 8px);
    }

    body {
        background-attachment: scroll;
    }

    .search-overlay {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;
        background-color: rgba(255, 255, 255, 0.96);
        z-index: 8000;
        display: flex;
        justify-content: center;
        align-items: stretch;
        padding: 0;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-100%);
        transition: transform 0.35s ease, opacity 0.35s ease;
        box-sizing: border-box;
        overflow-y: auto;
    }

    .search-overlay.open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .search-overlay-box {
        width: 100%;
        min-height: 100dvh;
        margin-top: 0;
        border-radius: 0;
        padding: 88px 20px 24px 20px;
        box-shadow: none;
        background-color: white;
        position: relative;
        box-sizing: border-box;
    }

    .search-close-btn {
        position: absolute;
        top: 18px;
        right: 20px;
        background: none;
        border: none;
        font-size: 38px;
        line-height: 1;
        cursor: pointer;
        color: var(--primary-blue);
        z-index: 8001;
    }

    .search-overlay-box h2 {
        color: var(--primary-blue);
        margin: 0 0 20px 0;
    }

    .search-overlay-input {
        width: 100%;
        padding: 16px;
        font-size: 18px;
        border: 1px solid #cccccc;
        border-radius: var(--border-radius);
        box-sizing: border-box;
    }

    .search-results {
        gap: 10px;
        margin-top: 14px;
    }

    .hero-image-placeholder {
        height: 80px;
    }

    .content-section {
        padding: 20px;
        margin-top: 16px;
    }

    .floating-contact-btn {
        padding: 12px 30px;
        font-size: 16px;
    }
}

@media (max-width: 400px) {
    .main-header {
        padding: 12px 14px !important;
    }

    .header-container {
        min-height: 96px;
        grid-template-columns: 40px 1fr 40px;
        grid-template-rows: 40px 40px;
        column-gap: 8px;
        row-gap: 6px;
    }

    .logo {
        min-height: 95px;
    }

    .logo-img {
        height: 130px !important;
    }

    .search-container {
        width: 40px;
        min-width: 40px;
        height: 40px;
    }

    .search-shell,
    .search-icon-btn {
        width: 40px;
        min-width: 40px;
        height: 40px;
        min-height: 40px;
    }

    .lang-switch {
        font-size: 10px !important;
        gap: 3px !important;
    }

    .hamburger-btn {
        width: 40px !important;
        min-width: 40px;
        height: 86px !important;
        padding: 16px 6px;
    }

    .hamburger-btn.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .hamburger-btn.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    .search-overlay-box {
        padding: 78px 16px 20px 16px;
    }
}