/* Search Autocomplete Styles */
.search-autocomplete-wrapper {
    position: relative;
}

/* Background overlay when search is active - starts below header */
.search-autocomplete-overlay {
    position: fixed;
    top: 120px; /* Default, will be adjusted by JS based on actual header height */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    display: none;
}

.search-autocomplete-overlay.active {
    display: block;
}

.search-autocomplete-dropdown {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    width: 100vw;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 99999;
    max-height: 80vh;
    overflow-y: auto;
    display: none;
}

.search-autocomplete-dropdown.active {
    display: block;
}

/* Desktop two-column layout container */
.search-dropdown-content {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 15px;
    padding-left: 15px;
    padding-right: 15px;
    padding-bottom: 0px;
    gap: 30px;
}

.search-left-column {
    flex: 0 0 50%;
    max-width: 50%;
    border-right: 1px solid #f0f0f0;
    padding-right: 30px;
}

.search-right-column {
    flex: 0 0 50%;
    max-width: 50%;
}

.search-suggestions {
    padding: 0;
    border-bottom: none;
}

.search-suggestions-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding: 0 0 10px 0;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 15px;
}

.search-suggestions-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.search-suggestion-item {
    display: flex;
    align-items: flex-start;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.search-suggestion-item:hover {
    background-color: #e9ecef;
    transform: translateX(2px);
}

.search-suggestion-icon {
    margin-right: 6px;
    margin-top: 2px;
    color: #666;
    font-size: 13px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.search-suggestion-icon svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

.search-suggestion-text {
    flex: 1;
    font-size: 13px;
    color: #333;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.search-suggestion-text mark {
    background: #fff3cd;
    color: #856404;
    font-weight: 500;
    padding: 1px 2px;
    border-radius: 2px;
}

.search-products {
    padding: 0;
}

.search-products-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    padding: 0 0 10px 0;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 15px;
}

.search-products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.search-product-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid #f0f0f0;
    border-radius: 5px;
    padding: 6px;
    background: white;
}

.search-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: #e0e0e0;
}

.search-product-image-container {
    position: relative;
    background: white;
    border-radius: 4px;
    padding: 4px;
    margin-bottom: 6px;
    height: 144px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    overflow: hidden;
}

/* Marketing markers from the database */
.search-product-markers {
    position: absolute;
    top: 6px;
    left: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 2;
}

.search-product-marker {
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* 24h and promotion indicators */
.search-product-24h,
.search-product-promotion {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    z-index: 2;
}

.search-product-24h {
    background-image: url('https://ckdev.centrumkrzesel.pl/images/24h-on-product.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    box-shadow: none;
}

.search-product-promotion {
    background: #e74c3c;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.search-product-promotion::after {
    content: "%";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 6px;
    font-weight: 700;
    line-height: 1;
}

.search-product-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.search-product-name {
    font-size: 12px;
    color: #333;
    margin-bottom: 0;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-weight: 500;
}

.search-product-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: auto;
}

.search-product-current-price {
    font-size: 13px;
    font-weight: 700;
    color: #2c3e50;
}

.search-product-old-price {
    font-size: 11px;
    color: #95a5a6;
    text-decoration: line-through;
    font-weight: 500;
}

.search-no-results {
    padding: 30px 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.search-loading {
    padding: 30px 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.search-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-view-all {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background: #3498db;
    color: white;
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s;
    margin-top: 8px;
}

.search-view-all:hover {
    background: #2980b9;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* Promocje banners in search - now in left column */
.search-promo-section {
    margin-top: 10px;
    margin-bottom: 10px;
}

.search-promo-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.search-promo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.search-promo-card {
    border-radius: 4px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s;
    height: 114px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    position: relative;
    overflow: hidden;
}

.search-promo-overlay {
    background: rgba(255, 255, 255, 0.95);
    width: 100%;
    padding: 4px 6px;
    margin-top: auto;
    border-radius: 0 0 4px 4px;
    transition: all 0.3s;
}

.search-promo-text {
    color: #333;
    text-align: center;
    line-height: 1.2;
    font-weight: 600;
    font-size: 11px;
    margin: 0;
}

.search-promo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    text-decoration: none;
}

.search-promo-card:hover .search-promo-overlay {
    background: rgba(255, 255, 255, 1);
}

.search-promo-card:hover .search-promo-text {
    color: #333;
}

/* Desktop specific styles */
@media (min-width: 769px) {
    .search-autocomplete-dropdown {
        position: fixed;
        width: 100vw;
        left: 0;
        right: 0;
    }

    .search-dropdown-content {
        display: flex;
        gap: 40px;
    }

    .search-left-column {
        display: block;
    }

    .search-right-column {
        display: block;
    }

    .search-promo-section {
        display: block;
    }
}

/* Tablet Styles */
@media (max-width: 768px) and (min-width: 481px) {
    .search-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

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

/* Mobile Styles */
@media (max-width: 768px) {
    .search-autocomplete-dropdown {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        width: 100vw;
        max-height: calc(100vh - 60px);
        border-radius: 0;
        border: none;
        border-top: 1px solid #e0e0e0;
    }

    .search-dropdown-content {
        display: block;
        padding: 0;
        gap: 0;
        max-width: 100%;
        width: 100%;
    }

    .search-left-column {
        flex: none;
        max-width: 100%;
        border-right: none;
        padding-right: 15px;
        padding-left: 15px;
        padding-top: 15px;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid #f0f0f0;
    }

    .search-right-column {
        flex: none;
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }

    .search-suggestions {
        padding-top: 10px;
    }

    .search-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 15px;
    }

    .search-product-card {
        padding: 10px;
    }

    .search-product-image-container {
        height: 100px;
        padding: 10px;
    }

    .search-suggestions-list {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .search-suggestion-item {
        padding: 4px 6px;
    }

    .search-suggestions-title,
    .search-products-title {
        font-size: 14px;
        padding-bottom: 8px;
        margin-bottom: 8px;
    }

    .search-promo-section {
        display: none; /* Hide promotional banners on mobile */
    }

    .search-product-name {
        font-size: 12px;
        min-height: 32px;
    }

    .search-product-current-price {
        font-size: 14px;
    }

    .search-product-old-price {
        font-size: 12px;
    }

    .search-view-all {
        width: 100%;
        text-align: center;
    }
}