/* Complete Search Page Styles - FIXED VERSION */

/* Base Styles */
.search-results-page {
    padding: 2rem 0;
    min-height: 70vh;
    background: var(--bg-primary);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.breadcrumb i {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Search Header */
.search-results-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.search-results-header h1 {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.search-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

#search-query {
    font-weight: 600;
    color: var(--primary);
}

/* Search Layout */
.search-layout {
    width: 100%;
}

.search-results-content {
    min-height: 50vh;
    width: 100%;
}

/* Results Controls */
.results-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.results-info {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.results-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.sort-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-container label {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
}

.sort-select {
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
}

.sort-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(40, 116, 240, 0.1);
}

.view-toggle {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.view-btn {
    padding: 0.6rem 0.9rem;
    background: var(--card-bg);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.view-btn.active,
.view-btn:hover {
    background: var(--primary);
    color: white;
}

/* Search Results Grid - FIXED */
.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.search-results-grid.list-view {
    grid-template-columns: 1fr;
}














/* Search Results Grid - COMPACT VERSION */
.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-results-grid.list-view {
    grid-template-columns: 1fr;
}

/* Product Card - COMPACT VERSION */
.product-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(40, 116, 240, 0.15);
    transform: translateY(-3px);
}

/* Product Image Container - COMPACT */
.product-image-container {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.75rem;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Product Info - COMPACT */
.product-info {
    padding: 0.85rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-title {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 2.4rem;
}

.product-title mark {
    background: #fff3cd;
    color: #856404;
    padding: 0.1rem 0.25rem;
    border-radius: 2px;
    font-weight: 700;
}

[data-theme="dark"] .product-title mark {
    background: #3d4d00;
    color: #f1c40f;
}

/* Product Rating - COMPACT */
.product-rating {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
}

.rating-stars {
    color: var(--warning);
    font-size: 0.8rem;
    letter-spacing: 1px;
}

/* Product Price - COMPACT */
.product-price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0;
}

.current-price {
    color: var(--primary);
    font-size: 1.15rem;
    font-weight: 700;
}

/* Product Category - COMPACT */
.product-category {
    display: flex;
    gap: 0.35rem;
    margin: 0;
}

.category-tag {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    text-transform: capitalize;
    display: inline-block;
}

[data-theme="dark"] .category-tag {
    background: rgba(74, 144, 226, 0.2);
    color: var(--primary);
}

/* Product Actions - COMPACT */
.product-actions {
    margin-top: auto;
    padding-top: 0.5rem;
}

.product-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 0.75rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s;
    width: 100%;
}

.product-link:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(40, 116, 240, 0.3);
    color: white;
    text-decoration: none;
}

.product-link i {
    font-size: 0.85rem;
}

/* List View Specific Styles */
.search-results-grid.list-view .product-card {
    flex-direction: row;
    align-items: stretch;
    height: auto;
}

.search-results-grid.list-view .product-image-container {
    width: 160px;
    height: 160px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--border-color);
}

.search-results-grid.list-view .product-info {
    flex: 1;
    padding: 1rem;
}

.search-results-grid.list-view .product-title {
    font-size: 0.95rem;
    -webkit-line-clamp: 2;
    min-height: auto;
}

/* Related Products Grid - COMPACT */
.related-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

/* Related Product Card Badge - Smaller */
.related-products-grid .product-card::before {
    content: "RELATED";
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    z-index: 2;
    letter-spacing: 0.5px;
}

/* Responsive Design - COMPACT */
@media (max-width: 1400px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .related-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 1200px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    }
    
    .related-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    }
}

@media (max-width: 1024px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 0.85rem;
    }
    
    .related-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 0.85rem;
    }
    
    .product-image-container {
        height: 160px;
    }
}

