﻿/* ========================================
   SEARCH MODAL - Full-screen overlay search
   ======================================== */

.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-modal.open {
    opacity: 1;
    visibility: visible;
}

.search-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.search-modal__content {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 80px 20px 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========================================
   Close Button
   ======================================== */

.search-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: #f8f9fa;
    color: #6c757d;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.search-modal__close:hover {
    background: #e9ecef;
    color: #212529;
    transform: scale(1.1);
}

/* ========================================
   Search Input
   ======================================== */

.search-modal__input-wrapper {
    position: relative;
    padding: 30px 30px 20px;
    border-bottom: 2px solid #e9ecef;
}

.search-modal__icon {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: #6c757d;
    pointer-events: none;
}

.search-modal__input {
    width: 100%;
    padding: 16px 60px 16px 60px;
    font-size: 1.5rem;
    font-weight: 400;
    border: none;
    background: transparent;
    outline: none;
    color: #212529;
}

.search-modal__input::placeholder {
    color: #adb5bd;
}

.search-modal__clear {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal__clear:hover {
    color: #dc3545;
    transform: translateY(-50%) scale(1.1);
}

/* ========================================
   Results Container
   ======================================== */

.search-modal__results {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    max-height: calc(100vh - 280px);
}

.search-modal__results::-webkit-scrollbar {
    width: 8px;
}

.search-modal__results::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.search-modal__results::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 4px;
}

.search-modal__results::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* ========================================
   Loading State
   ======================================== */

.search-modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6c757d;
}

/* ========================================
   Results Grid
   ======================================== */

.search-modal__results-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 40px;
}

.search-modal__section-title {
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #495057;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.search-modal__section-title .badge {
    font-size: 0.75rem;
}

/* ========================================
   Product Cards
   ======================================== */

.search-modal__products {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-product-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.search-product-card:hover,
.search-product-card.selected {
    border-color: #0d6efd;
    background: #f8f9ff;
    transform: translateX(4px);
    cursor: pointer;
}

.search-product-card__image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f9fa;
}

.search-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-product-card__content {
    flex: 1;
    min-width: 0;
}

.search-product-card__title {
    font-size: 0.95rem;
    font-weight: 500;
    margin: 0 0 4px 0;
    color: #212529;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-product-card__category {
    font-size: 0.8rem;
    color: #6c757d;
    margin: 0 0 4px 0;
}

.search-product-card__price {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0d6efd;
    margin: 0;
}

.search-product-card__arrow {
    font-size: 1.2rem;
    color: #adb5bd;
    transition: all 0.2s ease;
}

.search-product-card:hover .search-product-card__arrow {
    color: #0d6efd;
    transform: translateX(4px);
}

.search-modal__view-all {
    width: 100%;
    padding: 14px 20px;
    margin-top: 16px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background: transparent;
    color: #0d6efd;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal__view-all:hover {
    border-color: #0d6efd;
    background: #f8f9ff;
}

/* ========================================
   Sidebar (Categories & Brands)
   ======================================== */

.search-modal__section--sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.search-modal__subsection-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.search-modal__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Updated: Changed from 'a' to generic list item styling */
.search-modal__list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 6px;
    color: #495057;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.search-modal__list-item:hover {
    background: #f8f9fa;
    color: #0d6efd;
}

.search-modal__count {
    font-size: 0.8rem;
    color: #adb5bd;
    font-weight: 500;
}

.search-modal__brand-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    margin-right: 8px;
}

/* ========================================
   Empty States
   ======================================== */

.search-modal__empty-state {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.search-modal__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.search-modal__empty h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.search-modal__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.search-modal__tag {
    padding: 10px 16px;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    background: transparent;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-modal__tag:hover {
    border-color: #0d6efd;
    background: #f8f9ff;
    color: #0d6efd;
    transform: translateY(-2px);
}

.search-modal__tag--popular {
    border-color: #ffc107;
    color: #ff6b6b;
}

.search-modal__tag--popular:hover {
    background: #fff9e6;
    border-color: #ff6b6b;
}

/* ========================================
   Keyboard Hints
   ======================================== */

.search-modal__hints {
    padding: 16px 30px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 20px;
    font-size: 0.8rem;
    color: #6c757d;
}

.search-modal__hints kbd {
    padding: 4px 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    margin: 0 4px;
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .search-modal__content {
        margin: 20px 10px;
        max-height: calc(100vh - 60px);
        border-radius: 12px;
    }

    .search-modal__input-wrapper {
        padding: 20px 20px 16px;
    }

    .search-modal__input {
        font-size: 1.2rem;
        padding: 14px 50px 14px 50px;
    }

    .search-modal__icon {
        left: 30px;
        font-size: 1.2rem;
    }

    .search-modal__clear {
        right: 30px;
    }

    .search-modal__close {
        top: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .search-modal__results {
        padding: 20px;
    }

    .search-modal__results-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .search-product-card {
        padding: 12px;
    }

    .search-product-card__image {
        width: 60px;
        height: 60px;
    }

    .search-product-card__title {
        font-size: 0.9rem;
    }

    .search-modal__hints {
        display: none;
    }
}

@media (max-width: 480px) {
    .search-modal__input {
        font-size: 1rem;
    }

    .search-modal__section-title {
        font-size: 0.9rem;
    }

    .search-product-card__image {
        width: 50px;
        height: 50px;
    }
}
