/* ============================================================
   Blog Enhanced Pro - Smart Search v2.0
   Fullscreen Doofinder-Style Search Overlay
   ============================================================ */

/* --- Overlay (Fullscreen) --- */
.bep-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #fff;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.18s ease;
    overflow: hidden;
}
.bep-search-overlay.active {
    display: flex;
    opacity: 1;
}
.bep-search-overlay.entering {
    display: flex;
}

/* --- Search Bar (sticky top) --- */
.bep-search-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 20px;
}
.bep-search-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 60px;
}
.bep-search-icon {
    color: #9ca3af;
    flex-shrink: 0;
}
.bep-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 18px;
    font-weight: 400;
    color: #1a1a1a;
    background: transparent;
    padding: 0;
    min-width: 0;
}
.bep-search-input::placeholder {
    color: #9ca3af;
}
.bep-search-spinner {
    display: none;
    color: #6b7280;
    animation: bep-fade-in 0.2s;
}
.bep-search-spinner.active {
    display: flex;
}
.bep-search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    color: #6b7280;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s;
}
.bep-search-clear:hover {
    background: #e5e7eb;
}
.bep-search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    flex-shrink: 0;
    transition: background 0.12s;
}
.bep-search-close:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

/* --- Body (scrollable) --- */
.bep-search-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px 80px;
}

/* --- HOME STATE --- */
.bep-home {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 20px;
}
.bep-home-recent {
    margin-bottom: 24px;
}
.bep-home-recent-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.bep-home-label {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
}
.bep-recent-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}
.bep-recent-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}
.bep-recent-chip:hover {
    background: #e5e7eb;
}
.bep-recent-chip-x {
    display: inline-flex;
    color: #9ca3af;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}
.bep-recent-chip-x:hover {
    color: #374151;
}
.bep-clear-recent {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    padding: 0;
}
.bep-clear-recent:hover {
    text-decoration: underline;
}
.bep-home-columns {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
}
.bep-home-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px;
}

/* Beliebte Suchanfragen */
.bep-trending-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.bep-trending-item {
    font-size: 14px;
    color: #4b5563;
    padding: 6px 0;
    cursor: pointer;
    transition: color 0.1s;
    text-decoration: none;
    display: block;
}
.bep-trending-item:hover {
    color: #1a1a1a;
}

/* Aktuelle Highlights Grid */
.bep-highlights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

/* --- RESULTS STATE --- */
.bep-results {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 12px;
}
.bep-results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 12px;
    border-bottom: 1px solid #f3f4f6;
    margin-bottom: 16px;
}
.bep-results-count-total {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}
.bep-results-sort {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
}
.bep-sort-select {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    cursor: pointer;
    outline: none;
}

/* Korrekturvorschlag */
.bep-corrected {
    padding: 8px 0 12px;
    font-size: 14px;
    color: #6b7280;
}
.bep-corrected a {
    color: #3b82f6;
    font-weight: 600;
    text-decoration: none;
}
.bep-corrected a:hover {
    text-decoration: underline;
}

/* Results Layout */
.bep-results-layout {
    display: flex;
    gap: 0;
}
.bep-results-main {
    flex: 1;
    min-width: 0;
}

/* Section Headers */
.bep-section-header {
    padding: 0 0 12px;
}
.bep-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.bep-section-count {
    font-weight: 400;
    color: #9ca3af;
    font-size: 13px;
}
.bep-section-header-collapsible {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 12px;
    border-top: 1px solid #f3f4f6;
    margin-top: 16px;
}
.bep-collapse-icon {
    color: #9ca3af;
    transition: transform 0.2s;
}
.bep-section-blogs.collapsed .bep-collapse-icon {
    transform: rotate(-90deg);
}
.bep-section-blogs.collapsed .bep-blog-list {
    display: none;
}

/* --- Product Grid --- */
.bep-product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
}
.bep-product-card {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border: 1px solid #f3f4f6;
    border-radius: 4px;
    transition: box-shadow 0.15s;
    position: relative;
    background: #fff;
}
.bep-product-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    z-index: 1;
}
.bep-product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.bep-product-img-wrap {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: #fff;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bep-product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}
.bep-product-img-placeholder {
    color: #e5e7eb;
}
.bep-product-name {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 6px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.bep-product-price {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

/* Warenkorb-Button */
.bep-product-buy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: #059669;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: auto;
    white-space: nowrap;
}
.bep-product-buy:hover {
    background: #047857;
}
.bep-product-buy.bep-adding {
    opacity: 0.6;
    pointer-events: none;
}
.bep-product-buy.bep-added {
    background: #059669;
}
.bep-product-buy svg {
    flex-shrink: 0;
}

/* --- Blog List --- */
.bep-blog-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.bep-blog-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f9fafb;
    transition: background 0.1s;
    border-radius: 6px;
}
.bep-blog-item:hover {
    background: #f9fafb;
}
.bep-blog-thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f3f4f6;
}
.bep-blog-thumb-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
    flex-shrink: 0;
}
.bep-blog-info {
    flex: 1;
    min-width: 0;
}
.bep-blog-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 4px;
    line-height: 1.3;
}
.bep-blog-excerpt {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 4px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.bep-blog-meta {
    font-size: 12px;
    color: #9ca3af;
    display: flex;
    gap: 12px;
}

/* --- Empty State --- */
.bep-empty {
    text-align: center;
    padding: 60px 20px;
}
.bep-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin: 16px 0 4px;
}
.bep-empty-text {
    font-size: 14px;
    color: #9ca3af;
    margin: 0 0 16px;
}
.bep-suggestion-chips {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}
.bep-suggestion-chip {
    padding: 6px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: background 0.12s;
}
.bep-suggestion-chip:hover {
    background: #e5e7eb;
}

