/**
 * VEBI Search Autocomplete - Megamenu Styles
 * Kategorie po lewej, produkty po prawej
 */

/* Dropdown container - megamenu */
.vebi-search-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 750px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    margin-top: 8px;
    overflow: hidden;
}

.vebi-search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Megamenu - two column layout */
.vebi-search-megamenu {
    display: flex;
    min-height: 280px;
    max-height: 450px;
}

/* Left column - categories */
.vebi-search-left {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.vebi-search-left .vebi-search-section {
    padding: 0;
    border: none;
}

.vebi-search-left .vebi-search-section:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

/* Right column - products */
.vebi-search-right {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    display: flex;
    flex-direction: column;
}

/* Loading state */
.vebi-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    color: #64748b;
    font-size: 14px;
    width: 100%;
}

.vebi-search-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #2558a8;
    border-radius: 50%;
    animation: vebi-spin 0.8s linear infinite;
    margin-right: 10px;
}

@keyframes vebi-spin {
    to { transform: rotate(360deg); }
}

/* No results */
.vebi-search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    color: #64748b;
    font-size: 14px;
    text-align: center;
    width: 100%;
}

.vebi-search-no-results-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

/* Section titles */
.vebi-search-section-title {
    padding: 12px 16px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 1;
}

.vebi-search-left .vebi-search-section-title {
    background: linear-gradient(to bottom, #f8fafc, rgba(248, 250, 252, 0.95));
}

.vebi-search-right .vebi-search-section-title {
    background: linear-gradient(to bottom, #fff, rgba(255, 255, 255, 0.95));
}

/* Items - common */
.vebi-search-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.15s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.vebi-search-item:hover,
.vebi-search-item.active {
    background: #fff;
    border-left-color: #2558a8;
}

.vebi-search-right .vebi-search-item:hover,
.vebi-search-right .vebi-search-item.active {
    background: #f8fafc;
    border-left-color: transparent;
}

.vebi-search-item mark {
    background: #fef08a;
    color: inherit;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 500;
}

/* Category items */
.vebi-search-category {
    gap: 10px;
    padding: 8px 16px;
}

.vebi-search-cat-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 6px;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.vebi-search-cat-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vebi-search-cat-count {
    font-size: 11px;
    color: #94a3b8;
    background: #e2e8f0;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.vebi-search-thematic .vebi-search-cat-icon {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
}

/* Product items */
.vebi-search-product {
    gap: 12px;
    padding: 10px 16px;
    border-left: none;
}

.vebi-search-product:hover {
    border-left: none;
}

.vebi-search-product-image {
    width: 52px;
    height: 52px;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
}

.vebi-search-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.vebi-search-product-no-image {
    font-size: 24px;
    color: #cbd5e1;
}

.vebi-search-product-info {
    flex: 1;
    min-width: 0;
}

.vebi-search-product-name {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    line-height: 1.3;
}

.vebi-search-product-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.vebi-search-product-sku {
    color: #94a3b8;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 10px;
}

.vebi-search-product-stock {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.vebi-search-product-stock.in-stock {
    background: #dcfce7;
    color: #166534;
}

.vebi-search-product-stock.on-order {
    background: #fef3c7;
    color: #92400e;
}

.vebi-search-product-price {
    font-size: 14px;
    font-weight: 700;
    color: #2558a8;
    white-space: nowrap;
    margin-left: auto;
    padding-left: 12px;
}

/* Show all link */
.vebi-search-show-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 16px;
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
    color: #2558a8;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid #e2e8f0;
    transition: all 0.15s;
    margin-top: auto;
}

.vebi-search-show-all:hover {
    background: #e0e7ff;
    color: #1e40af;
}

.vebi-search-show-all svg {
    transition: transform 0.2s;
}

.vebi-search-show-all:hover svg {
    transform: translateX(4px);
}

/* Popular searches */
.vebi-search-popular-item {
    gap: 10px;
    padding: 8px 16px;
}

.vebi-search-popular-icon {
    font-size: 16px;
}

/* Empty states for columns */
.vebi-search-empty-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
    flex: 1;
}

.vebi-search-empty-col-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Header search specific */
.header-search {
    position: relative;
}

.header-search .vebi-search-dropdown {
    left: auto;
    right: -100px;
    transform: translateY(10px);
}

.header-search .vebi-search-dropdown.active {
    transform: translateY(0);
}

/* Hero search specific */
.hero-search {
    position: relative;
}

.hero-search .vebi-search-dropdown {
    width: 800px;
}

/* Mobile styles */
@media (max-width: 800px) {
    .vebi-search-dropdown {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        max-height: 70vh;
        border-radius: 0 0 16px 16px;
        margin-top: 4px;
        transform: translateX(0) translateY(10px);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    }
    
    .vebi-search-dropdown.active {
        transform: translateX(0) translateY(0);
    }
    
    .header-search .vebi-search-dropdown,
    .hero-search .vebi-search-dropdown {
        left: 0;
        right: 0;
        transform: translateY(10px);
        width: 100%;
    }
    
    .header-search .vebi-search-dropdown.active,
    .hero-search .vebi-search-dropdown.active {
        transform: translateY(0);
    }
    
    /* Mobile - single column layout */
    .vebi-search-megamenu {
        flex-direction: column;
        min-height: auto;
        max-height: none;
    }
    
    .vebi-search-left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        max-height: 140px;
        overflow-y: auto;
    }
    
    .vebi-search-right {
        max-height: 350px;
        overflow-y: auto;
    }
    
    /* Mniejszy empty-col na mobile */
    .vebi-search-empty-col {
        padding: 16px 12px;
        min-height: auto;
        flex: 0;
    }
    
    .vebi-search-empty-col-icon {
        font-size: 24px;
        margin-bottom: 4px;
    }
    
    .vebi-search-product-image {
        width: 44px;
        height: 44px;
    }
    
    .vebi-search-product-name {
        font-size: 12px;
    }
    
    .vebi-search-product-price {
        font-size: 13px;
    }
    
    /* Popular searches na mobile */
    .vebi-search-popular {
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .vebi-search-popular-item {
        padding: 10px 16px;
    }
    
    .vebi-search-section-title {
        padding: 10px 16px 6px;
    }
}

/* Scrollbar styling */
.vebi-search-left::-webkit-scrollbar,
.vebi-search-right::-webkit-scrollbar {
    width: 5px;
}

.vebi-search-left::-webkit-scrollbar-track,
.vebi-search-right::-webkit-scrollbar-track {
    background: transparent;
}

.vebi-search-left::-webkit-scrollbar-thumb,
.vebi-search-right::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.vebi-search-left::-webkit-scrollbar-thumb:hover,
.vebi-search-right::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
