/* ==============================================
   FAMILIENKIEZ - HEADER & NAVIGATION (NEO-BRUTALISM)
   Sticky Top & Floating Pill.
   ============================================== */

/* --- Sticky Top Header (Desktop) --- */
.site-header {
    background: var(--bg-card);
    border-bottom: 2px solid var(--color-ink);
    position: sticky;
    top: 0;
    z-index: 900;
    padding: 1rem 0;
}

.header-content {
    display: flex;
    align-items: center;
}

/* Fix for Dark Mode Hover Contrast (White Icon on Yellow BG) */
/* Force Black Text/Icon on Yellow Background in all modes */
.nav-link:hover span,
.nav-link.active span,
.nav-dropdown-item:hover,
.header-msg-btn:hover,
.header-icon-btn:hover,
/* Added Help Icon Class */
.header-user-badge:hover {
    color: var(--text-on-bright);
    /* Always Black on Hover/Active */
}

/* Ensure Icons inside these elements also turn black */
.nav-link:hover i,
.nav-dropdown-item:hover i,
.header-msg-btn:hover i,
.header-icon-btn:hover i,
/* Added Help Icon Class */
.header-user-badge:hover i {
    color: var(--text-on-bright);
}

/* DEFINITION: Generic Header Icon Button (Missing before) */
.header-icon-btn {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
}

.theme-toggle-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    line-height: 1;
}

/* Theme toggle is a button (not <a>), so it needs its own hover marker */
@media (min-width: 992px) {
    .theme-toggle-btn:hover {
        background: var(--color-yellow);
        color: var(--color-text-on-yellow);
        border-radius: 4px;
    }

    .theme-toggle-btn:hover i {
        color: var(--color-text-on-yellow);
    }
}

.theme-toggle-btn:focus-visible {
    outline: 2px solid var(--color-ink);
    outline-offset: 2px;
}

.header-icon-btn:hover {
    background-color: var(--color-yellow);
    color: var(--color-text-on-yellow);
    border-radius: 4px;
}

/* --- LOGO (LAUT) --- */
.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--color-ink);
    text-decoration: none;
    letter-spacing: -0.05em;
    border: 2px solid transparent;
    /* Platzhalter */
    padding: 0.25rem 0;
}

.logo:hover {
    color: var(--color-ink);
    /* Kein Farbwechsel */
    text-shadow: 2px 2px 0px var(--color-coral);
    background: none;
}


/* ==============================================
   DESKTOP NAVIGATION (Links)
   ============================================== */
/* ==============================================
   DESKTOP NAVIGATION (Links)
   ============================================== */
.main-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    /* Reduziert von 1.5rem für mehr Platz */
    margin-left: 2rem;
    /* Reduziert von 3rem */
}

/* Base Link Style */
.nav-link {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-ink);
    text-transform: uppercase;
    text-decoration: none;
    padding: 0.75rem 0.5rem;
    /* Optimiert für Touch (min 44px Höhe inkl Line-Height) */
    border-bottom: none;
    /* Reset */
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    white-space: nowrap;
    /* Verhindert Umbruch */
    flex-shrink: 0;
    /* Verhindert Stauchen */
}

/* Der Text-Wrapper (Marker) */
.nav-link span {
    position: relative;
    padding: 0.1rem 0.15rem;
    /* Tighter padding */
    background: transparent;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    /* Snappy */
    z-index: 10;
    border: 2px solid transparent;
    /* Prevent layout shift */
}

/* HOVER & ACTIVE STATE ("The Lift") */
.nav-link:hover span,
.nav-link.active span {
    background-color: var(--color-yellow);
    color: var(--text-on-bright);
    /* FORCE BLACK ON YELLOW */
    box-shadow: 2px 2px 0px var(--color-ink);
    /* Hard Shadow */
    transform: translateY(-2px);
    /* Dynamic Pop */
    border: 2px solid var(--color-ink);
}

/* Specific Fix: Dropdown Toggle muss icon separat behandeln */
.nav-dropdown-toggle i {
    margin-left: 0.25rem;
    transition: transform 0.2s;
}

.nav-dropdown-toggle:hover i {
    transform: translateY(2px);
}


