/* ═══════════════════════════════════════════════════════════════
   VIVEREA — Top-Navigation vollständig responsive
   Breakpoints: 768px (md), 1024px (lg)
   Kein Overflow, keine festen Breiten, keine absolute Positionierung
   ═══════════════════════════════════════════════════════════════ */

/* ── Base: Nav-Layout (flex, kein Overflow) ── */
body > nav:first-of-type {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    min-width: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background: #FFFFFF !important;
    border-bottom: 1px solid rgba(0,0,0,0.12) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
}

/* Container: volle Breite – Logo ganz links, Platz rechts für Einstellungen/Abmelden */
body > nav:first-of-type .v-nav-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 0 0.75rem 0 0.25rem !important;
    /* Rechts: Profil-Trigger + ggf. Burger — kein riesiges Padding (früher 22rem), mehr Platz für Nav-Mitte */
    padding-right: 6.4rem !important;
    gap: 0.5rem !important;
    min-width: 0 !important;
    overflow: visible !important;  /* WICHTIG: verhindert Clipping von v-nav-right (position:absolute) */
}
@media (min-width: 640px) {
    body > nav:first-of-type .v-nav-inner { padding: 0 1rem 0 0.5rem !important; padding-right: 6.4rem !important; }
}
@media (min-width: 768px) {
    body > nav:first-of-type .v-nav-inner { padding-right: 6.4rem !important; }
}
@media (min-width: 1024px) {
    body > nav:first-of-type .v-nav-inner { padding: 0 1.5rem 0 0.75rem !important; padding-right: 5.5rem !important; }
}


body > nav:first-of-type .v-nav-inner > a:first-of-type,
body > nav:first-of-type > a:first-of-type {
    flex-shrink: 0 !important;
}

/* Center-Nav: keine absolute Positionierung mehr */
body > nav:first-of-type .v-nav-center {
    position: static !important;
    left: auto !important;
    transform: none !important;
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0 0.5rem !important;
}
body > nav:first-of-type .v-nav-center::-webkit-scrollbar { display: none !important; }

/* Rechts-Gruppe: absolut am rechten Rand der Nav (markierter Bereich) */
body > nav:first-of-type .v-nav-right {
    position: absolute !important;
    right: 1.5rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 0.5rem !important;
    flex-shrink: 0 !important;
    min-width: 0 !important;
    flex-wrap: nowrap !important;
    /* Klicks durchlassen, damit zentrale Nav-Links (z. B. Nebenkosten) nicht „tot“ wirken */
    pointer-events: none !important;
}
body > nav:first-of-type .v-nav-right a,
body > nav:first-of-type .v-nav-right button {
    pointer-events: auto !important;
}

