/* ==============================================
   Pagefind Search Styles
   ============================================== */

/* Search Page Container */
.search-page {
    padding: 2rem 0 4rem;
    min-height: 70vh;
}

.search-header {
    text-align: center;
    margin-bottom: 2rem;
}

.search-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #1a202c;
}

.search-description {
    font-size: 1.125rem;
    color: #718096;
    max-width: 600px;
    margin: 0 auto;
}

/* Search Input */
.search-input-wrapper {
    position: relative;
    max-width: 800px;
    margin: 0 auto 2rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 3rem;
    font-size: 1.125rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.5rem;
    transition: all 0.2s;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.clear-search {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #718096;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search:hover {
    color: #1a202c;
}

/* Filters */
.search-filters {
    max-width: 800px;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.filter-toggle:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.filter-toggle svg {
    width: 16px;
    height: 16px;
}

.filter-count {
    background: #2563eb;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.filters-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 10;
    min-width: 250px;
}

.filters-panel.active {
    display: block;
}

.clear-filters {
    padding: 0.75rem 1rem;
    background: #fee;
    color: #c53030;
    border: 1px solid #feb2b2;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.clear-filters:hover {
    background: #fed7d7;
}

/* Search Stats */
.search-stats {
    max-width: 800px;
    margin: 0 auto 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f7fafc;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #4a5568;
}

/* Results */
.search-results {
    max-width: 800px;
    margin: 0 auto;
}

.search-empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.search-empty-state svg {
    margin: 0 auto 1rem;
    color: #cbd5e0;
}

.search-empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.search-empty-state p {
    color: #718096;
    margin-bottom: 2rem;
}

.popular-searches h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.suggestion-tag {
    padding: 0.5rem 1rem;
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.suggestion-tag:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* Loading State */
.search-loading {
    text-align: center;
    padding: 3rem 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Pagefind Result Overrides */
.pagefind-ui__search-input {
    display: none !important; /* We use custom input */
}

.pagefind-ui__result {
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.pagefind-ui__result:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.pagefind-ui__result-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.pagefind-ui__result-title a {
    color: #1a202c;
    text-decoration: none;
}

.pagefind-ui__result-title a:hover {
    color: #2563eb;
}

.pagefind-ui__result-excerpt {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.pagefind-ui__result-excerpt mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0.125rem 0.25rem;
    border-radius: 0.125rem;
    font-weight: 500;
}

/* Search Result Images */
.search-result-card {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.result-image-container {
    flex-shrink: 0;
    width: 200px;
    height: 150px;
    overflow: hidden;
    border-radius: 0.5rem;
    background: #f7fafc;
}

.result-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.2s;
}

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

.result-content {
    flex: 1;
    min-width: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-header h1 {
        font-size: 2rem;
    }

    .search-description {
        font-size: 1rem;
    }

    .search-input {
        font-size: 1rem;
        padding: 0.875rem 2.5rem 0.875rem 2.5rem;
    }

    .search-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .filters-panel {
        left: 0;
        right: 0;
        width: calc(100% - 2rem);
    }

    /* Stack images vertically on mobile */
    .search-result-card {
        flex-direction: column;
        gap: 1rem;
    }

    .result-image-container {
        width: 100%;
        max-width: 100%;
        height: 200px;
    }
}