/* ============================================ */
/* 1. RESET AND BASE STYLES */
/* ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    color: #202124;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-theme {
    background-color: #202124;
    color: #e8eaed;
}

/* Fix for mobile keyboard pushing content */
@supports (-webkit-touch-callout: none) {
    body {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    
    .main-content {
        height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================ */
/* 2. TOP BAR COMPONENT */
/* ============================================ */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background-color: #ffffff;
    height: 60px;
    box-sizing: border-box;
}

.dark-theme .top-bar {
    background-color: #202124;
}

/* Left side container - About and Contact */
.top-bar-left {
    display: flex;
    gap: 15px;
}

/* Right side container - Theme switcher and user profile */
.top-bar-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.top-bar a {
    color: rgba(0, 0, 0, 0.87);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.dark-theme .top-bar a {
    color: #e8eaed;
}

.top-bar a:hover {
    background-color: rgba(60, 64, 67, 0.08);
    text-decoration: none;
}

.dark-theme .top-bar a:hover {
    background-color: rgba(232, 234, 237, 0.08);
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid #dadce0;
    border-radius: 20px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #5f6368;
}

.dark-theme .theme-switcher {
    border-color: #5f6368;
    color: #9aa0a6;
}

.theme-switcher:hover {
    background-color: rgba(60, 64, 67, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark-theme .theme-switcher:hover {
    background-color: rgba(232, 234, 237, 0.08);
}

.theme-switcher span {
    font-size: 18px;
}

/* User Profile */
.user-profile {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.user-profile:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ============================================ */
/* 3. MAIN CONTENT AREA */
/* ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    min-height: calc(100vh - 200px);
    margin-top: 60px; /* Account for fixed top bar */
}

/* When in results state, adjust main content to show search properly */
body.has-results .main-content {
    justify-content: flex-start;
    padding-top: 0; /* Handled by search-results padding-top */
    margin-top: 0; /* Main content starts directly at top */
}

/* Desktop search bar behavior */
@media (min-width: 769px) {
    .search-container.state-typing {
        transform: none !important;
        position: relative !important;
    }
    
    .search-container.state-hasInput,
    .search-container.state-results {
        position: relative;
        margin: 0 auto;
        max-width: 584px;
        transform: none !important;
    }
}

/* ============================================ */
/* 4. LOGO COMPONENT */
/* ============================================ */
.logo {
    font-size: 90px;
    font-weight: 400;
    margin-bottom: 30px;
    color: #000000;
    letter-spacing: -2px;
    transition: opacity 0.3s, transform 0.3s;
}

.dark-theme .logo {
    color: #ffffff;
}

.logo.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

/* ============================================ */
/* 5. SEARCH CONTAINER COMPONENT */
/* ============================================ */
.search-container {
    width: 100%;
    max-width: 584px;
    margin: 0 auto;
    position: relative;
    transition: all 0.3s ease;
}

.search-bar-container {
    position: relative;
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
}

/* Search container states */
.search-container.state-initial {
    max-width: 584px;
    margin: 0 auto;
}

.search-container.state-typing {
    position: fixed;
    top: 60px; /* Position below top bar */
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    height: 44px;
    z-index: 1000;
    background-color: #ffffff;
    box-shadow: 0 2px 5px 1px rgba(64, 60, 67, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #dfe1e5;
}

.dark-theme .search-container.state-typing {
    background-color: #202124;
    box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.3);
    border-bottom-color: #5f6368;
}

.search-container.state-results {
    position: fixed;
    top: 60px; /* Position below top bar */
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    height: 44px;
    z-index: 1000;
    background-color: #ffffff;
    box-shadow: 0 2px 5px 1px rgba(64, 60, 67, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-theme .search-container.state-results {
    background-color: #202124;
    box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.3);
}

/* ============================================ */
/* 6. SEARCH BAR COMPONENT */
/* ============================================ */
.search-bar {
    width: 100%;
    height: 44px;
    padding: 0 16px 0 44px;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    transition: all 0.2s;
    background-color: #ffffff;
    color: #202124;
}

.dark-theme .search-bar {
    background-color: #303134;
    border-color: #5f6368;
    color: #e8eaed;
}

.search-bar:hover {
    box-shadow: 0 2px 5px 1px rgba(64, 60, 67, 0.16);
}

.dark-theme .search-bar:hover {
    box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.3);
}

.search-bar:focus {
    box-shadow: 0 2px 5px 1px rgba(64, 60, 67, 0.16);
    border-color: transparent;
}

.dark-theme .search-bar:focus {
    box-shadow: 0 2px 5px 1px rgba(0, 0, 0, 0.3);
}

/* Search bar in typing and results state */
.search-container.state-typing .search-bar,
.search-container.state-results .search-bar {
    border-radius: 24px;
    border: none;
    padding-left: 56px; /* Space for back arrow */
    padding-right: 56px; /* Space for search icon */
    box-shadow: none;
    background-color: transparent;
    height: 44px;
    flex: 1;
    max-width: 632px;
}

.dark-theme .search-container.state-typing .search-bar,
.dark-theme .search-container.state-results .search-bar {
    background-color: transparent;
}

.search-container.state-typing .search-bar:hover,
.search-container.state-typing .search-bar:focus,
.search-container.state-results .search-bar:hover,
.search-container.state-results .search-bar:focus {
    box-shadow: none;
    border: none;
}

/* ============================================ */
/* 7. BACK ARROW COMPONENT */
/* ============================================ */
.back-arrow {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 3;
    color: #5f6368;
    transition: color 0.2s;
}

.dark-theme .back-arrow {
    color: #9aa0a6;
}

.back-arrow:hover {
    color: #202124;
    background-color: rgba(60, 64, 67, 0.08);
    border-radius: 50%;
}

.dark-theme .back-arrow:hover {
    color: #e8eaed;
    background-color: rgba(232, 234, 237, 0.08);
}

.search-container.state-typing .back-arrow,
.search-container.state-results .back-arrow {
    display: flex;
}

/* ============================================ */
/* 8. SEARCH ICON COMPONENT */
/* ============================================ */
.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
}

/* Search icon in typing and results state */
.search-container.state-typing .search-icon,
.search-container.state-results .search-icon {
    left: auto;
    right: 16px;
    opacity: 0.6;
    pointer-events: auto;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    z-index: 2;
}

.search-container.state-typing .search-icon:hover,
.search-container.state-results .search-icon:hover {
    opacity: 1;
    background-color: rgba(60, 64, 67, 0.08);
}

.dark-theme .search-container.state-typing .search-icon:hover,
.dark-theme .search-container.state-results .search-icon:hover {
    background-color: rgba(232, 234, 237, 0.08);
}

/* ============================================ */
/* 9. SMALL LOGO ICON COMPONENT */
/* ============================================ */
.small-logo-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #1a73e8;
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

/* Only show small logo in typing state, not in results */
.search-container.state-typing .small-logo-icon {
    display: flex;
}

.search-container.state-results .small-logo-icon {
    display: none;
}

/* ============================================ */
/* 10. SUGGESTIONS DROPDOWN COMPONENT */
/* ============================================ */
.suggestions-dropdown {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: none;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28);
    max-height: calc(100vh - 45px);
    overflow-y: auto;
    z-index: 1001;
    display: none;
    margin: 0;
    padding: 0;
}

/* Ensure dropdown is visible when shown */
.suggestions-dropdown.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.dark-theme .suggestions-dropdown {
    background-color: #202124;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
}

/* Full width suggestions when typing */
.search-container.state-typing .suggestions-dropdown {
    position: fixed !important;
    top: 104px !important; /* 60px (top bar) + 44px (search bar) */
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100vh - 104px) !important;
    z-index: 1001 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background-color: #ffffff !important;
    border-radius: 0 !important;
}

.dark-theme .search-container.state-typing .suggestions-dropdown {
    background-color: #202124 !important;
}

/* ============================================ */
/* 11. SUGGESTION ITEMS COMPONENT */
/* ============================================ */
.suggestion-item, .refinement-card, .disambiguation-card, .no-results-card {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: #3c4043;
    font-size: 14px;
    transition: background-color 0.1s;
    width: 100%;
    box-sizing: border-box;
}

/* Product suggestion layout */
.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    width: 100%;
}

.suggestion-img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0;
}