@media (max-width: 768px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
        gap: 0.75rem;
    }
    
    .related-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
        gap: 0.75rem;
    }
    
    .product-image-container {
        height: 150px;
    }
    
    .product-info {
        padding: 0.75rem;
    }
    
    .product-title {
        font-size: 0.8rem;
        min-height: 2.2rem;
    }
    
    .current-price {
        font-size: 1.1rem;
    }
    
    .product-link {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
    
    .results-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        padding: 1rem;
    }
    
    .results-actions {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.65rem;
    }
    
    .related-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.65rem;
    }
    
    .product-image-container {
        height: 140px;
    }
    
    .product-info {
        padding: 0.65rem;
    }
    
    .product-title {
        font-size: 0.75rem;
        min-height: 2rem;
    }
    
    .current-price {
        font-size: 1rem;
    }
    
    .category-tag {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }
    
    .product-link {
        padding: 0.55rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .search-results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .product-image-container {
        height: 130px;
    }
    
    .product-info {
        padding: 0.6rem;
    }
    
    .product-title {
        font-size: 0.7rem;
        -webkit-line-clamp: 2;
        min-height: 1.8rem;
    }
    
    .rating-stars {
        font-size: 0.7rem;
    }
    
    .current-price {
        font-size: 0.95rem;
    }
    
    .category-tag {
        font-size: 0.6rem;
        padding: 0.2rem 0.45rem;
    }
    
    .product-link {
        padding: 0.5rem;
        font-size: 0.7rem;
        gap: 0.3rem;
    }
    
    .product-link i {
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .search-results-grid,
    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    
    .product-image-container {
        height: 120px;
    }
    
    .product-info {
        padding: 0.5rem;
    }
    
    .product-title {
        font-size: 0.65rem;
        min-height: 1.6rem;
    }
}

/* Ultra-wide screens - Show more products per row */
@media (min-width: 1600px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .related-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (min-width: 1920px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    
    .related-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}



























/* List View Specific Styles */
.search-results-grid.list-view .product-card {
    flex-direction: row;
    align-items: stretch;
    height: auto;
}

.search-results-grid.list-view .product-image-container {
    width: 220px;
    height: 220px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--border-color);
}

.search-results-grid.list-view .product-info {
    flex: 1;
}




/* Search Container in Header */
.search-container {
    position: relative;
    flex: 1;
    max-width: 650px;
    margin: 0 1rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.3s;
}

.search-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(40, 116, 240, 0.1);
}

.search-input {
    flex: 1;
    padding: 0.9rem 1.2rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 1.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 116, 240, 0.3);
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.search-suggestions.active {
    display: block;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.2rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

.suggestion-item:hover {
    background: var(--primary-light);
}

.suggestion-image {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.suggestion-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.25rem;
}

/* Loading State */
.search-loading {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.loading-spinner {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.search-loading p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.no-results-icon {
    font-size: 5rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.no-results h3 {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.no-results p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.no-results-suggestions {
    text-align: left;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin: 0 auto 2.5rem;
    max-width: 450px;
}

.no-results-suggestions h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.no-results-suggestions ul {
    list-style: none;
    padding: 0;
}

.no-results-suggestions li {
    color: var(--text-muted);
    padding-left: 1.75rem;
    margin-bottom: 0.75rem;
    position: relative;
    line-height: 1.5;
}

.no-results-suggestions li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-size: 1.5rem;
    line-height: 1;
}

.no-results-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-secondary,
.btn-primary {
    padding: 0.9rem 1.75rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    text-decoration: none;
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 116, 240, 0.3);
    color: white;
    text-decoration: none;
}

/* Load More */
.load-more-container {
    text-align: center;
    margin: 3rem 0 2rem;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.load-more-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 116, 240, 0.3);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .product-image-container {
        height: 240px;
    }
    
    .results-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .results-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-results-header h1 {
        font-size: 1.5rem;
    }
    
    .current-price {
        font-size: 1.3rem;
    }
}

@media (max-width: 600px) {
    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.75rem;
    }
    
    .product-image-container {
        height: 180px;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-title {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
        min-height: 2.7rem;
    }
    
    .current-price {
        font-size: 1.2rem;
    }
    
    .product-link {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .search-results-grid {
        grid-template-columns: 1fr;
    }
    
    .product-card {
        max-width: 100%;
    }
}

/* Dark Mode Specific */
[data-theme="dark"] .product-image-container {
    background: #2d3748;
}

[data-theme="dark"] .suggestion-image {
    background: #2d3748;
}

/* Print Styles */
@media print {
    .search-btn,
    .results-controls,
    .load-more-container {
        display: none !important;
    }
    
    .product-card {
        break-inside: avoid;
    }
}










/* Related Products Section */
.related-products-section {
    margin: 4rem 0 3rem;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 2px dashed var(--border-color);
}

.related-products-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.related-products-header h2 {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.related-products-header h2 i {
    color: var(--primary);
    font-size: 1.5rem;
}

.related-products-header p {
    color: var(--text-muted);
    font-size: 1rem;
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Related Product Card - Slightly different style */
.related-products-grid .product-card {
    position: relative;
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-primary) 100%);
}

.related-products-grid .product-card::before {
    content: "RELATED";
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    z-index: 2;
    letter-spacing: 0.5px;
}

.related-products-grid .product-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(40, 116, 240, 0.2);
}

/* Dark mode adjustments */
[data-theme="dark"] .related-products-section {
    background: linear-gradient(135deg, var(--card-bg) 0%, #0F1419 100%);
    border-color: var(--border-color);
}

[data-theme="dark"] .related-products-grid .product-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, #0F1419 100%);
}

/* Responsive */
@media (max-width: 768px) {
    .related-products-section {
        padding: 1.5rem;
        margin: 3rem 0 2rem;
    }
    
    .related-products-header h2 {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .related-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .related-products-grid {
        grid-template-columns: 1fr;
    }
    
    .related-products-header h2 {
        font-size: 1.3rem;
    }
}
