/* Homepage Search Hero - Conversion Optimization */

.homepage-search-hero {
    /* Background set dynamically in home.php based on config */
    background-size: cover;
    background-position: top;
    background-repeat: no-repeat;
    padding: 8rem 1rem;
    margin: 0 auto 2rem auto;
    max-width: calc(100% - 2rem);
    position: relative;
    border-radius: 8px;
}

.homepage-search-hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.homepage-search-hero h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin-bottom: 0.75rem;
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.homepage-search-hero p {
    font-family: 'Poppins', sans-serif;
    font-size: 1.125rem;
    color: #f3f4f6;
    text-align: center;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

/* Enhanced Search Bar */
.hero-search-form {
    position: relative;
    max-width: 850px;
    margin: 0 auto 2rem;
}

/* Mobile: Full width hero search */
@media screen and (max-width: 639px) {
    .homepage-search-hero-inner {
        padding: 0 1rem;
    }
    
    .hero-search-form {
        max-width: 100%;
    }
}

.hero-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 52px;
}

.hero-search-wrapper:focus-within {
    border-color: #a88a47;
    box-shadow: 0 0 0 3px rgba(168, 138, 71, 0.1);
}

.hero-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 1.25rem;
    padding-right: 0.75rem;
    color: #9ca3af;
    background: transparent;
    pointer-events: none;
    flex-shrink: 0;
}

.hero-search-icon i {
    font-size: 1.25rem;
}

.hero-search-input {
    flex: 1;
    border: none !important;
    padding: 1.125rem 1rem 1.125rem 0;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    color: #1f2937;
    margin: 0 !important;
    height: auto;
    line-height: 1.5;
}

.hero-search-input:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.hero-search-input::placeholder {
    color: #9ca3af;
}