.suggestion-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.suggestion-title {
    font-size: 14px;
    color: #202124;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.dark-theme .suggestion-title {
    color: #e8eaed;
}

.suggestion-size {
    font-size: 12px;
    color: #5f6368;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark-theme .suggestion-size {
    color: #9aa0a6;
}

.suggestion-price {
    font-size: 14px;
    color: #202124;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: right;
}

.dark-theme .suggestion-price {
    color: #e8eaed;
}

/* Other suggestion types */
.refinement-card, .disambiguation-card {
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 50px;
}

.suggestion-item:hover, .refinement-card:hover, .disambiguation-card:hover {
    background-color: #f8f9fa;
}

.dark-theme .suggestion-item:hover, 
.dark-theme .refinement-card:hover, 
.dark-theme .disambiguation-card:hover {
    background-color: #303134;
}

.no-results-card {
    color: #70757a;
    cursor: default;
    min-height: 50px;
    display: flex;
    align-items: center;
}

.dark-theme .no-results-card {
    color: #9aa0a6;
}

.refinement-card-icon, .disambiguation-card-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.disambiguation-card-text .query {
    color: #1a0dab;
    font-weight: 500;
}

.dark-theme .disambiguation-card-text .query {
    color: #8ab4f8;
}

/* ============================================ */
/* 12. SEARCH RESULTS COMPONENT */
/* ============================================ */
.search-results {
    display: none;
   
    margin: 0 auto;
    width: 100%;
    /* Product boxes positioned 2px below search bar (60px + 44px + 2px = 106px) */
    padding-top: 2px;
}

