/* --- css/search.css --- */

/* Styles for the Search View Container */
#search-section {
    justify-content: flex-start;
    align-items: center;
    font-family: var(--app-font-family);
    box-sizing: border-box;
    width: 100%;
    flex-direction: column;
    position: relative;
    z-index: 20;
    padding-top: 130px; /* Explicitly push content down from the top */
}

#search-section h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 600;
    color: var(--primary-text-color);
    margin-bottom: 2.5rem;
    text-shadow: 0 0 10px rgba(var(--gradient-color-2-rgb), 0.3);
}

.search-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    align-items: center;
    gap: 0.5rem; /* Space between input, dropdown, and button */
    background-color: var(--content-bg-color);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--input-border-color);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.4), 0 0 15px rgba(var(--gradient-color-1-rgb), 0.1);
    backdrop-filter: blur(4px);
    position: relative;
}

#concept-input {
    width: 100%;
    height: 55px;
    padding: 0 1.5rem;
    font-size: 1.1rem;
    font-family: var(--app-font-family);
    color: var(--primary-text-color);
    background-color: var(--input-bg-color);
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}
#concept-input::placeholder {
    color: var(--secondary-text-color);
    opacity: 0.7;
}
#concept-input:focus {
    border-color: var(--input-focus-border-color);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3), 0 0 15px var(--input-focus-glow);
}

#search-button {
    padding: 0.8rem 2rem; font-size: 1rem; font-weight: 600;
    border-radius: 8px; border: 1px solid transparent; cursor: pointer;
    transition: all 0.3s ease; font-family: var(--app-font-family);
    letter-spacing: 0.5px; text-transform: uppercase;
    background: linear-gradient(90deg, var(--gradient-color-1), var(--gradient-color-2));
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2), 0 0 20px rgba(var(--gradient-color-2-rgb), 0.3);
    height: 55px;
    margin: 0;
    flex-shrink: 0;
    width: 100%;
    margin-top: 0.5rem; /* This was here, the glass box will go after this button */
}
#search-button:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3), 0 0 30px rgba(var(--gradient-color-2-rgb), 0.5);
}
#search-button:active {
    transform: translateY(-1px) scale(1);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2), 0 0 15px rgba(var(--gradient-color-2-rgb), 0.2);
}
#search-button:disabled {
    cursor: not-allowed; opacity: 0.5;
    background: linear-gradient(90deg, #555, #777);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
    transform: none;
}

/* --- NEW: Styles for Search Filters Glass Box & Sliders --- */
.search-filters-glass-box {
    /* Sits within .search-wrapper or directly in #search-section. 
       If inside .search-wrapper, it will be constrained by its max-width.
       If directly in #search-section, it will be centered by #search-section's align-items.
       Let's assume it's inside .search-wrapper for now, after the button. */
    width: 100%; /* Take full width of its parent (.search-wrapper) */
    background: rgba(var(--content-bg-color-rgb), 0.6); /* Use your content background with transparency */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(4px); /* For Safari */
    border-radius: var(--border-radius-medium, 10px); /* Use your theme variable or a default */
    border: 1px solid rgba(var(--input-border-color-rgb), 0.3); /* Transparent version of your border */
    padding: 20px;
    margin-top: 1.5rem; /* Space above the box, after the search button */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.filter-group-slider {
    margin-bottom: 18px;
}

.filter-group-slider:last-child {
    margin-bottom: 0;
}

.filter-group-slider label {
    display: block; 
    margin-bottom: 10px;
    font-size: 0.9em; /* Slightly smaller than main input label */
    font-weight: 500;
    color: var(--secondary-text-color); 
}

.filter-group-slider label span { 
    font-weight: bold;
    color: var(--primary-text-color); /* Or var(--accent-color) if you prefer */
    background-color: rgba(var(--input-bg-color-rgb), 0.7);
    padding: 2px 6px;
    border-radius: var(--border-radius-small, 4px);
    margin-left: 5px;
}

.filter-group-slider input[type="range"] {
    width: 100%; 
    cursor: pointer;
    accent-color: var(--gradient-color-1); /* Colors the track/thumb in modern browsers */
    margin-top: 5px;
}

/* Optional: Basic custom styling for range slider track and thumb for better cross-browser feel if needed */
/* These are quite involved to get perfect, so starting with accent-color is good */
/* Example for Webkit (Chrome, Safari, Edge) */
.filter-group-slider input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--input-border-color); /* Or a slightly darker bg */
    border-radius: 3px;
}
.filter-group-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid var(--gradient-color-1);
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--content-bg-color); /* Or white */
    cursor: pointer;
    margin-top: -6px; /* Adjust to center thumb on track */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
