/* Module: navbar.css — navbar, header, subnav, search bar, logo, user button, hover panels, search suggestions */

/* Navbar Styles */
.navbar {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: fixed !important;
    top: 0 !important;
    left: 0;
    right: 0;
    z-index: 1030;
    height: var(--navbar-height, 100px);
    display: flex;
    align-items: center;
    padding: 0 30px;
    --search-radius: 18px;
}

.navbar>.container-fluid {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar .logo.d-none.d-md-inline {
    margin-right: 1.5rem;
}

/* Hide-on-scroll behavior for navbar */
.navbar {
    transition: transform 0.2s ease-in-out;
    will-change: transform;
}

.navbar.navbar-hidden {
    transform: translateY(-100%);
}

.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
    gap: 1rem;
    width: 350px;
    font-size: 1.5rem;
    font-weight: bold;
}

.brand-name {
    font-size: 2.2rem;
    font-weight: bold;
    color: white;
    margin-left: 15px;
}

/* Search Styles */
.search-container {
    flex: 1;
    max-width: 600px;
    margin: 0 2rem;
    position: relative;
}

/* Vereinheitlichte Navbar-Suchleiste wie Landing: vollbreit und stärker abgerundet */
.navbar .search-container {
    max-width: 100%;
    margin: 0;
    transition: margin 0.2s ease;
}

@media (min-width: 992px) {
    .navbar .search-container {
        margin-left: 2rem;
    }
}

.search-form {
    display: flex;
    position: relative;
    width: 100%;
}

.navbar .search-input,
.search-input {
    width: 100%;
    height: 42px !important;
    padding: 0.5rem 1.4rem !important;
    padding-right: 3.5rem !important;
    border: 1px solid #3e3f41 !important;
    border-radius: 50px !important;
    font-size: 0.95rem !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    background: #ffffff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    color: #000 !important;
}

.navbar .search-input:focus,
.search-input:focus {
    outline: none !important;
    border-color: #000000 !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1) !important;
}

.search-button {
    position: absolute;
    right: var(--search-btn-right-desktop);
    top: var(--search-btn-top-desktop);
    bottom: var(--search-btn-bottom-desktop);
    transform: none;
    background: #007fa3;
    border: none;
    color: #ffffff;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 50px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-clip: border-box;
    box-shadow: none;
    aspect-ratio: 1 / 1;
}

.search-button:hover {
    color: #ffffff;
    background: #006f94;
}

.search-button:focus {
    outline: none;
    box-shadow: none;
}

.search-button svg {
    width: 60%;
    height: 60%;
}

@media (max-width: 768px) {
    .navbar .search-input {
        height: 44px;
        font-size: 1rem;
        padding: 0.6rem 1rem;
        padding-right: 3.2rem;
    }

    .search-button {
        right: var(--search-btn-right-tablet);
    }
}

@media (max-width: 576px) {
    .navbar .search-container {
        padding: 0 10px;
    }

    .navbar .search-input {
        height: 46px;
        font-size: 1rem;
        padding: 0.7rem 1.1rem;
        padding-right: 3.4rem;
    }

    .search-button {
        right: var(--search-btn-right-mobile);
    }
}

.navbar-spacer {
    width: 350px;
}

/* User Button (Anmelden) rechts in der Navbar */
.user-button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    height: auto;
    margin-left: 6px;
    border-radius: 8px;
    /* Rounded rect for touch target */
    padding: 6px 8px;
    background: transparent;
    border: none;
    text-decoration: none;
    color: #4a5568;
    transition: background-color 0.2s, color 0.2s;
}

.user-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1a202c;
    text-decoration: none;
    /* Ensure no underline on label */
}

.user-button svg {
    width: 30px;
    height: 30px;
    margin-bottom: 2px;
}

.nav-label {
    font-size: 0.75rem;
    /* ~12px */
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .user-button {
        min-width: unset;
        width: auto;
        padding: 4px;
        margin-left: 5px;
    }

    .user-button svg {
        width: 24px;
        height: 24px;
        margin-bottom: 0;
    }

    /* Hide labels on mobile to save space if needed, or keep petite */
    .nav-label {
        display: none;
    }
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    display: none;
    min-width: 320px;
    overflow: hidden;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Wrapper für Suggestions-Liste und Bild */
.suggestions-wrapper {
    display: flex;
    max-height: 520px;
    min-height: 480px;
    overflow: hidden;
}

/* Suggestions-Liste (links) */
.suggestions-list {
    flex: 0 0 45%;
    overflow-y: auto;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    background: white;
    padding-top: 8px;
}

/* Produkte-Vorschau (rechts) */
.products-preview {
    flex: 1;
    background: #fcfcfc;
    padding: 16px;
    overflow-y: auto;
    border-left: 1px solid rgba(0, 0, 0, 0.03);
}

.products-preview-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.products-preview-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(0, 0, 0, 0.05);
}

