/**
 * search.css - Style dla strony wyszukiwania i autocomplete (KOMPAKTOWA WERSJA)
 */

/* =============================================================================
   SEARCH HEADER - kompaktowy
   ============================================================================= */

.search-header {
    background: linear-gradient(135deg, var(--dark-color, #1a1a1a) 0%, #1a1a2e 100%);
    padding: 25px 0 30px;
    margin-bottom: 20px;
}

.search-title {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
}

.search-query {
    color: var(--primary-color);
}

.search-summary {
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    margin-top: 12px;
    font-size: 0.85rem;
}

.search-summary strong {
    color: #fff;
}

.search-no-results {
    color: rgba(255, 255, 255, 0.6);
}

/* =============================================================================
   SEARCH FORM - kompaktowy
   ============================================================================= */

.search-form-large {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 30px;
    padding: 4px 4px 4px 16px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.12);
}

.search-icon {
    width: 18px;
    height: 18px;
    stroke: var(--text-light);
    flex-shrink: 0;
}

.search-input-large {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 12px;
    font-size: 0.95rem;
    background: transparent;
}

.search-input-large::placeholder {
    color: var(--text-light);
}

.search-btn-large {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.search-btn-large:hover {
    background: #0bc5b8;
}

/* =============================================================================
   SEARCH AUTOCOMPLETE - SUPER KOMPAKTOWY
   ============================================================================= */

.search-autocomplete {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 320px;
    overflow-y: auto;
    display: none;
}

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

/* Lista wyników - kompaktowa */
.ac-list {
    padding: 6px 0;
}

.ac-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
    cursor: pointer;
}

.ac-item:hover,
.ac-item.selected {
    background: #f3f4f6;
}

/* Miniaturka produktu */
.ac-img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    background: #f0f0f0;
    flex-shrink: 0;
}

/* Tag typu (Skł, Marka, Cel) */
.ac-tag {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

.ac-tag--cat {
    background: #d1fae5;
    color: #059669;
}

.ac-tag--brand {
    background: #e0e7ff;
    color: #4f46e5;
}

.ac-tag--attr {
    background: #fef3c7;
    color: #d97706;
}

.ac-tag--prod {
    background: #f3f4f6;
    color: #6b7280;
}

/* Nazwa */
.ac-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Licznik produktów */
.ac-count {
    font-size: 0.7rem;
    color: #9ca3af;
    flex-shrink: 0;
}

/* Cena produktu */
.ac-price {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
    flex-shrink: 0;
}

/* Link "Wszystkie wyniki" */
.ac-more {
    display: block;
    padding: 8px 10px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    border-top: 1px solid #f0f0f0;
}

.ac-more:hover {
    background: #f9fafb;
}

/* Loading i brak wyników */
.ac-loading,
.ac-empty {
    padding: 12px;
    text-align: center;
    color: #9ca3af;
    font-size: 0.85rem;
}

/* =============================================================================
   SEARCH LAYOUT - kompaktowy
   ============================================================================= */

.search-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    padding-bottom: 40px;
}

@media (max-width: 968px) {
    .search-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* Sidebar - kompaktowy */
.search-sidebar {
    position: sticky;
    top: 15px;
    height: fit-content;
}

@media (max-width: 968px) {
    .search-sidebar {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .search-sidebar .filter-section {
        flex: 1;
        min-width: 140px;
    }
}

.filter-section {
    background: #fff;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.filter-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px;
}

.filter-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.filter-link:hover {
    background: #f3f4f6;
}

.filter-link.active {
    background: var(--primary-color);
    color: #fff;
}

.filter-link.active .filter-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.filter-count {
    font-size: 0.7rem;
    background: #e5e7eb;
    padding: 1px 5px;
    border-radius: 8px;
    color: var(--text-light);
}

.sort-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    background: #fff;
}

/* =============================================================================
   RESULTS SECTIONS - kompaktowy
   ============================================================================= */

.results-section {
    margin-bottom: 20px;
}

.results-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 10px;
}

.results-section-title svg {
    width: 18px;
    height: 18px;
    stroke: var(--primary-color);
}

.results-count {
    font-weight: 400;
    color: var(--text-light);
    font-size: 0.8rem;
}

/* =============================================================================
   RESULT TAGS - kompaktowy (inline)
   ============================================================================= */

.results-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.result-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.result-tag:hover {
    border-color: var(--primary-color);
    background: #f0fdfa;
}

.tag-type {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 5px;
    border-radius: 3px;
    background: #f3f4f6;
}

.result-tag--category .tag-type {
    color: #10b981;
    background: #d1fae5;
}

.result-tag--brand .tag-type {
    color: #6366f1;
    background: #e0e7ff;
}

.result-tag--attribute .tag-type {
    color: #f59e0b;
    background: #fef3c7;
}

.tag-name {
    font-weight: 600;
    color: var(--text-color);
}