/* Dropdown (The Brutal Box) */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    /* Restyled to match nav-link via class already */
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 1rem);
    /* Abstand */
    left: 50%;
    transform: translateX(-50%);

    background: var(--bg-card);
    border: 2px solid var(--color-ink);
    box-shadow: 4px 4px 0px 0px var(--color-ink);
    /* Hard Shadow */

    padding: 0;
    /* Brutalism needs no padding wrapper */
    min-width: 240px;
    /* Etwas breiter */

    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease;
    z-index: 1000;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    top: calc(100% + 0.5rem);
    /* Slide Up Effekt */
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--color-ink);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid var(--color-ink);
    background: var(--bg-card);
    transition: background 0.1s;
}

.nav-dropdown-item span {
    transition: transform 0.1s;
}

.nav-dropdown-item:last-child {
    border-bottom: none;
}

.nav-dropdown-item:hover {
    background: var(--color-yellow);
    color: var(--text-on-bright);
    /* FORCE BLACK ON YELLOW */
}

.nav-dropdown-item:hover span {
    transform: translateX(4px);
    /* Kleiner nudge nach rechts */
}

.nav-dropdown-item i {
    font-size: 1.2rem;
}

/* ==============================================
   HEADER RIGHT (User & Actions)
   ============================================== */
.header-right-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

/* --- Profile Dropdown (Right-aligned) --- */
.profile-dropdown {
    position: relative;
}

.profile-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
}

.profile-dropdown-menu {
    right: 0;
    left: auto;
    transform: none;
    min-width: 200px;
}

/* Danger item (Abmelden) */
.nav-dropdown-item-danger {
    color: var(--danger-color, #c0392b);
}

.nav-dropdown-item-danger:hover {
    background: var(--danger-color, #c0392b);
    color: var(--text-light);
}

.nav-dropdown-item-danger:hover i {
    color: var(--text-light);
}

/* Highlight item (Anmelden für Gäste) */
.nav-dropdown-item-highlight {
    font-weight: 800;
}

.nav-dropdown-item-highlight:hover {
    background: var(--color-teal);
}

/* Button-Resets für Buttons innerhalb von Dropdowns */
button.nav-dropdown-item {
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    border-bottom: 2px solid var(--color-ink);
}

button.nav-dropdown-item:last-child {
    border-bottom: none;
}

/* ==============================================
   MOBILE BOTTOM NAV (Base) - 5 Items
   ============================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    /* Bündig am unteren Bildschirmrand */
    left: 0;
    width: 100%;
    /* Volle Breite */
    max-width: none;
    /* Limit entfernen */

    background: var(--bg-card);
    border-top: 2px solid var(--color-ink);
    /* Nur noch Rand oben */
    border-bottom: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    /* Flach, keine Pille mehr */

    /* Schatten reduzieren, da es nicht mehr schwebt,
       aber vielleicht einen ganz leichten subtilen Schatten nach oben?
       Alternativ: Kein Schatten, da brutale 2px Border ausreichen. */
    box-shadow: none;

    display: flex;
    justify-content: space-around;
    /* Nutzt volle Breite besser */
    padding: 0.5rem 0;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    /* iOS Swipe-Balken Support */
    z-index: 1000;

    /* Scroll-Animation */
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-ink);
    text-decoration: none;
    flex: 1;
    position: relative;
    padding: 0.25rem;
    /* Reset für Button-Variante */
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    border-radius: 8px;
}

.bottom-nav-item i {
    font-size: 1.5rem;
    margin-bottom: 2px;
    color: var(--color-ink);
    transition: color 0.2s;
}

.bottom-nav-item:hover,
.bottom-nav-item:active {
    background-color: var(--color-yellow);
    color: var(--text-on-bright);
}

.bottom-nav-item:hover i,
.bottom-nav-item:active i {
    color: var(--text-on-bright);
}

/* Active State: Kleiner Punkt darunter */
.bottom-nav-item.active::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--color-coral);
    border-radius: 50%;
    border: 1px solid var(--color-ink);
    margin-top: 2px;
}

.bottom-nav-item span {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    display: none;
    /* Zu voll für die Pille */
}

/* Hidden-State für Scroll-Verhalten */
.bottom-nav.nav-hidden {
    transform: translateY(100%);
    /* Komplett nach unten rausschieben */
}

@media (min-width: 992px) {
    .bottom-nav {
        display: none;
    }
}

