/**
 * Optimalizált Live Search - CSS
 * Lightbox popup stílus
 */

/* ========== VÁLTOZÓK ========== */
:root {
    --search-bg: #0a0a0a;
    --search-overlay: rgba(0, 0, 0, 0.85);
    --search-border: rgba(255, 255, 255, 0.1);
    --search-accent: #e40000;
    --search-accent-hover: #ff1a1a;
    --search-text: #ffffff;
    --search-text-muted: rgba(255, 255, 255, 0.6);
    --search-input-bg: rgba(255, 255, 255, 0.08);
}

/* ========== KERESŐ TRIGGER (IKON) ========== */
.search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    border-bottom: 2px solid var(--search-accent);
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--search-text);
}

.search-trigger svg {
    width: 20px;
    height: 20px;
    stroke: var(--search-text);
    transition: stroke 0.3s ease;
}

.search-trigger-text {
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--search-text);
    transition: color 0.3s ease;
}

.search-trigger:hover {
    border-color: var(--search-accent-hover);
}

.search-trigger:hover svg {
    stroke: var(--search-accent);
}

.search-trigger:hover .search-trigger-text {
    color: var(--search-accent);
}

/* ========== OVERLAY ========== */
.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--search-overlay);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========== MODAL ========== */
.search-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 100%;
    max-width: 800px;
    max-height: 80vh;
    background: var(--search-bg);
    border-radius: 12px;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* ========== MODAL TARTALOM ========== */
.search-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 80vh;
    overflow: hidden;
}

/* ========== FEJLÉC ========== */
.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--search-border);
    flex-shrink: 0;
}

.search-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--search-text);
}

.search-modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal-close svg {
    width: 24px;
    height: 24px;
    stroke: var(--search-text-muted);
    transition: stroke 0.2s ease;
}

.search-modal-close:hover {
    background: var(--search-input-bg);
}

.search-modal-close:hover svg {
    stroke: var(--search-text);
}

/* ========== KERESŐ INPUT ========== */
.search-input-wrapper {
    position: relative;
    padding: 16px 24px;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    padding: 14px 50px 14px 18px;
    background: #ffffff;
    border: 2px solid var(--search-border);
    border-radius: 10px;
    color: #000000;
    font-size: 16px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--search-accent);
    background: #ffffff;
}

.search-input::placeholder {
    color: #000000;
    opacity: 0.7;
}

/* Loading spinner */
.search-spinner {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--search-border);
    border-top-color: var(--search-accent);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.search-spinner.active {
    opacity: 1;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* ========== TALÁLATOK INFO ========== */
.search-results-info {
    padding: 0 24px 12px;
    font-size: 13px;
    color: var(--search-text-muted);
    flex-shrink: 0;
}

.search-results-info:empty {
    display: none;
}

/* ========== TALÁLATOK LISTA ========== */
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: var(--search-border);
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Placeholder */
.search-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--search-text-muted);
}

.search-placeholder p {
    margin: 0;
    font-size: 15px;
}

/* Nincs találat */
.search-no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--search-text-muted);
}

.search-no-results p {
    margin: 0;
    font-size: 15px;
}

.search-no-results strong {
    color: var(--search-text);
}

/* ========== TERMÉK GRID ========== */
.search-results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* ========== TERMÉK ITEM ========== */
.search-product-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--search-input-bg);
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
    margin-bottom: 12px;
}

.search-product-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

/* Termék kép */
.search-product-image {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

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

/* Termék info */
.search-product-info {
    flex: 1;
    min-width: 0;
}

.search-product-name {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--search-text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-product-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--search-accent);
}

.search-product-price del {
    color: var(--search-text-muted);
    font-weight: 400;
    margin-right: 6px;
}

.search-product-price ins {
    text-decoration: none;
}

/* Termék akció gomb */
.search-product-action {
    flex-shrink: 0;
}

.search-product-btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--search-accent);
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.search-product-item:hover .search-product-btn {
    background: var(--search-accent-hover);
}

/* ========== MOBIL RESZPONZÍV ========== */
@media (max-width: 768px) {
    /* Modal teljes képernyő mobilon */
    .search-modal {
        max-width: 98%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: translateY(100%);
    }

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

    .search-modal-content {
        max-height: 100vh;
    }

    /* Trigger szöveg elrejtése */
    .search-trigger-text {
        display: none;
    }

    .search-trigger {
        border-bottom: none;
        padding: 8px;
    }

    .search-trigger svg {
        width: 24px;
        height: 24px;
    }

    /* Fejléc */
    .search-modal-header {
        padding: 16px 20px;
    }

    .search-modal-header h2 {
        font-size: 18px;
    }

    /* Input */
    .search-input-wrapper {
        padding: 12px 20px;
    }

    .search-input {
        font-size: 14px;
        padding: 12px 45px 12px 14px;
    }

    .search-spinner {
        right: 36px;
    }

    /* Találatok */
    .search-results {
        padding: 0 20px 20px;
    }

    .search-results-info {
        padding: 0 20px 12px;
    }

    /* Termék item - egy oszlop mobilon */
    .search-product-item {
        gap: 12px;
        padding: 10px;
    }

    .search-product-image {
        width: 60px;
        height: 60px;
    }

    .search-product-name {
        font-size: 13px;
    }

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

    .search-product-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* ========== ANIMÁCIÓK ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-product-item {
    animation: fadeInUp 0.3s ease forwards;
}

.search-product-item:nth-child(1) { animation-delay: 0s; }
.search-product-item:nth-child(2) { animation-delay: 0.05s; }
.search-product-item:nth-child(3) { animation-delay: 0.1s; }
.search-product-item:nth-child(4) { animation-delay: 0.15s; }
.search-product-item:nth-child(5) { animation-delay: 0.2s; }
.search-product-item:nth-child(6) { animation-delay: 0.25s; }

/* ========== BODY LOCK ========== */
body.search-open {
    overflow: hidden;
}
