/* ============================================
   CODEX Gaming Store - Wyszukiwarka produktów
   Motyw: zielono-czarny
   ============================================ */

/* --- Input w navbarze --- */
.nav-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 15px;
    flex: 0 1 380px;
    min-width: 220px;
}

.nav-search__form {
    width: 100%;
    position: relative;
}

.nav-search__input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    background: #111111;
    border: 1px solid #333333;
    border-radius: 8px;
    color: #ffffff;
    font-family: 'Inter', 'Roboto', sans-serif;
    font-size: 14px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-search__input::placeholder {
    color: #808080;
}

.nav-search__input:hover {
    border-color: #4a4a4a;
}

.nav-search__input:focus {
    border-color: #00ff00;
    background: #0a0a0a;
    box-shadow: 0 0 0 3px rgba(0, 255, 0, 0.1);
}

.nav-search__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #808080;
    pointer-events: none;
    transition: color 0.2s;
}

.nav-search__input:focus ~ .nav-search__icon {
    color: #00ff00;
}

.nav-search__clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #808080;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s;
}

.nav-search__clear:hover {
    background: #1a1a1a;
    color: #00ff00;
}

.nav-search__clear.visible {
    display: flex;
}

/* --- Dropdown z wynikami --- */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #0a0a0a;
    border: 1px solid #333333;
    border-radius: 10px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7), 0 0 24px rgba(0, 255, 0, 0.08);
    max-height: 480px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    animation: searchDrop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-results.open {
    display: block;
}

@keyframes searchDrop {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results__header {
    padding: 12px 16px;
    font-size: 11px;
    color: #808080;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    border-bottom: 1px solid #222222;
    font-family: 'Orbitron', monospace;
}

.search-results__header strong {
    color: #00ff00;
    font-weight: 700;
}

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

.search-results__empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.4;
}

/* --- Pojedynczy wynik --- */
.search-result {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #1a1a1a;
    transition: background 0.2s, transform 0.2s;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result:hover,
.search-result.active {
    background: #151515;
    transform: translateX(3px);
}

.search-result.active {
    border-left: 3px solid #00ff00;
    padding-left: 13px;
}

.search-result__image {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #1a1a1a;
    border: 1px solid #333333;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    font-size: 22px;
    color: #00ff00;
}

.search-result__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result__info {
    flex: 1;
    min-width: 0;
}

.search-result__name {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result__name mark {
    background: transparent;
    color: #00ff00;
    font-weight: 700;
}

.search-result__meta {
    font-size: 12px;
    color: #808080;
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-result__category {
    color: #a0a0a0;
}

.search-result__category::before {
    content: '•';
    margin-right: 6px;
    color: #4a4a4a;
}

.search-result__price {
    font-size: 14px;
    font-weight: 700;
    color: #00ff00;
    white-space: nowrap;
}

.search-result__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #00ff00;
    color: #0a0a0a;
    margin-left: 8px;
    vertical-align: middle;
}

.search-result__badge--premium { background: #ffaa00; }
.search-result__badge--vip { background: #ff00ff; }
.search-result__badge--new { background: #00aaff; }

/* --- Footer dropdowna --- */
.search-results__footer {
    padding: 12px 16px;
    text-align: center;
    border-top: 1px solid #222222;
    font-size: 13px;
}

.search-results__footer a {
    color: #00ff00;
    text-decoration: none;
    font-weight: 600;
    transition: text-shadow 0.2s;
}

.search-results__footer a:hover {
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.6);
}

/* --- Loading --- */
.search-results__loading {
    padding: 25px;
    text-align: center;
    color: #808080;
    font-size: 13px;
}

.search-results__spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #333333;
    border-top-color: #00ff00;
    border-radius: 50%;
    animation: searchSpin 0.8s linear infinite;
    margin-bottom: 8px;
}

@keyframes searchSpin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Responsywność
   ============================================ */

/* Mobile: input ukryty domyślnie, pokazywany po kliknięciu ikony */
@media (max-width: 992px) {
    .nav-search {
        flex: 0 1 200px;
        margin: 0 8px;
    }

    .nav-search__input {
        padding: 9px 36px 9px 36px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .nav-search {
        position: static;
        flex: 1 1 100%;
        margin: 10px 0 0;
        order: 99;
    }

    .nav-search__input {
        font-size: 16px; /* unika auto-zoom na iOS */
        padding: 12px 40px 12px 40px;
    }

    .search-results {
        left: 0;
        right: 0;
        max-height: 60vh;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .search-result {
        padding: 12px 12px;
    }

    .search-result__image {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* Dostępność */
@media (prefers-reduced-motion: reduce) {
    .search-results,
    .search-result {
        animation: none !important;
        transition: none !important;
    }
    .search-results__spinner {
        animation-duration: 1.5s;
    }
}

/* ============================================
   Pasek filtra na produkty.html
   ============================================ */
.products-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 20px;
    margin: 0 auto 25px;
    max-width: 1200px;
    background: linear-gradient(135deg, #111111 0%, #0a0a0a 100%);
    border: 1px solid #333333;
    border-left: 3px solid #00ff00;
    border-radius: 10px;
    animation: searchDrop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.products-filter-bar__info {
    color: #d0d0d0;
    font-size: 14px;
}

.products-filter-bar__info strong {
    color: #00ff00;
    font-weight: 700;
}

.products-filter-bar__clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    color: #00ff00;
    border: 1px solid #00ff00;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.products-filter-bar__clear:hover {
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 12px rgba(0, 255, 0, 0.3);
}

.products-filter-empty {
    text-align: center;
    padding: 60px 20px;
    color: #808080;
}

.products-filter-empty__icon {
    font-size: 48px;
    opacity: 0.4;
    margin-bottom: 12px;
}

.products-filter-empty__title {
    font-family: 'Orbitron', monospace;
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.products-filter-empty__text {
    font-size: 14px;
    margin: 0;
}

.products-filter-empty__text a {
    color: #00ff00;
    text-decoration: underline;
}

.products-filter-empty__text a:hover {
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.6);
}

@media (max-width: 600px) {
    .products-filter-bar {
        flex-direction: column;
        align-items: stretch;
        margin: 0 15px 20px;
        padding: 12px 15px;
    }
    .products-filter-bar__clear {
        justify-content: center;
    }
    .products-filter-empty__title {
        font-size: 16px;
    }
}