/* Example for Firefox */
.filter-group-slider input[type="range"]::-moz-range-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--input-border-color);
    border-radius: 3px;
}
.filter-group-slider input[type="range"]::-moz-range-thumb {
    border: 2px solid var(--gradient-color-1);
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--content-bg-color);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* --- NEW Segmented Control for Lenses --- */
.segmented-control {
    display: flex;
    width: 100%;
    border-radius: 8px; /* Match search button */
    overflow: hidden;
    border: 1px solid var(--input-border-color); /* Use existing variable */
}

.segmented-control-button {
    flex-grow: 1;
    padding: 10px 5px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary-text-color);
    background-color: rgba(var(--content-bg-color-rgb), 0.6); /* Inactive background */
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    font-family: var(--app-font-family);
}

.segmented-control-button:not(:last-child) {
    border-right: 1px solid var(--input-border-color);
}

.segmented-control-button:hover:not(.active) {
    background-color: rgba(var(--content-bg-color-rgb), 0.9);
    color: var(--primary-text-color);
}

.segmented-control-button.active {
    background: linear-gradient(90deg, var(--gradient-color-1), var(--gradient-color-2));
    color: white;
    font-weight: 600;
    box-shadow: 0 0 10px rgba(var(--gradient-color-2-rgb), 0.4);
    cursor: default;
}

/* --- SEARCH HISTORY DROPDOWN STYLES --- */
.search-history-dropdown {
    /* ... your existing history styles ... */
}
/* ... rest of your search.css ... */

/* --- SEARCH HISTORY DROPDOWN STYLES --- */
.search-history-dropdown {
    width: 100%;
    background-color: var(--content-bg-color);
    border: 1px solid var(--input-border-color);
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000; /* Ensure it's above other content in search view and potentially graph elements if search is overlaid */
    margin-top: -1px; /* Overlap with input slightly */
    display: none;
    box-sizing: border-box;
}

.search-history-item {
    padding: 0.75rem 1.5rem;
    color: var(--primary-text-color);
    cursor: pointer;
    font-size: 1rem;
    border-bottom: 1px solid var(--input-border-color);
    transition: background-color 0.2s ease, color 0.2s ease;
    text-align: left; /* Ensure items are left-aligned */
}
/* Remove border for the very last child, which will be the footer */
.search-history-dropdown > *:last-child.search-history-item {
    border-bottom: none;
}
.search-history-item:hover,
.search-history-item.focused {
    background-color: var(--input-bg-color);
    color: var(--gradient-color-1);
}
/* Style for "No recent searches" message if it uses .search-history-item class */
.search-history-item:not([data-index]) { /* Target items without data-index (like 'no history') */
    cursor: default;
    color: var(--secondary-text-color);
    font-style: italic;
}
.search-history-item:not([data-index]):hover {
    background-color: transparent; /* Don't change bg on hover for "no history" */
    color: var(--secondary-text-color); /* Keep text color same on hover */
}


.search-history-footer {
    padding: 0.6rem 1.5rem; /* Slightly less padding than items */
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--input-border-color);
    /* Optional: different background for footer for visual separation */
    /* background-color: rgba(var(--panel-bg-color-rgb), 0.5); */
}

.search-history-info-text {
    font-size: 0.75rem;
    color: var(--secondary-text-color);
    opacity: 0.8;
    flex-grow: 1; /* Take available space on the left */
    text-align: left;
    margin-right: 1rem; /* Space between info and clear button */
    line-height: 1.3;
    white-space: nowrap; /* Prevent wrapping if too long for one line */
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-history-clear-button {
    font-size: 0.8rem; /* Adjusted for consistency */
    color: var(--secondary-text-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0; /* Prevent button from shrinking */
}
.search-history-clear-button:hover {
    color: var(--gradient-color-2);
    text-decoration: underline;
}

/* Scrollbar for history dropdown */
.search-history-dropdown::-webkit-scrollbar { width: 6px; }
.search-history-dropdown::-webkit-scrollbar-track { background: transparent; } /* Track can be transparent if dropdown bg is dark */
.search-history-dropdown::-webkit-scrollbar-thumb { background-color: rgba(var(--gradient-color-1-rgb), 0.5); border-radius: 3px; }
.search-history-dropdown::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--gradient-color-1-rgb), 0.75); }

body.light-theme .search-history-dropdown::-webkit-scrollbar-thumb { background-color: rgba(var(--gradient-color-2-rgb), 0.5); }
body.light-theme .search-history-dropdown::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--gradient-color-2-rgb), 0.75); }


/* Responsive Adjustments for Search */
@media (max-width: 500px) {
    .search-wrapper {
        padding: 1rem;
    }
    /* .search-history-info-text might need to wrap or be hidden on very small screens */
    .search-history-footer {
        flex-direction: column; /* Stack info and clear button on small screens */
        align-items: flex-start; /* Align items to the start */
        gap: 0.5rem;
    }
    .search-history-info-text {
        margin-right: 0; /* Remove right margin when stacked */
        white-space: normal; /* Allow info text to wrap */
    }
    .search-history-clear-button {
        align-self: flex-end; /* Push clear button to the right in stacked layout */
    }
}