.products-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.products-preview-instant {
    animation: fadeInPreview 0.2s ease-out;
}

@keyframes fadeInPreview {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.preview-product-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.preview-product-item:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 102, 255, 0.2);
    transform: translateY(-3px);
}

.preview-product-image {
    width: 100%;
    height: 120px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    transition: transform 0.2s;
}

.preview-product-item:hover .preview-product-image {
    transform: scale(1.05);
}

.preview-product-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.preview-product-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.preview-product-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: #008FB3;
}

/* Media Query für breitere Desktops */
@media (min-width: 992px) {
    .search-suggestions {
        min-width: 700px;
    }
}

/* Anpassungen für Mobile Overlay */
@media (max-width: 768px) {
    .suggestions-wrapper {
        flex-direction: column;
        max-height: none;
        height: 100%;
    }

    .suggestions-list {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid #f0f0f0;
    }

    .products-preview {
        flex: 1;
        background: white;
    }

    .products-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-suggestions {
        min-width: 0;
    }
}


.search-suggestions::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    border-left: 3px solid transparent;
}

.suggestion-item:hover,
.suggestion-item.active {
    background-color: #f8fafc;
    border-left-color: #00A8CC;
    padding-left: 24px;
}

.suggestion-item .suggestion-text {
    font-size: 0.95rem;
    color: #475569;
    flex: 1;
}

.suggestion-item.active .suggestion-text,
.suggestion-item:hover .suggestion-text {
    color: #00A8CC;
    font-weight: 500;
}

.suggestion-item .suggestion-meta {
    font-size: 0.7rem;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 10px;
    transition: all 0.1s;
}

.suggestion-item:hover .suggestion-meta,
.suggestion-item.active .suggestion-meta {
    background: #e0e7ff;
    color: #4338ca;
}

/* Hover Panels (Landing Unter-Navigation) */
.hover-panel {
    position: absolute;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 12px;
    min-width: 520px;
    max-width: 860px;
    z-index: 1300;
    /* Stabilisiere Farb-/AA-Darstellung beim Ein-/Ausblenden */
    isolation: isolate;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: opacity, transform;
}

/* Spezieller, schmaler Stil nur für das Kategorien‑Panel (eine Spalte) */
#hoverPanelCategories {
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    padding: 6px;
    /* noch kompakteres Innenpadding */
    max-height: 65vh;
    /* vertikal begrenzen */
    overflow-y: auto;
    /* Scrollen ermöglichen */
    overflow-x: hidden;
    /* keine horizontale Scrollleiste */
    overscroll-behavior: contain;
    /* Scroll nicht auf Seite durchreichen */
}

/* Breiteres Panel rechts für Unterkategorien (mehrspaltig) */
#hoverPanelSubcategories {
    width: 680px;
    min-width: 520px;
    max-width: 860px;
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Kleinere Abstände und umbruchfähige Linktexte im schmalen Panel */
#hoverPanelCategories .row {
    --bs-gutter-x: .2rem;
}

#hoverPanelCategories a {
    white-space: normal;
    word-break: break-word;
    font-size: .9rem;
    line-height: 1.2;
}

/* Dezente Scrollbar im Panel */
#hoverPanelCategories {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#hoverPanelCategories::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* Mobile: Hover‑Panels vollständig deaktivieren */
@media (max-width: 576px) {

    #hoverPanelCategories,
    #hoverPanelBrands {
        display: none !important;
    }
}

/* === Mobile Suggestions Overlay === */
@media (max-width: 768px) {
    body.suggestions-open {
        overflow: hidden !important;
    }

    /* Verstecke ALLES außer der Searchbar, wenn die Suche aktiv ist */
    body.suggestions-open #mobileTopBar,
    body.suggestions-open .subnav-wrap,
    body.suggestions-open .navbar .logo,
    body.suggestions-open .navbar .d-md-inline-flex {
        display: none !important;
    }

    /* Navbar-Höhe anpassen, wenn nur noch die Searchbar da ist */
    body.suggestions-open .navbar {
        height: auto !important;
        padding: 5px 0 !important;
        background: #fff !important;
        border-bottom: 1px solid #eee !important;
        z-index: 4000 !important;
    }

    body.suggestions-open .navbar .container-fluid {
        padding: 0 !important;
    }

    body.suggestions-open .navbar .search-container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 5px 12px !important;
    }

    /* Dropdown als Vollbild-Overlay unterhalb der Navbar */
    body.suggestions-open #searchSuggestions.search-suggestions {
        position: fixed !important;
        top: 60px !important;
        /* Passt zur kompakten mobilen Navbar */
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        height: calc(100vh - 60px) !important;
        height: calc(100dvh - 60px) !important;
        margin-top: 0 !important;
        border-radius: 0 !important;
        max-height: none !important;
        z-index: 3999 !important;
        border-top: 1px solid #f0f0f0 !important;
        display: block !important;
        pointer-events: auto !important;
        background: #fff !important;
        box-shadow: none !important;
    }

    body.suggestions-open #searchSuggestions .suggestions-wrapper {
        height: 100% !important;
    }
}