/* --- Autocomplete --- */
.bep-autocomplete {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 8px;
}
.bep-autocomplete-list {
    display: flex;
    flex-direction: column;
}
.bep-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.1s;
    font-size: 14px;
    color: #374151;
}
.bep-autocomplete-item:hover,
.bep-autocomplete-item.bep-active {
    background: #f3f4f6;
}
.bep-autocomplete-icon {
    width: 16px;
    height: 16px;
    color: #9ca3af;
    flex-shrink: 0;
}
.bep-autocomplete-type {
    margin-left: auto;
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Skeleton --- */
.bep-skeleton {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 20px;
}
.bep-skeleton-bar {
    height: 14px;
    width: 160px;
    background: #f3f4f6;
    border-radius: 4px;
    margin-bottom: 20px;
    animation: bep-pulse 1.2s infinite;
}
.bep-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
}
.bep-skeleton-card {
    padding: 12px;
    border: 1px solid #f3f4f6;
}
.bep-skeleton-img {
    width: 100%;
    aspect-ratio: 1;
    background: #f3f4f6;
    border-radius: 4px;
    margin-bottom: 10px;
    animation: bep-pulse 1.2s infinite;
}
.bep-skeleton-line {
    height: 12px;
    background: #f3f4f6;
    border-radius: 4px;
    margin-bottom: 6px;
    animation: bep-pulse 1.2s infinite;
}
.bep-skeleton-line.w80 { width: 80%; }
.bep-skeleton-line.w70 { width: 70%; }
.bep-skeleton-line.w60 { width: 60%; }
.bep-skeleton-line.w40 { width: 40%; }

@keyframes bep-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes bep-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Branding --- */
.bep-branding {
    position: fixed;
    bottom: 12px;
    right: 16px;
    font-size: 11px;
    color: #d1d5db;
    pointer-events: none;
    z-index: 100000;
    display: none;
}
.bep-search-overlay.active .bep-branding {
    display: block;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
    .bep-product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .bep-skeleton-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .bep-highlights-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

/* Mobile */
@media (max-width: 640px) {
    .bep-search-bar {
        padding: 0 12px;
    }
    .bep-search-bar-inner {
        height: 52px;
        gap: 8px;
    }
    .bep-search-input {
        font-size: 16px;
    }
    .bep-search-body {
        padding: 0 12px 80px;
    }

    .bep-home-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .bep-product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .bep-skeleton-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Kaufbutton: nur Icon auf Mobile */
    .bep-product-buy span {
        display: none;
    }
    .bep-product-buy {
        padding: 10px;
    }

    .bep-product-name {
        font-size: 12px;
    }
    .bep-product-price {
        font-size: 13px;
    }

    .bep-results-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .bep-blog-thumb, .bep-blog-thumb-placeholder {
        width: 48px;
        height: 48px;
    }
}

/* Desktop Large */
@media (min-width: 1200px) {
    .bep-product-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .bep-skeleton-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1600px) {
    .bep-product-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ============================================================
   SEARCH TAKEOVER MODE
   ============================================================ */

/* #search + alle Kinder sichtbar machen (auch gegen NOVAChild custom.css !important) */
body.bep-search-takeover #search,
body.bep-search-takeover #shop-nav .nav-item:first-child,
body.bep-search-takeover header .search-wrapper,
body.bep-search-takeover header .search-form-wrapper {
    display: block !important;
    visibility: visible !important;
}
body.bep-search-takeover #search input[name="qs"] {
    cursor: pointer !important;
    caret-color: transparent !important;
}
/* Typeahead verstecken */
body.bep-search-takeover .tt-menu,
body.bep-search-takeover .tt-dropdown-menu,
body.bep-search-takeover .tt-hint {
    display: none !important;
}

/* Mobile: Doppelte Suchfelder verhindern */
@media (max-width: 991px) {
    body.bep-search-takeover #search .search-form,
    body.bep-search-takeover #search form[action*="search"] {
        display: none !important;
    }
}

/* Mark/Highlight in Suchergebnissen */
.bep-highlight, mark.bep-highlight {
    background: transparent;
    color: inherit;
    font-weight: 700;
}
