/**
 * Product Search Styles
 *
 * Styles for real-time search results display
 */

/* ============================================
   SEARCH RESULTS CONTAINER
   ============================================ */

#search-results,
#home-search-results {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 0 20px 20px;
}

/* ============================================
   RESULTS GRID
   ============================================ */

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px 0;
}

@media (min-width: 640px) {
    .search-results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .search-results-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

/* ============================================
   RESULT ITEM
   ============================================ */

.search-result-item {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.search-result-item:hover,
.search-result-item.selected {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.search-result-item.selected {
    outline: 2px solid #2d1f1f;
    outline-offset: 2px;
}

/* ============================================
   RESULT IMAGE
   ============================================ */

.search-result-image {
    aspect-ratio: 3/4;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
}

.search-result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.search-result-item:hover .search-result-image img {
    transform: scale(1.05);
}

.search-result-image .no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e5e5;
}

.search-result-image .no-image::after {
    content: '';
    width: 40px;
    height: 40px;
    background: #ccc;
    border-radius: 4px;
}

/* ============================================
   RESULT INFO
   ============================================ */

.search-result-info {
    padding: 12px;
    text-align: center;
}

.search-result-vendor {
    font-family: 'Maison Neue Demi', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #2d1f1f;
    margin-bottom: 4px;
}

.search-result-title {
    font-family: 'Maison Neue Book', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 34px;
}

/* ============================================
   RESULT PRICE
   ============================================ */

.search-result-price {
    font-family: 'Maison Neue Book', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    color: #2d1f1f;
}

.search-result-price .compare-price {
    text-decoration: line-through;
    color: #999;
    margin-right: 8px;
    font-size: 12px;
}

.search-result-price.on-sale .current-price {
    color: #c41e3a;
    font-weight: 600;
}

/* ============================================
   LOADING STATE
   ============================================ */

.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.search-loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid #e5e5e5;
    border-top-color: #2d1f1f;
    border-radius: 50%;
    animation: search-spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes search-spin {
    to {
        transform: rotate(360deg);
    }
}

.search-loading span {
    font-family: 'Maison Neue Book', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.search-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #666;
}

.search-empty svg {
    color: #ccc;
    margin-bottom: 16px;
}

.search-empty p {
    font-family: 'Maison Neue Demi', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    margin: 0 0 8px;
    color: #2d1f1f;
}

.search-empty span {
    font-family: 'Maison Neue Book', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: #999;
}

/* ============================================
   ERROR STATE
   ============================================ */

.search-error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.search-error p {
    font-family: 'Maison Neue Book', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: #c41e3a;
    margin: 0;
}

/* ============================================
   DARK THEME (HOMEPAGE)
   ============================================ */

.home-search-overlay #home-search-results,
#home-search-overlay #home-search-results {
    background: transparent;
}

.home-search-overlay .search-results-grid,
#home-search-overlay .search-results-grid {
    padding: 20px 0;
}

.home-search-overlay .search-result-item,
#home-search-overlay .search-result-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.home-search-overlay .search-result-item:hover,
.home-search-overlay .search-result-item.selected,
#home-search-overlay .search-result-item:hover,
#home-search-overlay .search-result-item.selected {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.home-search-overlay .search-result-item.selected,
#home-search-overlay .search-result-item.selected {
    outline-color: #000000;
}

.home-search-overlay .search-result-vendor,
.home-search-overlay .search-result-price,
#home-search-overlay .search-result-vendor,
#home-search-overlay .search-result-price {
    color: #000000;
}

.home-search-overlay .search-result-title,
#home-search-overlay .search-result-title {
    color: rgba(0, 0, 0, 0.8);
}

.home-search-overlay .search-result-price .compare-price,
#home-search-overlay .search-result-price .compare-price {
    color: rgba(255, 255, 255, 0.5);
}

.home-search-overlay .search-result-price.on-sale .current-price,
#home-search-overlay .search-result-price.on-sale .current-price {
    color: #ff6b6b;
}

/* Loading/Empty/Error dark theme */
.home-search-overlay .search-loading,
.home-search-overlay .search-empty,
#home-search-overlay .search-loading,
#home-search-overlay .search-empty {
    color: rgba(0, 0, 0, 0.8);
}

.home-search-overlay .search-empty svg,
#home-search-overlay .search-empty svg {
    color: rgba(255, 255, 255, 0.4);
}

.home-search-overlay .search-empty p,
#home-search-overlay .search-empty p {
    color: #000000;
}

.home-search-overlay .search-empty span,
#home-search-overlay .search-empty span {
    color: rgba(255, 255, 255, 0.6);
}

.home-search-overlay .search-loading-spinner,
#home-search-overlay .search-loading-spinner {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: #000000;
}

.home-search-overlay .search-error p,
#home-search-overlay .search-error p {
    color: #ff6b6b;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

#search-results::-webkit-scrollbar,
#home-search-results::-webkit-scrollbar {
    width: 6px;
}

#search-results::-webkit-scrollbar-track,
#home-search-results::-webkit-scrollbar-track {
    background: transparent;
}

#search-results::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#home-search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

#search-results::-webkit-scrollbar-thumb:hover {
    background: #999;
}

#home-search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
    #search-results,
    #home-search-results {
        padding: 0 12px 12px;
    }

    .search-results-grid {
        gap: 12px;
    }

    .search-result-info {
        padding: 8px;
    }

    .search-result-vendor {
        font-size: 10px;
    }

    .search-result-title {
        font-size: 11px;
        min-height: 30px;
    }

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

    .search-loading,
    .search-empty {
        padding: 40px 16px;
    }
}