.hero-search-button {
    background: #a88a47;
    border: none;
    padding: 1.125rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-search-button i {
    font-size: 1.25rem;
}

.hero-search-button:hover {
    background: #8f7439;
}

/* Popular Searches */
.popular-searches {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 1rem;
    text-align: center;
}

.popular-searches-label {
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin-right: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.popular-searches-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.popular-search-item {
    display: inline-block;
}

.popular-search-link {
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    background: transparent;
    border-radius: 20px;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 2px solid rgba(255, 255, 255, 0.8);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.popular-search-link:hover {
    background: transparent;
    border-color: #a88a47;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(168, 138, 71, 0.4);
}

/* Mobile: Better spacing for popular searches */
@media screen and (max-width: 639px) {
    .popular-searches {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 0.5rem;
    }
    
    .popular-searches-label {
        width: 100%;
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }
    
    .popular-searches-list {
        width: 100%;
        gap: 1rem;
    }
    
    .popular-search-link {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
}

/* Trending Products Section */
.trending-products {
    margin-top: 0;
    padding-top: 0;
}

.trending-products-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.trending-products-header h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #0a0a0a;
    margin-bottom: 0.5rem;
}

.trending-products-header p {
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: #6b7280;
}

.trending-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.trending-product-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
}

.trending-product-card:hover {
    border-color: #a88a47;
    box-shadow: 0 4px 12px rgba(168, 138, 71, 0.15);
    transform: translateY(-2px);
}

.trending-product-image {
    width: 100%;
    height: 180px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.trending-product-name {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trending-product-price {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #a88a47;
}

/* Instant Search Results Dropdown */
.hero-search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

/* Position the shared search dropdown under hero search on homepage */
.hero-search-form .search-suggestion-wrapper {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(-10px) !important;
    width: 100% !important;
    max-width: 850px !important;
    z-index: 9999 !important;
    margin: 0 !important;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

/* Mobile: Full width dropdown */
@media screen and (max-width: 639px) {
    .hero-search-form .search-suggestion-wrapper {
        left: 0 !important;
        right: 0 !important;
        transform: translateY(-10px) !important;
        max-width: 100% !important;
    }
}

/* Simple styling - no shadows or rounded corners */
.hero-search-form .search-suggestion-wrapper .a-search-suggestion {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0.5rem 1rem !important;
    margin: 0 !important;
}

.hero-search-form .search-suggestion-wrapper .a-search-suggestion:hover {
    background: #f5f5f5 !important;
}

.hero-search-form .search-suggestion-wrapper .a-search-suggestion a {
    color: #000 !important;
    text-decoration: none !important;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Visited link styling - keep black */
.hero-search-form .search-suggestion-wrapper .a-search-suggestion a:visited {
    color: #000 !important;
}

.hero-search-form .search-suggestion-wrapper .a-search-suggestion .slabel {
    font-weight: 600;
    color: #000;
    font-size: 0.85rem;
}

/* Product name styling - bolder and smaller */
.hero-search-form .search-suggestion-wrapper .product-name {
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    color: #000 !important;
    line-height: 1.3;
}

/* Model number styling */
.hero-search-form .search-suggestion-wrapper .product-model {
    font-size: 0.8rem !important;
    color: #000 !important;
    font-weight: 400;
    margin-top: 2px;
}

/* Regular price styling */
.hero-search-form .search-suggestion-wrapper .product-price {
    font-size: 0.85rem !important;
    color: #000 !important;
    font-weight: 500;
}

/* Sale price styling - red */
.hero-search-form .search-suggestion-wrapper .product-price.sale-price,
.hero-search-form .search-suggestion-wrapper .product-price .sale-price {
    color: #B12704 !important;
    font-weight: 600;
}

/* Show dropdown with smooth animation */
.hero-search-form .search-suggestion-wrapper[style*="display: block"],
.hero-search-form .search-suggestion-wrapper[style*="display: inline"] {
    opacity: 1;
    transform: translateX(-50%) translateY(0) !important;
    pointer-events: auto;
}

/* Mobile: Remove centering transform when visible */
@media screen and (max-width: 639px) {
    .hero-search-form .search-suggestion-wrapper[style*="display: block"],
    .hero-search-form .search-suggestion-wrapper[style*="display: inline"] {
        transform: translateY(0) !important;
    }
}

/* Smooth overlay for homepage search */
.homepage-search-hero .overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.homepage-search-hero .overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.hero-search-results.active {
    display: block;
}

.hero-search-results-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hero-search-result-item {
    border-bottom: 1px solid #f8f9fa;
}

.hero-search-result-item:last-child {
    border-bottom: none;
}

.hero-search-result-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    text-decoration: none;
    transition: background 0.2s ease;
}

.hero-search-result-link:hover {
    background: #f8f9fa;
}

.hero-search-result-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-right: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.25rem;
}

.hero-search-result-info {
    flex: 1;
    min-width: 0;
}

.hero-search-result-name {
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: #0a0a0a;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-search-result-price {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #a88a47;
    margin-bottom: 0.25rem;
}

.hero-search-result-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: #ffc107;
}

.hero-search-result-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-left: 1rem;
}

.hero-search-quick-add {
    padding: 0.5rem 1rem;
    background: #a88a47;
    color: #ffffff;
    border: none;
    border-radius: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.hero-search-quick-add:hover {
    background: #8f7439;
    transform: translateY(-1px);
}

.hero-search-view-product {
    padding: 0.5rem 1rem;
    background: transparent;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    text-align: center;
}

.hero-search-view-product:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.hero-search-no-results {
    padding: 2rem;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    color: #6c757d;
}

.hero-search-loading {
    padding: 2rem;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    color: #6c757d;
}

.hero-search-loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

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

/* Mobile Responsive */
@media only screen and (max-width: 768px) {
    .homepage-search-hero {
        padding: 2rem 1rem 1.5rem;
    }

    .homepage-search-hero h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .homepage-search-hero p {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .hero-search-form {
        max-width: 100%;
    }

    .hero-search-icon {
        padding: 0 0.75rem;
    }

    .hero-search-icon i {
        font-size: 1.1rem;
    }

    .hero-search-input {
        padding: 1rem 0.75rem;
        font-size: 0.95rem;
    }

    .hero-search-button {
        padding: 1rem 1.5rem;
        font-size: 0.9rem;
    }

    .popular-searches {
        margin-bottom: 2rem;
    }

    .popular-searches-list {
        gap: 1rem;
    }

    .popular-search-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .trending-products-header h2 {
        font-size: 1.25rem;
    }

    .trending-products-header p {
        font-size: 0.875rem;
    }

    .trending-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .trending-product-card {
        padding: 0.75rem;
    }

    .trending-product-image {
        height: 140px;
    }

    .trending-product-name {
        font-size: 0.85rem;
    }

    .trending-product-price {
        font-size: 1rem;
    }
}

@media only screen and (max-width: 480px) {
    .homepage-search-hero {
        padding: 1.25rem 1rem 1rem;
        margin-bottom: 0;
    }

    .homepage-search-hero h1 {
        font-size: 1.3rem;
        margin-bottom: 0.3rem;
    }

    .homepage-search-hero p {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }

    .hero-search-input {
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
    }

    .hero-search-button {
        padding: 0.85rem 1.25rem;
        min-width: 50px;
    }
    
    .hero-search-button::before {
        font-size: 1rem;
    }

    .popular-searches-list {
        gap: 1rem;
    }

    .popular-search-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .hero-search-result-link {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }

    .hero-search-result-image {
        width: 100%;
        height: auto;
        max-width: 200px;
        margin: 0 auto 0.75rem;
    }

    .hero-search-result-actions {
        flex-direction: row;
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .hero-search-quick-add,
    .hero-search-view-product {
        flex: 1;
        padding: 0.6rem 0.8rem;
    }
}

/* Tablet */
@media only screen and (min-width: 769px) and (max-width: 1024px) {
    .homepage-search-hero h1 {
        font-size: 2rem;
    }

    .hero-search-input {
        font-size: 1rem;
    }
}
