/* Search Page Styles */

/* Sticky footer layout for search page only (search.css is only loaded here) */
html, body { height: 100%; }
body { min-height: 100vh; display: flex; flex-direction: column; }

.main-content-wrapper {
    flex: 1 0 auto; /* Take remaining space to push footer to bottom */
    display: flex;
    flex-direction: column;
    padding-bottom: 0 !important; /* Override global padding that can create a gap above footer */
}

/* Footer container should sit at the bottom in flex layout */
#footer-placeholder { margin-top: auto; width: 100%; }

/* Ensure footer fills width */
body > #footer-placeholder > footer { width: 100%; display: block; }

.search-view {
    flex-grow: 1; /* Allow these to take available space */
    display: flex;
    flex-direction: column;

    align-items: center; /* Center content horizontally */
    width: 100%; /* Ensure they take full width */
    min-height: auto;
    transition: all 0.5s ease-in-out;
}

.page-header h2 {
    font-size: 2rem; /* Adjusted for smaller size */
    margin-bottom: 0; /* Reduced for less space */
    color: var(--primary-color);
}

.search-hero {
    width: 100%;
    padding: 4rem 0 1rem 0; /* Adjusted padding to explicitly set all values, with 80px top padding */
    text-align: center;
    background-color: var(--light-color);
    border-bottom: 1px solid var(--border-color);
}

.search-hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 0; /* No gap between elements */
    align-items: stretch; /* Make elements stretch to fill container height */
    border: 2px solid var(--border-color);
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#product-search {
    flex: 1;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    border: none;
    background-color: var(--white-color);
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

#product-search:focus {
    border-color: var(--primary-color);
}

.filter-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.filter-options.compact {
    margin-top: 1rem;
    padding-bottom: 0.5rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.form-select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-family: inherit;
}

.search-bar-container {
    background-color: #f8f9fa;
    padding: 0.5rem 0; /* Reduced from 1rem */
    margin-bottom: 1rem; /* Reduced from 2rem */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 700px;
    margin: 0 auto;
}

#product-search-top {
    flex: 1;
    padding: 0.5rem 0.75rem; /* Reduced from 0.75rem 1rem */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

#search-btn {
    background-color: var(--primary-color);
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--white-color);
    padding: 0.8rem 1.5rem;
    flex-shrink: 0;
    outline: none;
    transition: background-color 0.3s ease;
}

#search-btn:hover {
    background-color: var(--secondary-color);
}

/* Category Showcase */
.category-showcase {
    padding: 1rem 0;
    background-color: #fff;
    width: 100%;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--primary-color);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    justify-items: center;
    max-width: 100%;
    margin: 1rem auto;
    padding: 0 1rem;
}

/* Tablet and larger */
@media (min-width: 768px) {
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        padding: 0 1.5rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 1200px;
        gap: 1.5rem;
        padding: 0;
    }
}

.category-card {
    background-color: var(--light-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 200px; /* Ensure cards don't get too wide on larger screens */
    margin: 0 auto; /* Center cards in their grid cells */
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.category-image {
    height: 120px; /* Slightly smaller on mobile */
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

/* Larger screens */
@media (min-width: 768px) {
    .category-image {
        height: 150px;
    }
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.category-card h4 {
    padding: 1rem;
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
    background-color: var(--secondary-background-color);
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* View Transitions */
.search-view.hide {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    position: absolute;
    width: 100%;
}

.products-view.show {
    display: block !important;
    animation: fadeIn 0.3s ease-out;
}