/* ==============================================
   MEHR-PANEL (Bottom Sheet) - NEO BRUTALISM
   ============================================== */
.more-panel-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-50);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.more-panel-overlay.open {
    opacity: 1;
    visibility: visible;
}

.more-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 3px solid var(--color-ink);
    border-radius: 16px 16px 0 0;
    z-index: 1002;
    padding: 0.75rem 1.25rem 2rem;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    max-height: 95vh;
    overflow-y: auto;
}

.more-panel.open {
    transform: translateY(0);
}

/* Header Controls im Panel (Handle + Schließen) */
.more-panel-header-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 1rem;
    min-height: 24px;
}

/* Zug-Griff oben (Zentriert) */
.more-panel-handle {
    width: 40px;
    height: 4px;
    background: var(--color-ink);
    border-radius: 2px;
    opacity: 0.3;
}

/* Schließen Buttons oben rechts */
.more-panel-close-btn {
    position: absolute;
    right: -0.25rem;
    /* Leicht ins Padding rücken */
    top: -0.25rem;
    background: transparent;
    border: none;
    color: var(--color-ink);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: background 0.15s ease, transform 0.1s ease;
}

.more-panel-close-btn:hover {
    background: var(--color-yellow);
    color: var(--text-on-bright);
}

.more-panel-close-btn:active {
    transform: scale(0.9);
}

/* --- Profil-Bereich --- */
.more-panel-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 2px solid var(--color-ink);
    box-shadow: 3px 3px 0 var(--color-ink);
    text-decoration: none;
    color: var(--color-ink);
    transition: all 0.15s ease;
    background: var(--bg-card);
}

.more-panel-profile:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 var(--color-ink);
    background: var(--color-yellow);
    color: var(--text-on-bright);
}

.more-panel-profile:hover .more-panel-profile-info small,
.more-panel-profile:hover>i:last-child {
    color: var(--text-strong);
    /* Darker muted for yellow bg */
}

.more-panel-avatar {
    width: 40px;
    height: 40px;
    background: var(--color-ink);
    color: var(--text-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.more-panel-profile-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    line-height: 1.3;
}

.more-panel-profile-info strong {
    font-size: 0.95rem;
}

.more-panel-profile-info small {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.more-panel-profile>i:last-child {
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* --- Sektionen --- */
.more-panel-section {
    margin-bottom: 1rem;
}

.more-panel-section-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

/* --- Grid (2 Spalten) --- */
.more-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.more-panel-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    text-decoration: none;
    color: var(--color-ink);
    font-weight: 600;
    font-size: 0.85rem;
    border: 2px solid var(--color-ink);
    background: var(--bg-card);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.12s ease;
    min-width: 0;
    text-align: left; /* Überschreibt Browser-Default für Buttons */
}

.more-panel-item:hover {
    background: var(--color-yellow);
    transform: translate(1px, 1px);
    box-shadow: none;
    color: var(--text-on-bright);
}

.more-panel-item i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.more-panel-item span {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Aktions-Buttons im Neo-Brutalism Look - erben Hintergrund von .more-panel-item (var(--bg-card)) um Inkonsistenzen zu vermeiden */

/* --- Menu Item Colors (Neo-Brutalism Icon Backgrounds) --- */
.menu-icon-bg {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-ink);
    box-shadow: 2px 2px 0 var(--color-ink);
    flex-shrink: 0;
}

.menu-icon-bg i {
    font-size: 1.2rem !important;
    margin: 0 !important;
    color: var(--color-ink) !important;
}

/* Color Modifiers for Icons */
.icon-bg-tipps {
    background-color: var(--type-place-bg);
}

.icon-bg-projekte {
    background-color: var(--type-project-bg);
}

.icon-bg-termine {
    background-color: var(--type-event-bg);
}

.icon-bg-marktplatz {
    background-color: var(--type-marketplace-bg);
}

.icon-bg-experten {
    background-color: var(--type-expert-bg);
}

.icon-bg-wegweiser {
    background-color: var(--type-guide-bg);
}

.icon-bg-kieztalk {
    background-color: var(--type-discussion-bg);
}

.icon-bg-help {
    background-color: var(--bg-card);
}

.icon-bg-feedback {
    background-color: var(--bg-card);
}

.icon-bg-donate {
    background-color: var(--bg-card);
}

.icon-bg-create {
    background-color: var(--bg-card);
}

.icon-bg-kim {
    background-color: var(--type-kim-bg);
}

/* Remove default icon styles when using the bg-wrapper in more-panel */
.more-panel-item .menu-icon-bg+span {
    margin-left: 0.25rem;
}

.more-panel-item>i:not(.menu-icon-bg i) {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* --- KIM Highlight Block (Top of More Panel) --- */
.more-panel-kim-block {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--type-kim-bg);
    border: 2px solid var(--color-ink);
    box-shadow: 4px 4px 0 var(--color-ink);
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-decoration: none;
    color: var(--color-ink);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.more-panel-kim-block:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--color-ink);
    background-color: var(--color-yellow);
    color: var(--text-on-bright);
}

.more-panel-kim-block:hover .more-panel-kim-icon {
    /* Im Darkmode hat Icon var(--text-light) welches weiss ist, aber das Hover-Gelb weiss nicht verträgt.
       Wir fordern hier explizit Schwarz an. */
    color: var(--color-ink);
    border-color: var(--color-ink);
}

.more-panel-kim-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: 2px solid var(--color-ink);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 2px 2px 0 var(--color-ink);
    flex-shrink: 0;
}