.tag-count {
    font-size: 0.7rem;
    color: var(--text-light);
}

/* =============================================================================
   PRODUCTS GRID - kompaktowy
   ============================================================================= */

.search-results .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

@media (max-width: 640px) {
    .search-results .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Kompaktowe karty produktów dla wyników wyszukiwania */
.search-results .product-card {
    padding: 12px;
}

.search-results .product-image-wrapper {
    min-height: 120px;
    padding: 12px;
    margin-bottom: 10px;
}

.search-results .product-name {
    font-size: 0.85rem;
    min-height: 36px;
    margin-bottom: 6px;
    -webkit-line-clamp: 2;
}

.search-results .product-meta {
    font-size: 0.7rem;
    margin-bottom: 6px;
    gap: 8px;
}

.search-results .product-rating {
    margin-bottom: 6px;
}

.search-results .product-rating .stars svg {
    width: 12px;
    height: 12px;
}

.search-results .rating-count {
    font-size: 0.7rem;
}

.search-results .product-price {
    margin-bottom: 8px;
}

.search-results .price-main {
    font-size: 1.1rem;
}

.search-results .price-range {
    font-size: 0.7rem;
}

.search-results .product-shops {
    font-size: 0.75rem;
    margin-bottom: 10px;
}

.search-results .product-shops svg {
    width: 12px;
    height: 12px;
}

.search-results .btn-view {
    padding: 8px 12px;
    font-size: 0.8rem;
}

/* =============================================================================
   NO RESULTS - kompaktowy
   ============================================================================= */

.no-results {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 12px;
}

.no-results svg {
    width: 60px;
    height: 60px;
    stroke: #d1d5db;
    margin-bottom: 15px;
}

.no-results h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-color);
}

.no-results p {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.suggestions h4 {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.suggestion-tag {
    display: inline-block;
    padding: 6px 14px;
    background: #f3f4f6;
    border-radius: 15px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.suggestion-tag:hover {
    background: var(--primary-color);
    color: #fff;
}

.suggestion-tags.large .suggestion-tag {
    padding: 8px 18px;
    font-size: 0.9rem;
}

/* =============================================================================
   POPULAR SEARCHES - kompaktowy
   ============================================================================= */

.popular-searches {
    padding: 40px 0;
    text-align: center;
}

.popular-searches h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: var(--text-color);
}

/* =============================================================================
   PAGINATION - kompaktowy
   ============================================================================= */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 25px;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
}

.page-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.page-btn svg {
    width: 16px;
    height: 16px;
}

/* =============================================================================
   HEADER SEARCH (global) - bez zmian, już kompaktowy
   ============================================================================= */

.header-search {
    position: relative;
    flex: 1;
    max-width: 350px;
    margin: 0 20px;
}

.header-search-form {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 20px;
    padding: 0 4px 0 14px;
    transition: all 0.2s;
}

.header-search-form:focus-within {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 8px;
    font-size: 0.85rem;
}

.header-search-input::placeholder {
    color: #9ca3af;
}

.header-search-btn {
    background: var(--primary-color);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.header-search-btn:hover {
    background: #0bc5b8;
}

.header-search-btn svg {
    width: 14px;
    height: 14px;
    stroke: #fff;
}

.header-search .search-autocomplete {
    max-width: none;
    border-radius: 10px;
}

@media (max-width: 768px) {
    .header-search {
        display: none;
    }
}

/* Mobile search */
.mobile-search-btn {
    display: none;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
}

.mobile-search-btn svg {
    width: 22px;
    height: 22px;
    stroke: var(--text-color);
}

@media (max-width: 768px) {
    .mobile-search-btn {
        display: flex;
    }
}

.mobile-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

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

.mobile-search-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 12px;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.mobile-search-container.active {
    transform: translateY(0);
}

.mobile-search-container .search-input-wrapper {
    box-shadow: none;
    border: 1px solid #e5e7eb;
}

/* =============================================================================
   AUTOCOMPLETE MOBILE FIXES
   ============================================================================= */

@media (max-width: 640px) {
    .search-autocomplete {
        max-height: 70vh;
        border-radius: 12px;
    }

    .ac-list {
        padding: 4px 0;
    }

    .ac-item {
        padding: 10px 12px;
        gap: 10px;
    }

    .ac-img {
        width: 40px;
        height: 40px;
        border-radius: 6px;
    }

    .ac-tag {
        font-size: 9px;
        padding: 3px 6px;
        border-radius: 4px;
    }

    .ac-name {
        font-size: 14px;
    }

    .ac-count {
        font-size: 11px;
    }

    .ac-price {
        font-size: 13px;
    }

    .ac-more {
        padding: 12px;
        font-size: 14px;
    }

    .ac-loading,
    .ac-empty {
        padding: 16px;
        font-size: 14px;
    }
}
