/* --- Advanced Search Theme Styles --- */

:root {
    --bg-color: #f9f9f9;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #7f8c8d;
    --border-color: #e0e0e0;
    --accent-color: #3d6b8c; /* Matches R:61, G:107, B:140 */
    --accent-hover: #315772;
    --radius: 4px;
}

/* Prevent layout shift/jump when vertical scrollbars appear */
html {
    overflow-y: scroll;
}

body.search-page {
    font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    
    /* Sticky footer flex setup */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* 50px Black Top Bar */
.site-topbar {
    background-color: #111111;
    height: 50px;              /* Forces exact height */
    min-height: 50px;          /* Prevents shrinking */
    max-height: 50px;          /* Prevents stretching */
    flex-shrink: 0;            /* Protects it from flexbox compression */
    display: flex;
    align-items: center;
    border-bottom: 1px solid #222;
    box-sizing: border-box;
}

.topbar-content {
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Sleek Home Button */
.home-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #cccccc;
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    transition: color 0.2s;
}

.home-btn svg {
    stroke: #cccccc;
    transition: stroke 0.2s;
}

.home-btn:hover {
    color: #ffffff;
}

.home-btn:hover svg {
    stroke: #ffffff;
}

/* Custom Top Banner (R: 61, G: 107, B: 140) */
.site-banner {
    background-color: rgb(61, 107, 140);
    color: #ffffff;
    padding: 30px 20px; /* 65px is same height as jalbum */
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.banner-content {
    max-width: 1320px;
    margin: 0 auto;
}

.site-banner h1 {
    margin: 0 0 6px 0;
    font-size: 28px;
    font-weight: 300;
    letter-spacing: 0.5px;
}

.site-banner p {
    margin: 0;
    font-size: 14px;
    opacity: 0.85;
}

/* Make the main search container grow to push the footer down */
.search-container {
    flex: 1; /* This forces the container to expand and fill empty space */
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px 60px 20px;
    box-sizing: border-box;
}

/* Filter Bar Styling */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    align-items: flex-end;
    margin-bottom: 25px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.filter-group input, 
.filter-group select,
.dropdown-selected,
.btn {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    background-color: #fff;
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s, background-color 0.2s, opacity 0.2s;
    box-sizing: border-box;
    font-family: inherit;
    line-height: normal;
    height: 36px; /* Locks an identical explicit height across inputs and buttons */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-group input:focus, 
.custom-dropdown.open .dropdown-selected {
    border-color: var(--accent-color);
}

/* Custom Searchable Dropdown Styling */
.custom-dropdown {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.dropdown-selected {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    width: 100%;
}

.dropdown-selected::after {
    content: "▼";
    font-size: 10px;
    color: #7f8c8d;
    margin-left: 8px;
}

.dropdown-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    display: none;
    box-sizing: border-box;
}

.dropdown-panel.open {
    display: block;
}

#family-search-input {
    width: 100%;
    height: 38px;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    box-sizing: border-box;
    outline: none;
    font-size: 13px;
    border-radius: 0;
}

.dropdown-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

.dropdown-option {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 14px;
}

.dropdown-option:hover,
.dropdown-option.selected {
    background-color: var(--accent-color);
    color: white;
}

/* Consistent Disabled State for Inputs & Custom Dropdown */
.filter-group input:disabled,
.custom-dropdown.disabled .dropdown-selected {
    background-color: #f5f5f5;
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Buttons */
.filter-actions {
    display: flex;
    gap: 10px;
}

.btn {
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent; /* Keeps box model dimensions consistent with inputs */
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
    border-color: #d0d0d0;
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}

/* Results Info Bar */
.results-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 400;
}

/* Results Thumbnail Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Card Styling */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.card a {
    display: block;
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #000;
}

.card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Floating Back to Top Button */
#back-to-top-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 99;
    background-color: var(--accent-color);
    color: white;
    border: none;
    outline: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s, transform 0.2s;
}

#back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
}

#back-to-top-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-3px);
}

/* Site Footer */
.site-footer {
    background-color: #1a1a1a;
    color: #999999;
    padding: 25px 20px;
    text-align: center;
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    margin-top: auto; /* Pushes the footer cleanly to the bottom */
}

.footer-content {
    max-width: 1320px;
    margin: 0 auto;
}

.site-footer p {
    margin: 0;
}