.search-results.show {
    display: block;
}

/* Search Results positioning */
body.has-results .search-results {
    margin-top: 0; /* Remove previous margin control here */
}

#resultsContent {
    /* New rule for results content to create the gap */
    padding-top: 2px; /* Exactly 2px gap from the search bar */
    width: 100%;
   
    
    margin-right: auto;
}

/* Filters Section */
.filters-section {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    padding: 16px 0;
    margin-bottom: 24px;
    width: 100%;
}

.dark-theme .filters-section {
    background: #303134;
    border-bottom-color: #5f6368;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
}

.filters-header h3 {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
}

.dark-theme .filters-header h3 {
    color: #e8eaed;
}

.clear-filters {
    background: none;
    border: none;
    color: #1a73e8;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.clear-filters:hover {
    background-color: rgba(26, 115, 232, 0.08);
}

.filter-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 150px;
}

.filter-group label {
    font-size: 14px;
    color: #5f6368;
    font-weight: 500;
}

.dark-theme .filter-group label {
    color: #9aa0a6;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    background: white;
    color: #202124;
    font-size: 14px;
}

.dark-theme .filter-select {
    background: #202124;
    border-color: #5f6368;
    color: #e8eaed;
}

.section-header {
    font-size: 18px;
    font-weight: normal;
    margin: 24px 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #ebebeb;
    color: #202124;
    max-width: 800px; /* Match #resultsContent width */
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px; /* Add some padding if it's full width */
    padding-right: 20px;
}

.dark-theme .section-header {
    color: #e8eaed;
    border-bottom-color: #5f6368;
}

.no-results-message {
    text-align: center;
    color: #70757a;
    font-size: 16px;
    padding: 40px 20px;
}

.dark-theme .no-results-message {
    color: #9aa0a6;
}

/* ============================================ */
/* 13a. MAIN PRODUCT DISPLAY CARD (for selected product) */
/* ============================================ */
.main-product-display {
    border: 1px solid #dfe1e5;
    border-radius: 8px;
    padding: 2px 3px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    background-color: red !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    max-width: 100%;
    
    margin-right: auto;
}

.dark-theme .main-product-display {
    background-color: red !important;
    border-color: #5f6368;
}

.main-product-display .product-card-img {
    width: 100px;
    height: 100px;
    margin-bottom: 0;
    margin-right: 8px;
    flex-shrink: 0;
}

.main-product-display .product-card-category {
    font-size: 12px;
    color: #70757a;
    margin-top: 25px;
    margin-bottom: 4px;
}

.dark-theme .main-product-display .product-card-category {
    color: #9aa0a6;
}