/* Smartphone-spezifische Anpassungen (Konsistenz gewahrt) */
@media (max-width: 576px) {
    body.suggestions-open #searchSuggestions.search-suggestions {
        top: 70px;
    }
}

/* Search Container Styles */
/* Entfernt doppelte Basisdefinition der Suchleiste; Landing-spezifisches in landing.css */
/* .search-container Breitensteuerung erfolgt kontextabhängig, Standard bleibt flexibel */

.search-container input {
    width: 100%;
    height: 45px;
    font-size: 1.1rem;
    padding-left: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    transition: border-color 0.3s ease;
}

.search-container input:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

/* Spacer */
.spacer {
    width: 150px;
}

/* Navbar rechte Gruppe: Suchleiste + Icons zusammen */
.navbar-right-group {
    gap: 0;
}

.navbar-search-center {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 1.5rem;
    position: relative;
}

/* Logo */
.logo {
    display: inline-flex;
    align-items: center;
    padding: 10px 0;
    text-decoration: none;
    white-space: nowrap;
}

.logo-image {
    display: block;
    width: auto;
    /* Breite automatisch basierend auf Höhe */
    height: auto;
    max-height: 80px;
    /* Begrenzt, damit Navbar nicht wächst */
    object-fit: contain;
}

/* === Sub-Navigation (eBay-Stil) === */
.subnav-wrap {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: fixed;
    top: var(--navbar-height, 100px);
    left: 0;
    right: 0;
    z-index: 1025;
    height: 40px;
    overflow: hidden;
    transform: translateY(0);
    opacity: 1;
    transition: transform 180ms ease-out, opacity 180ms ease-out;
    will-change: transform, opacity;
}

.subnav-wrap.subnav-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .subnav-wrap {
        top: var(--navbar-height, 60px);
    }
}

@media (max-width: 576px) {
    .subnav-wrap {
        top: var(--navbar-height, 55px);
    }
}

.subnav-wrap .container-fluid {
    height: 100%;
}

.subnav {
    display: flex;
    gap: 0;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow-x: auto;
    padding: 0;
    position: relative;
    height: 100%;
}

.subnav-link {
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0 12px;
    display: flex;
    align-items: center;
    height: 100%;
}

@media (hover: hover) {
    .subnav-link:hover {
        color: #2c3e50;
        text-decoration: underline;
    }
}

@media (max-width: 576px) {
    .subnav {
        justify-content: flex-start;
        gap: 12px;
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* Duplicate hover-panel definition used in subnav context */
.hover-panel {
    position: absolute;
    z-index: 1000;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 24px rgba(0,0,0,0.12);
    border-radius: 8px;
    padding: 12px;
}

/* Navbar responsive adjustments */
@media (max-width: 768px) {

    /* NAVBAR MOBILE */
    .navbar {
        padding: 0;
        height: auto;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .navbar>.container-fluid {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding-left: 8px;
        padding-right: 8px;
    }

    .logo-image {
        width: auto;
        max-height: 45px;
        /* Passt sicher in 55px/60px Navbar */
    }

    .navbar-brand {
        width: auto;
        font-size: 1rem;
        justify-content: flex-start;
    }

    .brand-name {
        font-size: 1.5rem;
        margin-left: 5px;
    }

    .search-container {
        margin: 0;
        max-width: 100%;
        width: 100%;
        flex: 0 0 auto;
    }

    .search-input {
        padding: 0.4rem 0.7rem;
        font-size: 0.9rem;
        height: 34px;
        /* Reduziert von 40px */
    }

    .navbar-spacer {
        display: none;
    }
}

/* SMARTPHONE DESIGN (max-width: 576px) */
@media (max-width: 576px) {

    /* NAVBAR SMARTPHONE */
    .navbar {
        height: auto;
        padding: 0;
    }

    .navbar>.container-fluid {
        padding-left: 6px;
        padding-right: 6px;
    }

    .navbar-brand {
        font-size: 0.9rem;
    }

    .brand-name {
        font-size: 1.2rem;
        margin-left: 3px;
    }

    /* SUCHLEISTE SMARTPHONE */
    .search-container {
        max-width: 100%;
        width: 100%;
    }

    .search-input {
        padding: 0.4rem 0.7rem;
        /* Weniger Padding oben/unten */
        font-size: 0.9rem;
        height: 34px;
        /* Reduziert von 38px */
        border-radius: 18px;
    }
}

@media (max-width: 400px) {
    .navbar-brand .brand-name {
        font-size: 1rem;
    }

    /* Landing-spezifische mobile Kompaktbreiten sind in landing.css ausgelagert */
}