/* Einstellungen-Link – nie truncate */
.v-nav-einstellungen {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: #4B5563 !important;
    text-decoration: none !important;
    padding: 0.25rem 0.5rem !important;
    border-radius: 6px !important;
    transition: color 0.15s !important;
}
.v-nav-einstellungen:hover { color: #1F2937 !important; }
.v-nav-einstellungen-setup { display: none !important; }
.v-nav-einstellungen-full { display: none !important; }

/* Benutzername: truncate, max-w-[16ch] auf md, volle Breite auf xl */
.v-user-email {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    min-width: 0 !important;
    font-size: 0.8125rem !important;
    color: #6B7280 !important;
    margin-left: 1.25rem !important;  /* Abstand zu Einstellungen */
}

.v-btn-logout {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

/* Profil-Icon: nur Mobile */
.v-nav-profile-icon {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: #6B7280;
    text-decoration: none;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.v-nav-profile-icon:hover { background: rgba(0,0,0,0.04); color: #374151; }
.v-nav-profile-icon svg { width: 22px; height: 22px; }

/* Hamburger: nur Mobile */
.v-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    padding: 0;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.v-hamburger:hover { background: rgba(0,0,0,0.04); }
.v-hamburger svg { width: 22px; height: 22px; stroke: #1F2937; stroke-width: 2; }

/* ── Mobile (<768px) ── */
@media (max-width: 767px) {
    body > nav:first-of-type {
        height: 56px !important;
        flex-wrap: nowrap !important;
    }

    body > nav:first-of-type .v-nav-inner {
        padding-right: 6rem !important;  /* Nur Profil-Icon + Hamburger */
    }

    body > nav:first-of-type .v-nav-center {
        display: none !important;
    }

    body > nav:first-of-type .v-nav-right .v-user-email,
    body > nav:first-of-type .v-nav-right .v-btn-logout,
    body > nav:first-of-type .v-nav-right .v-nav-einstellungen-setup,
    body > nav:first-of-type .v-nav-right .v-nav-einstellungen-full {
        display: none !important;
    }

    .v-nav-profile-icon {
        display: flex !important;
    }

    .v-hamburger {
        display: flex !important;
    }

    body > nav:first-of-type img[alt="VIVEREA"] {
        height: 36px !important;
    }
}

/* ── Tablet (768px–1023px) ── */
@media (min-width: 768px) and (max-width: 1023px) {
    body > nav:first-of-type {
        height: 60px !important;
    }

    body > nav:first-of-type .v-nav-center {
        flex: 1 !important;
        min-width: 0 !important;
        justify-content: flex-start !important;
    }

    body > nav:first-of-type .v-nav-right .v-user-email {
        display: block !important;
    }

    .v-nav-profile-icon {
        display: none !important;
    }

    .v-hamburger {
        display: none !important;
    }

    .v-nav-einstellungen-setup {
        display: inline-flex !important;
        align-items: center !important;
    }

    .v-user-email {
        max-width: 16ch !important;
    }

    body > nav:first-of-type img[alt="VIVEREA"] {
        height: 40px !important;
    }
}

/* ── Desktop (1024px–1279px) ── */
@media (min-width: 1024px) and (max-width: 1279px) {
    body > nav:first-of-type {
        height: 72px !important;
        flex-wrap: nowrap !important;
    }

    body > nav:first-of-type .v-nav-center {
        flex: 1 !important;
        min-width: 0 !important;
        justify-content: center !important;
    }

    .v-nav-profile-icon {
        display: none !important;
    }

    .v-hamburger {
        display: none !important;
    }

    .v-nav-einstellungen-setup {
        display: inline-flex !important;
        align-items: center !important;
    }

    .v-user-email {
        max-width: 16ch !important;
    }
}

/* ── XL (≥1280px): Einstellungen voller Text, E-Mail volle Breite ── */
@media (min-width: 1280px) {
    body > nav:first-of-type {
        height: 72px !important;
        flex-wrap: nowrap !important;
    }

    body > nav:first-of-type .v-nav-center {
        flex: 1 !important;
        min-width: 0 !important;
        justify-content: center !important;
    }

    .v-nav-profile-icon {
        display: none !important;
    }

    .v-hamburger {
        display: none !important;
    }

    .v-nav-einstellungen-setup {
        display: none !important;
    }

    .v-nav-einstellungen-full {
        display: inline-flex !important;
        align-items: center !important;
    }

    .v-user-email {
        max-width: none !important;
    }
}

/* Mobile-Menü: vertikale Links */
.v-mobile-menu-links {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 1rem 1.25rem !important;
}
.v-mobile-menu-links a {
    padding: 0.875rem 1rem !important;
    border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}

/* ───────────────────────────────────────────────────────────────
   Clean Header: Rechts nur Profil-Button + Dropdown
   ─────────────────────────────────────────────────────────────── */

body > nav:first-of-type .v-nav-right .v-user-email,
body > nav:first-of-type .v-nav-right .v-btn-logout,
body > nav:first-of-type .v-nav-right .v-nav-einstellungen-setup,
body > nav:first-of-type .v-nav-right .v-nav-einstellungen-full {
    display: none !important;
}

.v-nav-profile-icon.v-profile-trigger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--bg-0, #F2F4F7) !important;
    color: var(--on-bg-dim, #4B5563) !important;
    border: 1px solid var(--separator-subtle, #E5E7EB);
    text-decoration: none;
    position: relative;
}
.v-nav-profile-icon.v-profile-trigger:hover {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}
.v-nav-profile-icon.v-profile-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
.v-profile-initials {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.v-desktop-profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(260px, calc(100vw - 20px));
    min-width: 220px;
    border: 1px solid var(--separator-subtle, #E5E7EB);
    border-radius: 12px;
    background: var(--bg-1, #FFFFFF);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.14);
    padding: 0.5rem;
    z-index: 350;
    display: none;
}
.v-desktop-profile-menu.open { display: block; }
.v-desktop-profile-email {
    font-size: 0.8rem;
    color: var(--on-bg-muted, #6B7280);
    padding: 0.5rem 0.625rem 0.6rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid var(--separator-subtle, #EEF2F7);
    word-break: break-all;
}
.v-desktop-profile-item {
    display: flex;
    align-items: center;
    width: 100%;
    text-decoration: none;
    border: none;
    background: transparent;
    color: var(--on-bg, #111827);
    font-size: 0.86rem;
    font-weight: 500;
    padding: 0.56rem 0.65rem;
    border-radius: 9px;
    cursor: pointer;
}
.v-desktop-profile-item:hover { background: var(--hover-bg, #F3F6FA); }
.v-desktop-profile-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.20);
}
.v-desktop-profile-item.logout { color: #B91C1C; }
.v-desktop-profile-item.logout:hover { background: #FEE2E2; }
.v-desktop-profile-divider {
    height: 1px;
    margin: 0.35rem 0;
    background: var(--separator-subtle, #EEF2F7);
}

/* Desktop >=1024: nur Profil rechts */
@media (min-width: 1024px) {
    body > nav:first-of-type .v-nav-inner {
        padding-right: 5.5rem !important;
    }
    .v-nav-profile-icon.v-profile-trigger {
        display: inline-flex !important;
        width: 32px;
        height: 32px;
    }
    .v-hamburger {
        display: none !important;
    }
    body > nav:first-of-type .v-nav-center {
        display: flex !important;
    }
}

/* Laptop / Surface: kompaktere Hauptnav, mehr sichtbare Links */
@media (min-width: 1024px) and (max-width: 1440px) {
    body > nav:first-of-type .v-nav-center {
        gap: 0 !important;
        padding: 0 0.35rem !important;
    }
    body > nav:first-of-type .v-nav-center .v-nav-item {
        padding: 0.45rem 0.5rem !important;
        font-size: 0.8125rem !important;
    }
}

/* <1024: Burger + Profil rechts */
@media (max-width: 1023px) {
    body > nav:first-of-type .v-nav-inner {
        padding-right: 6.4rem !important;
    }
    body > nav:first-of-type .v-nav-center {
        display: none !important;
    }
    .v-hamburger {
        display: flex !important;
    }
    .v-nav-profile-icon.v-profile-trigger {
        display: inline-flex !important;
        width: 28px;
        height: 28px;
    }
}