.main-product-display .product-card-title {
    font-size: 16px;
    font-weight: bold;
    color: #202124;
    text-align: left;
    margin-bottom: 4px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.dark-theme .main-product-display .product-card-title {
    color: #e8eaed;
}

.main-product-display .product-card-size {
    font-size: 12px;
    color: #5f6368;
    margin-bottom: 4px;
}

.dark-theme .main-product-display .product-card-size {
    color: #9aa0a6;
}

.main-product-display .product-card-price {
    font-size: 16px;
    font-weight: bold;
    color: #202124;
    margin-bottom: 4px;
    line-height: 1;
    padding: 0;
}

.dark-theme .main-product-display .product-card-price {
    color: #e8eaed;
}

.main-product-display .product-card-link {
    display: inline-block;
    background-color: #1a73e8;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
    transition: background-color 0.2s;
    margin-top: 4px;
}

.main-product-display .product-card-link:hover {
    background-color: #1558b3;
}


/* ============================================ */
/* 13b. COMPACT PRODUCT CARDS (for alternatives/related) */
/* ============================================ */
.product-card {
    border: 1px solid #dfe1e5;
    border-radius: 8px;
    padding: 2px;
    margin-bottom: 8px;
    display: grid;
    grid-template-columns: 60px 1fr auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px;
    background-color: red !important;
    transition: box-shadow 0.2s;
    height: auto;
    min-height: 75px;
    box-sizing: border-box;
    overflow: visible;
    max-width: 800px;
    margin-left: 20px;
    margin-right: auto;
}

.dark-theme .product-card {
    background-color: red !important;
    border-color: #5f6368;
}

.product-card:hover {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.product-card-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 4px;
    grid-row: 1 / 3;
    grid-column: 1;
}

.product-card-title-section {
    display: flex;
    flex-direction: column;
    gap: 2px;
    grid-column: 2;
    grid-row: 1 / 3;
    justify-content: center;
    min-width: 0;
}

.product-card-content {
    display: none;
}

.product-card-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  
    /* Ensure no extra height from line breaks */
    max-height: 100%;
}

.product-card-category {
    font-size: 10px;
    color: #70757a;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2em; /* Explicit em-unit for predictability */
}

.dark-theme .product-card-category {
    color: #9aa0a6;
}

.product-card-title {
    font-size: 12px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 2px;
    line-height: 1.2em; /* Explicit em-unit for predictability */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark-theme .product-card-title {
    color: #e8eaed;
}

.product-card-size {
    font-size: 10px;
    color: #5f6368;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2em; /* Explicit em-unit for predictability */
}

.dark-theme .product-card-size {
    color: #9aa0a6;
}

.product-card-price {
    font-size: 14px;
    font-weight: bold;
    color: #202124;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
    padding: 0 4px;
    line-height: 75px; /* Vertically center the price within the 75px height */
}

.dark-theme .product-card-price {
    color: #e8eaed;
}

.product-card-link {
    display: none; /* Hidden in compact card version */
}

.lower-cost-card {
    background-color: #e9f5e9;
    border: 1px solid #5cb85c;
}

.dark-theme .lower-cost-card {
    background-color: #1e3a1e;
    border-color: #4caf50;
}

/* ============================================ */
/* 14. LANGUAGE OPTIONS COMPONENT */
/* ============================================ */
.language-options {
    margin-top: 28px;
    text-align: center;
    font-size: 14px;
    color: #3c4043;
    transition: opacity 0.3s, transform 0.3s;
}

.dark-theme .language-options {
    color: #bdc1c6;
}

.language-options p {
    margin-bottom: 8px;
}

.language-links {
    display: inline-flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.language-links a {
    color: #1a0dab;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.dark-theme .language-links a {
    color: #8ab4f8;
}

.language-links a:hover {
    background-color: rgba(60, 64, 67, 0.08);
    text-decoration: underline;
}

.dark-theme .language-links a:hover {
    background-color: rgba(232, 234, 237, 0.08);
}

.language-options.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

/* ============================================ */
/* 15. FOOTER COMPONENT */
/* ============================================ */
.footer {
    background-color: #f2f2f2;
    border-top: 1px solid #dadce0;
    padding: 15px 30px;
    margin-top: auto;
}

.dark-theme .footer {
    background-color: #171717;
    border-top-color: #3c4043;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    font-size: 14px;
    color: #70757a;
}

.dark-theme .footer-content {
    color: #9aa0a6;
}

.footer-links {
    display: flex;
    gap: 27px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #70757a;
    text-decoration: none;
    padding: 4px 0;
}

.dark-theme .footer-links a {
    color: #9aa0a6;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-right {
    display: flex;
    gap: 27px;
    flex-wrap: wrap;
}

/* ============================================ */
/* 16. RESPONSIVE DESIGN */
/* ============================================ */
@media (min-width: 769px) {
    /* Desktop-specific product card alignment - GRID LAYOUT */
    .product-card {
        align-items: center; 
        text-align: left;
        margin-left: 20px;
        margin-right: auto;
        max-width: 800px;
        min-height: 75px;
    }

    .product-card-content {
        align-items: center; 
        flex-direction: row; 
    }

    .product-card-link {
        align-self: center; 
        display: none; 
    }

    /* Desktop search results alignment */
    .search-results {
        align-items: flex-start;
        padding-top: 2px;
    }

    #resultsContent {
        width: 100%;
        max-width: 800px;
        margin-left: 20px;
        margin-right: auto;
        padding-top: 2px;
    }
}

/* ============================================ */
/* 17. ALTERNATIVES SECTIONS (UPDATED) */
/* ============================================ */

/* Alternative sections container */
#cheaperAlternativesSection,
#similarPricedSection {
    margin-top: 24px;
    margin-bottom: 16px;
    width: 100%;
    display: block !important; /* Force display when not hidden */
}