.more-panel-kim-text {
    display: flex;
    flex-direction: column;
}

.more-panel-kim-title {
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1.2;
    text-transform: uppercase;
}

.more-panel-kim-subtitle {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.9;
}


/* Mehr-Panel auf Desktop ausblenden */
@media (min-width: 992px) {

    .more-panel,
    .more-panel-overlay,
    .mobile-header-controls {
        display: none !important;
    }
}

/* TABLET & COMPACT DESKTOP OPTIMIZATIONS (992px - 1250px) */
@media (min-width: 992px) and (max-width: 1250px) {
    .main-nav {
        margin-left: 0.5rem;
        gap: 0.25rem;
    }

    .nav-link {
        padding: 0.5rem 0.1rem;
        /* Ultra tight */
        font-size: 0.8rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    /* Avatar entfernt, also muss der Name auch auf Tablet sichtbar bleiben */
    /* .header-username { display: none; } wurde entfernt */

    .header-right-group {
        gap: 0.5rem;
    }
}

@media (max-width: 991px) {

    .main-nav,
    .header-right-group {
        display: none !important;
    }

    .site-header {
        position: relative;
        /* Auf Mobile scrollt Header weg */
        border-bottom: 2px solid var(--color-ink);
    }

    .header-content {
        justify-content: center;
        /* Logo zentriert auf Mobile */
        position: relative;
        /* For Absolute Positioning of Controls */
        min-height: 2.5rem;
    }

    /* Mobile Header Controls (Absolute Left/Right) */
    .mobile-header-controls {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 100%;
        display: flex;
        justify-content: space-between;
        pointer-events: none;
        /* Let Layout click through if needed, but links have pointer-events auto */
        padding: 0 1rem;
    }

    .mobile-icon-btn {
        pointer-events: auto;
        color: var(--color-ink);
        font-size: 1.5rem;
        text-decoration: none;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        transition: all 0.2s;
        border-radius: 8px;
    }

    .mobile-icon-btn:hover,
    .mobile-icon-btn:active {
        background-color: var(--color-yellow);
        color: var(--text-on-bright);
    }

    /* Guest Mobile Optimizations */
    .main-nav-guest {
        display: none;
        /* Hide desktop nav for guests on mobile */
    }

    .header-guest-actions {
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
    }

    .btn-alpha-login {
        padding: 0.35rem 0.75rem !important;
        font-size: 0.8rem !important;
        white-space: nowrap;
    }

    /* Hilfe-Icon auf Mobile in guest-actions verstecken (existiert schon in mobile-header-controls) */
    .guest-help-desktop {
        display: none !important;
    }
}

/* --- MESSAGE ICON & BADGE (Cleanup) --- */
.header-msg-btn {
    margin-right: 1rem;
    color: var(--text-muted);
    position: relative;
    text-decoration: none;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
}

.header-msg-btn:hover {
    color: var(--color-ink);
}

.header-msg-icon {
    font-size: 1.5rem;
}

.header-msg-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: var(--text-light);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: var(--brutal-radius);
    font-weight: 700;
}
