/* ============================================================
   SEARCH.CSS — Base layout, search header, filters, homepage
   ============================================================ */

/* --- Results mode: lock viewport, flatten container --- */
body.in-results-mode {
    overflow: hidden;
    height: 100dvh;
    height: 100vh;
    margin: 0;
    background: #f1f5f9;
}
body.in-results-mode footer { display: none; }
body.in-results-mode main.container {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
}
body.in-results-mode #search-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
body.in-results-mode .search-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
    max-width: none;
}

/* --- Search header (results mode) --- */
.results-mode .search-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 14px 28px 10px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.results-mode .search-header > .logo {
    text-decoration: none;
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: inherit;
    margin: 0;
    color: inherit;
}
.logo-edu {
    font-size: 26px;
    font-weight: 500;
    color: #3b82f6;
    letter-spacing: -0.3px;
}
.logo-kompas {
    font-size: 26px;
    font-weight: 700;
    color: #1e3a5f;
    letter-spacing: -0.5px;
}

/* --- Search wrapper --- */
.search-wrapper {
    position: relative;
    flex: 1;
}
.results-mode .search-wrapper {
    max-width: 560px;
}

/* --- Search box --- */
.search-box {
    display: flex;
    align-items: center;
    border: 1.5px solid #cbd5e1;
    border-radius: 24px;
    padding: 5px 6px 5px 18px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 6px 4px;
    color: #1e293b;
}
.search-btn {
    padding: 8px 22px;
    background: #1e3a5f;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}
.search-btn:hover { background: #264d73; }

/* Search box with suggestions open */
.search-box.dropdown-open {
    border-radius: 24px 24px 0 0;
    border-bottom-color: transparent;
}

/* --- Filters --- */
.filters {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Dropdown filter */
.filter-dropdown { position: relative; }
.filter-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px 0 12px;
    border: 1px solid #dadce0;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 400;
    background: #fff;
    color: #5f6368;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.filter-dropdown-label {
    font-size: 13px;
    font-weight: 400;
}
.filter-dropdown-btn:hover { background: #f1f3f4; }
.filter-dropdown.open .filter-dropdown-btn {
    border-color: #4285f4;
    background: #e8f0fe;
    color: #1a73e8;
    font-weight: 400;
}
.filter-dropdown.active-filter .filter-dropdown-btn {
    background: #e8f0fe;
    border-color: #d2e3fc;
    color: #1a73e8;
    font-weight: 400;
}
.filter-dropdown-arrow {
    color: #9aa0a6;
    transition: transform 0.15s;
    flex-shrink: 0;
}
.filter-dropdown.open .filter-dropdown-arrow {
    transform: rotate(180deg);
    color: #1a73e8;
}
.filter-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    min-width: 160px;
    padding: 4px 0;
    z-index: 60;
    overflow: hidden;
}
.filter-dropdown.open .filter-dropdown-menu { display: block; }
.filter-dropdown-item {
    padding: 8px 16px;
    font-size: 13px;
    color: #3c4043;
    cursor: pointer;
    transition: background 0.1s;
}
.filter-dropdown-item:hover { background: #f1f3f4; }
.filter-dropdown-item.selected {
    color: #1a73e8;
    font-weight: 500;
    background: #e8f0fe;
}

/* Checkbox chip filter */
.filter-chip-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #dadce0;
    border-radius: 16px;
    font-size: 13px;
    color: #5f6368;
    background: #fff;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.filter-chip-checkbox:hover { background: #f1f3f4; }
.filter-chip-checkbox.active {
    background: #e8f0fe;
    border-color: #d2e3fc;
    color: #1a73e8;
}
.filter-check-icon { display: none; }
.filter-chip-checkbox.active .filter-check-icon { display: block; }
.filter-chip-checkbox input[type="checkbox"] { margin: 0; }

/* Legacy year range (kept for backward compat) */
.filter-year-range {
    display: flex;
    align-items: center;
    gap: 4px;
}
.filter-year-group {
    display: flex;
    align-items: center;
    height: 32px;
    border: 1px solid #dadce0;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    transition: border-color 0.15s;
}
.filter-year-group:focus-within { border-color: #4285f4; }
.filter-year-prefix {
    font-size: 13px;
    color: #9aa0a6;
    padding-left: 12px;
    white-space: nowrap;
    user-select: none;
}
.filter-year-input {
    width: 52px;
    height: 100%;
    padding: 0 10px 0 4px;
    border: none;
    font-size: 13px;
    background: transparent;
    color: #3c4043;
    outline: none;
    -moz-appearance: textfield;
}
.filter-year-input::-webkit-outer-spin-button,
.filter-year-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.filter-year-input::placeholder { color: #9aa0a6; font-size: 13px; }
.filter-range-sep { color: #9aa0a6; font-size: 13px; margin: 0 2px; }

/* --- Results info bar --- */
.results-info {
    padding: 8px 28px 4px;
    font-size: 13px;
    color: #94a3b8;
    background: #f1f5f9;
    flex-shrink: 0;
}

/* --- Homepage mode --- */
.search-page {
    margin: 0 auto;
    padding: 20px;
}
.homepage-mode {
    min-height: 80vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}
.homepage-mode .search-page {
    text-align: center;
    max-width: 600px;
}
.homepage-mode .logo {
    font-size: 48px;
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: -1px;
}
.homepage-mode .logo-edu {
    font-size: 48px;
}
.homepage-mode .logo-kompas {
    font-size: 48px;
}
.homepage-mode .tagline {
    font-size: 15px;
    color: #5f6368;
    margin-bottom: 28px;
    font-weight: 400;
    letter-spacing: 0.3px;
}
.homepage-mode .search-box {
    text-align: left;
    margin-bottom: 10px;
    padding: 8px 8px 8px 22px;
    border: 2px solid #dadce0;
    box-shadow: 0 2px 8px rgba(32,33,36,0.08), 0 1px 3px rgba(32,33,36,0.06);
}
.homepage-mode .search-box:hover {
    box-shadow: 0 4px 16px rgba(32,33,36,0.16), 0 2px 4px rgba(32,33,36,0.08);
    border-color: #c4c8cc;
}
.homepage-mode .search-box:focus-within {
    box-shadow: 0 4px 16px rgba(59,130,246,0.15), 0 2px 4px rgba(32,33,36,0.08);
    border-color: #3b82f6;
}
.homepage-mode .search-input {
    font-size: 16px;
    padding: 10px 6px;
}
.homepage-mode .search-btn {
    padding: 10px 28px;
    font-size: 15px;
}
.homepage-mode .promise {
    font-size: 13px;
    color: #9aa0a6;
    margin-bottom: 24px;
    line-height: 1.5;
}
.homepage-mode .filters { display: none; }
.homepage-mode .search-header .logo { display: none; }
.results-mode > .search-page > h1.logo,
.results-mode > .search-page > .tagline,
.results-mode > .search-page > .promise {
    display: none;
}

/* Example query chips */
.example-queries-label {
    font-size: 12px;
    color: #9aa0a6;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 28px;
    margin-bottom: 12px;
    text-align: center;
}
.example-queries {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
}
.example-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 20px;
    font-size: 13px;
    color: #5f6368;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.example-chip::before {
    content: '\f002';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: #9aa0a6;
    transition: color 0.2s;
}
.example-chip:hover {
    background: #e8f0fe;
    border-color: #d2e3fc;
    color: #1a73e8;
}
.example-chip:hover::before { color: #4285f4; }

/* Trust footer */
.trust-footer {
    font-size: 12px;
    color: #9aa0a6;
    margin-top: 4px;
    letter-spacing: 0.2px;
}
.trust-footer a {
    color: #9aa0a6;
    text-decoration: underline;
    text-decoration-color: #dadce0;
    text-underline-offset: 2px;
}
.trust-footer a:hover {
    color: #5f6368;
    text-decoration-color: #9aa0a6;
}

/* --- Loading & spinner states --- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-results {
    text-align: center;
    padding: 40px;
    color: #64748b;
}
.results-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 80px;
    height: 100%;
    color: #64748b;
    gap: 12px;
    animation: fadeInLoader 0.2s ease;
}
@keyframes fadeInLoader {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.spinner-large {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.results-loading .loading-text { font-size: 14px; color: #94a3b8; }

/* --- Error state --- */
.results-error {
    text-align: center;
    padding: 40px 20px;
    color: #c5221f;
}
.results-error .error-icon { font-size: 32px; margin-bottom: 12px; }
.results-error .error-message { font-size: 15px; margin-bottom: 16px; }
.results-error .error-retry {
    padding: 8px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}
.results-error .error-retry:hover { background: #2563eb; }