#cheaperAlternativesSection.hidden,
#similarPricedSection.hidden {
    display: none !important;
}

/* Alternative section headers */
#cheaperAlternativesSection h3,
#similarPricedSection h3 {
    font-size: 18px;
    font-weight: 600;
    color: #202124;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dark-theme #cheaperAlternativesSection h3,
.dark-theme #similarPricedSection h3 {
    color: #e8eaed;
    border-bottom-color: #5f6368;
}

/* View All buttons */
.cheaper-view-all,
.similar-view-all {
    background: none;
    border: none;
    color: #1a73e8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.cheaper-view-all:hover,
.similar-view-all:hover {
    background-color: rgba(26, 115, 232, 0.08);
    text-decoration: none;
}

.dark-theme .cheaper-view-all,
.dark-theme .similar-view-all {
    color: #8ab4f8;
}

.dark-theme .cheaper-view-all:hover,
.dark-theme .similar-view-all:hover {
    background-color: rgba(138, 180, 248, 0.1);
}

/* Horizontal scroll containers */
#cheaperAlternativesContainer,
#similarPricedContainer {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 4px 16px 4px;
    margin: 0 -4px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
    min-height: 220px;
}

#cheaperAlternativesContainer::-webkit-scrollbar,
#similarPricedContainer::-webkit-scrollbar {
    height: 6px;
}

#cheaperAlternativesContainer::-webkit-scrollbar-track,
#similarPricedContainer::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#cheaperAlternativesContainer::-webkit-scrollbar-thumb,
#similarPricedContainer::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.dark-theme #cheaperAlternativesContainer::-webkit-scrollbar-track,
.dark-theme #similarPricedContainer::-webkit-scrollbar-track {
    background: #303134;
}

.dark-theme #cheaperAlternativesContainer::-webkit-scrollbar-thumb,
.dark-theme #similarPricedContainer::-webkit-scrollbar-thumb {
    background: #5f6368;
}

/* ============================================ */
/* 18. ALTERNATIVE CARDS (UPDATED WITH PROPER STYLING) */
/* ============================================ */

/* Desktop alternative cards */
.alternative-card {
    min-width: 200px;
    flex-shrink: 0;
    background: white;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    margin-right: 8px;
}

.alternative-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    border-color: #3b82f6;
}

