/* Enhanced Search & Filtering Styles */
.search-container {
    position: relative;
    max-width: 900px;
    margin: 2rem auto;
    padding: 1.5rem;
    background-color: rgba(36, 26, 16, 0.95);
    border: 2px solid #ba9b37;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.search-container.expanded {
    padding-bottom: 2.5rem;
}

.search-tabs {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 1px solid #ba9b37;
}

.search-tab {
    padding: 0.8rem 1.2rem;
    color: #a08a53;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.search-tab.active {
    color: #d4af37;
    border-bottom: 3px solid #d4af37;
}

.search-tab:hover:not(.active) {
    color: #c4a037;
    border-bottom: 3px solid #a08a53;
}

.search-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-box {
    display: flex;
    width: 100%;
}

#timeline-search {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 1px solid #ba9b37;
    background-color: rgba(36, 26, 16, 0.7);
    color: #d4af37;
    border-radius: 4px 0 0 4px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
}

#timeline-search::placeholder {
    color: rgba(212, 175, 55, 0.5);
}

#search-button {
    padding: 0.8rem 1.5rem;
    background-color: #ba9b37;
    color: #241a10;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    transition: all 0.3s ease;
}

#search-button:hover {
    background-color: #d4af37;
}

.advanced-toggle {
    text-align: center;
    margin-top: 0.5rem;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: #a08a53;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.advanced-toggle:hover {
    color: #d4af37;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.advanced-toggle.expanded .toggle-icon {
    transform: rotate(180deg);
}

.advanced-filters {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, margin 0.5s ease;
    margin-top: 0;
}

.advanced-filters.expanded {
    max-height: 500px;
    margin-top: 1rem;
}

.filter-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-label {
    display: block;
    margin-bottom: 0.5rem;
    font-family: 'Cinzel', serif;
    color: #d4af37;
    font-size: 0.9rem;
}

.filter-select {
    width: 100%;
    padding: 0.7rem;
    background-color: rgba(36, 26, 16, 0.7);
    color: #d4af37;
    border: 1px solid #ba9b37;
    border-radius: 4px;
    font-family: 'Cormorant Garamond', serif;
}

.filter-select option {
    background-color: #241a10;
}

.range-container {
    margin-bottom: 1.5rem;
}

.range-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.range-values {
    display: flex;
    gap: 1rem;
    font-family: 'Cormorant Garamond', serif;
    color: #a08a53;
    font-size: 0.9rem;
}

.range-min, .range-max {
    color: #d4af37;
    font-weight: bold;
}

.range-slider {
    width: 100%;
    position: relative;
}

.slider-track {
    height: 4px;
    width: 100%;
    background-color: #3a2f21;
    position: absolute;
    border-radius: 4px;
}

.slider-range {
    height: 4px;
    position: absolute;
    background-color: #ba9b37;
    border-radius: 4px;
}

.slider-thumb {
    width: 16px;
    height: 16px;
    background-color: #d4af37;
    border-radius: 50%;
    position: absolute;
    top: -6px;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.thumb-min {
    left: 0;
}

.thumb-max {
    right: 0;
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.filter-button {
    padding: 0.6rem 1.2rem;
    font-family: 'Cinzel', serif;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#filter-apply {
    background-color: rgba(186, 155, 55, 0.3);
    color: #d4af37;
    border: 1px solid #ba9b37;
}

#filter-apply:hover {
    background-color: rgba(186, 155, 55, 0.5);
}

#filter-reset {
    background-color: transparent;
    color: #a08a53;
    border: 1px solid #a08a53;
}

#filter-reset:hover {
    color: #d4af37;
    border-color: #d4af37;
}

.search-results {
    margin-top: 1rem;
}

.result-summary {
    font-family: 'Cormorant Garamond', serif;
    color: #a08a53;
    font-style: italic;
    margin-bottom: 1rem;
}

.result-count {
    color: #d4af37;
    font-weight: bold;
}

.result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.result-tag {
    background-color: rgba(186, 155, 55, 0.2);
    color: #d4af37;
    padding: 0.3rem 0.8rem;
    border-radius: 30px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.result-tag:hover {
    background-color: rgba(186, 155, 55, 0.4);
    border-color: #ba9b37;
}

.related-searches {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #ba9b37;
}

.related-title {
    font-family: 'Cinzel', serif;
    color: #d4af37;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.related-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.related-item {
    color: #a08a53;
    padding: 0.3rem 0.8rem;
    border-radius: 30px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: underline;
}

.related-item:hover {
    color: #d4af37;
}

.highlighted-text {
    background-color: rgba(212, 175, 55, 0.3);
    border-radius: 3px;
    padding: 0 3px;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .search-tabs {
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .search-tab {
        padding: 0.5rem 0.8rem;
        white-space: nowrap;
    }

    .filter-row {
        flex-direction: column;
        gap: 1.2rem;
    }

    .filter-group {
        width: 100%;
    }
}
