/**
 * Search Results Page Styles
 */

/* Results Layout - Two Column Grid (RTL-optimized) */
.search-results-page .category-layout {
    display: none;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    margin-top: 24px;
    direction: rtl;
}

/* Class-based activation prevents filter sidebar leak */
.search-results-page .category-layout.active {
    display: grid !important;
}

.search-results-page .products-container {
    min-width: 0;
    direction: rtl;
}

.search-results-page .filters-sidebar {
    direction: rtl;
}

/* Ensure grid layout on desktop */
@media (min-width: 769px) {
    .search-results-page .category-layout.active {
        display: grid !important;
        grid-template-columns: 280px 1fr !important;
    }

    .search-results-page .category-layout.active .filters-sidebar {
        display: block !important;
    }
}

/* Welcome State */
.welcome-state {
    text-align: center;
    padding: 40px 20px;
    max-width: 800px;
    margin: 0 auto;
}

.welcome-icon {
    margin-bottom: 16px;
    opacity: 0.6;
}

.welcome-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.welcome-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 32px;
}

.welcome-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #555;
    margin-bottom: 12px;
    text-align: right;
}

/* Search Tags (pills) */
.search-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.search-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

.search-tag:hover {
    background: #1a73e8;
    border-color: #1a73e8;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(26,115,232,0.3);
}

.search-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.search-tag:hover .search-tag-remove {
    opacity: 1;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #666;
}

.search-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #1a73e8;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* No Results State */
.no-results-state {
    text-align: center;
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.no-results-icon {
    margin-bottom: 16px;
    opacity: 0.6;
}

.no-results-message {
    font-size: 18px;
    color: #333;
    margin-bottom: 24px;
}

.no-results-message span:first-child {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Did You Mean Suggestion */
.did-you-mean-suggestion {
    display: inline-block;
    font-size: 20px;
    padding: 12px 24px;
    background: #f5f5f5;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.did-you-mean-suggestion:hover {
    background: #e8e8e8;
}

/* Popular Searches Grid */
.no-results-suggestions {
    text-align: right;
}

.popular-searches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.popular-search-item {
    display: block;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: center;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popular-search-item:hover {
    background: #1a73e8;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Search Results Header */
.search-results-header {
    margin-bottom: 32px;
}

.search-results-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.search-results-count {
    font-size: 16px;
    color: #666;
}

/* Products Grid */
.search-results-page .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 0;
    direction: rtl;
    align-items: start;
}

@media (max-width: 640px) {
    .search-results-page .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Mobile Responsiveness */
@media (max-width: 968px) {
    .search-results-page .category-layout.active {
        grid-template-columns: 1fr !important;
    }

    .search-results-page .filters-sidebar {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .search-results-title {
        font-size: 22px;
    }

    .welcome-title {
        font-size: 20px;
    }

    .popular-searches-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 8px;
    }

    .popular-search-item {
        padding: 10px 12px;
        font-size: 14px;
    }

    .did-you-mean-suggestion {
        font-size: 16px;
        padding: 10px 20px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
}