.dark-theme .alternative-card {
    background: #303134;
    border-color: #5f6368;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.dark-theme .alternative-card:hover {
    border-color: #8ab4f8;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Mobile alternative cards */
.alternative-card-mobile {
    min-width: 160px;
    flex-shrink: 0;
    background: white;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    margin-right: 8px;
}

.alternative-card-mobile:hover {
    border-color: #3b82f6;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.dark-theme .alternative-card-mobile {
    background: #303134;
    border-color: #5f6368;
}

.dark-theme .alternative-card-mobile:hover {
    border-color: #8ab4f8;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

/* Card Image */
.alternative-card-image {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: linear-gradient(135deg, #93c5fd 0%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.dark-theme .alternative-card-image {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

/* Card Content */
.alternative-card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.alternative-card-brand {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dark-theme .alternative-card-brand {
    color: #9ca3af;
}

.alternative-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}

.dark-theme .alternative-card-title {
    color: #f9fafb;
}

.alternative-card-specs {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dark-theme .alternative-card-specs {
    color: #9ca3af;
}

.alternative-card-price {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dark-theme .alternative-card-price {
    color: #f9fafb;
}

.alternative-card-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6b7280;
    margin-top: auto;
}

.dark-theme .alternative-card-rating {
    color: #9ca3af;
}

/* Price Comparison Badges */
.price-comparison {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.price-lower {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.dark-theme .price-lower {
    background-color: #14532d;
    color: #86efac;
    border-color: #4ade80;
}

.price-higher {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.dark-theme .price-higher {
    background-color: #7f1d1d;
    color: #fca5a5;
    border-color: #f87171;
}

/* Loading and Empty States */
.loading-alternatives, .no-alternatives {
    width: 100%;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 14px;
    flex-direction: column;
    gap: 8px;
}

.no-alternatives {
    background: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
    padding: 20px;
}

.dark-theme .no-alternatives {
    background: #1f2937;
    border-color: #4b5563;
    color: #9ca3af;
}

.dark-theme .loading-alternatives {
    color: #9ca3af;
}

/* Loading spinner */
.loading-alternatives .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #3b82f6;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Adjustments */
@media (max-width: 768px) {
    .alternative-card-mobile {
        min-width: 140px;
        padding: 10px;
    }
    
    .alternative-card-mobile .alternative-card-image {
        width: 48px;
        height: 48px;
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    .alternative-card-mobile .alternative-card-title {
        font-size: 13px;
        min-height: 32px;
    }
    
    .alternative-card-mobile .alternative-card-price {
        font-size: 16px;
    }
    
    .alternative-card-mobile .alternative-card-rating {
        font-size: 11px;
    }
    
    #cheaperAlternativesContainer,
    #similarPricedContainer {
        gap: 12px;
        min-height: 180px;
    }
    
    #cheaperAlternativesSection h3,
    #similarPricedSection h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #cheaperAlternativesSection,
    #similarPricedSection {
        margin-top: 16px;
    }
    
    #cheaperAlternativesSection h3,
    #similarPricedSection h3 {
        font-size: 15px;
    }
    
    .alternative-card-mobile {
        min-width: 130px;
        padding: 8px;
    }
    
    .alternative-card-mobile .alternative-card-image {
        width: 40px;
        height: 40px;
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .alternative-card-mobile .alternative-card-title {
        font-size: 12px;
        min-height: 28px;
    }
    
    .alternative-card-mobile .alternative-card-price {
        font-size: 14px;
    }
}

/* Animation for showing alternatives */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#cheaperAlternativesSection.showing,
#similarPricedSection.showing {
    animation: fadeInUp 0.3s ease-out;
}

/* Ensure sections are visible when not hidden */
#cheaperAlternativesSection:not(.hidden),
#similarPricedSection:not(.hidden) {
    display: block !important;
}

/* Alternative cards in results state */
body.has-results #cheaperAlternativesSection,
body.has-results #similarPricedSection {
    display: block;
}

/* Hide alternatives when not in results state */
body:not(.has-results) #cheaperAlternativesSection,
body:not(.has-results) #similarPricedSection {
    display: none !important;
}

/* Make sure containers are visible */
.horizontal-scroll-container {
    display: flex;
    overflow-x: auto;
    padding-bottom: 16px;
    margin-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
    gap: 16px;
}

.horizontal-scroll-container::-webkit-scrollbar {
    height: 6px;
}

.horizontal-scroll-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.horizontal-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.horizontal-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Debug border for visibility during development */
.debug-border {
    border: 2px solid red !important;
}