
/* =====================================================
   NOTESREALM - SEARCH SECTION
   Version: 2.0
   Features:
   - Responsive search interface
   - Category filters
   - Popular search suggestions
   - Search result cards
   - Syllabus course code styling
===================================================== */


/* =====================================================
   1. MAIN SEARCH SECTION
===================================================== */

.search-section {
    padding: 75px 20px;
    background: var(--bg);
}

.search-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}


/* =====================================================
   2. SECTION HEADING
===================================================== */

.search-heading {
    max-width: 720px;
    margin: 0 auto 32px;
    text-align: center;
}

.section-eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--secondary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.search-heading h2 {
    margin: 0 0 12px;
    color: var(--text);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    line-height: 1.2;
    font-weight: 800;
}

.search-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
}


/* =====================================================
   3. SEARCH PANEL
===================================================== */

.search-panel {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}


/* =====================================================
   4. SEARCH FORM
===================================================== */

.search-form {
    display: flex;
    align-items: center;
    gap: 12px;

    min-height: 62px;
    padding: 7px 8px 7px 18px;

    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-form:focus-within {
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.10);
}

.search-icon {
    flex: 0 0 auto;
    color: var(--secondary);
    font-size: 1.8rem;
    line-height: 1;
}

.search-form input {
    flex: 1;
    min-width: 0;

    padding: 8px 0;

    border: 0;
    outline: 0;
    background: transparent;

    color: var(--text);
    font-family: inherit;
    font-size: 0.96rem;
}

.search-form input::placeholder {
    color: var(--muted);
    opacity: 0.85;
}

.search-form input::-webkit-search-cancel-button {
    cursor: pointer;
}


/* CLEAR BUTTON */

.search-clear {
    display: inline-flex;
    flex: 0 0 auto;

    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    border: 0;
    border-radius: 50%;

    background: transparent;
    color: var(--muted);

    font-size: 1.4rem;
    cursor: pointer;

    transition: background 0.2s ease;
}

.search-clear:hover {
    background: var(--border);
    color: var(--text);
}

.search-clear[hidden] {
    display: none;
}


/* SEARCH BUTTON */

.search-submit {
    flex: 0 0 auto;

    min-height: 46px;
    padding: 0 25px;

    border: 0;
    border-radius: 9px;

    background: var(--primary);
    color: #ffffff;

    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.search-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}


/* =====================================================
   5. CATEGORY FILTERS
===================================================== */

.search-filter-area {
    margin-top: 25px;
}

.filter-label {
    display: block;
    margin-bottom: 12px;

    color: var(--text);
    font-size: 0.88rem;
    font-weight: 700;
}

.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.search-filter {
    padding: 9px 15px;

    border: 1px solid var(--border);
    border-radius: 30px;

    background: var(--surface);
    color: var(--muted);

    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;

    cursor: pointer;

    transition: all 0.2s ease;
}

.search-filter:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

.search-filter.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}


/* =====================================================
   6. POPULAR SEARCHES
===================================================== */

.popular-searches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;

    margin-top: 25px;
    padding-top: 20px;

    border-top: 1px solid var(--border);
}

.popular-searches > span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.popular-search {
    padding: 5px 11px;

    border: 0;
    border-radius: 6px;

    background: var(--code);
    color: var(--primary);

    font-family: inherit;
    font-size: 0.82rem;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.popular-search:hover {
    background: var(--primary);
    color: #ffffff;
}


/* =====================================================
   7. SEARCH RESULTS SECTION
===================================================== */

.search-results {
    margin-top: 35px;
}

.search-results[hidden] {
    display: none;
}

.search-results-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    margin-bottom: 18px;
}

.search-results-heading h3 {
    margin: 0;

    color: var(--text);
    font-size: 1.25rem;
    font-weight: 750;
}

.search-results-heading span {
    color: var(--muted);
    font-size: 0.85rem;
}


/* =====================================================
   8. SEARCH RESULT GRID
===================================================== */

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}


/* =====================================================
   9. SEARCH RESULT CARD
===================================================== */

.search-result-card {
    min-width: 0;
    padding: 20px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--surface);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.search-result-card:hover {
    transform: translateY(-3px);
    border-color: rgba(8, 145, 178, 0.45);
    box-shadow: var(--shadow);
}


/* RESULT CATEGORY */

.result-category {
    display: inline-block;

    margin-bottom: 10px;
    padding: 5px 9px;

    border-radius: 5px;

    background: var(--code);
    color: var(--secondary);

    font-size: 0.73rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* RESULT TITLE */

.search-result-card h4 {
    margin: 0 0 8px;

    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.4;
    font-weight: 750;
}


/* SYLLABUS COURSE CODE */

.result-course-code {
    display: inline-block;

    margin: 0 0 10px;
    padding: 5px 9px;

    border: 1px solid rgba(8, 145, 178, 0.18);
    border-radius: 5px;

    background: rgba(8, 145, 178, 0.07);
    color: var(--secondary);

    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}


/* RESULT DESCRIPTION */

.search-result-card p:not(.result-course-code) {
    margin: 0;

    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.65;
}


/* =====================================================
   10. EMPTY SEARCH RESULTS
===================================================== */

.search-empty {
    grid-column: 1 / -1;

    padding: 35px 20px;

    border: 1px dashed var(--border);
    border-radius: 12px;

    background: var(--surface);
    color: var(--muted);

    font-size: 0.92rem;
    line-height: 1.6;
    text-align: center;
}


/* =====================================================
   11. TABLET RESPONSIVENESS
===================================================== */

@media (max-width: 767px) {

    .search-section {
        padding: 55px 16px;
    }

    .search-panel {
        padding: 20px;
    }

    .search-results-grid {
        grid-template-columns: 1fr;
    }

}


/* =====================================================
   12. MOBILE RESPONSIVENESS
===================================================== */

@media (max-width: 480px) {

    .search-section {
        padding: 45px 14px;
    }

    .search-heading {
        margin-bottom: 24px;
    }

    .search-heading h2 {
        font-size: 1.8rem;
    }

    .search-heading p {
        font-size: 0.9rem;
    }

    .search-panel {
        padding: 15px;
        border-radius: 13px;
    }

    .search-form {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
    }

    .search-icon {
        font-size: 1.5rem;
    }

    .search-form input {
        font-size: 0.88rem;
    }

    .search-submit {
        width: 100%;
        min-height: 43px;
    }

    .search-filter-area {
        margin-top: 21px;
    }

    .search-filters {
        gap: 7px;
    }

    .search-filter {
        padding: 8px 11px;
        font-size: 0.78rem;
    }

    .popular-searches {
        gap: 8px;
        margin-top: 20px;
    }

    .popular-searches > span {
        width: 100%;
    }

    .search-results {
        margin-top: 25px;
    }

    .search-results-heading h3 {
        font-size: 1.1rem;
    }

    .search-result-card {
        padding: 17px;
    }

}


/* =====================================================
   13. SMALL MOBILE SCREENS
===================================================== */

@media (max-width: 350px) {

    .search-section {
        padding-right: 11px;
        padding-left: 11px;
    }

    .search-panel {
        padding: 12px;
    }

    .search-filter {
        padding: 7px 9px;
        font-size: 0.74rem;
    }

    .search-result-card h4 {
        font-size: 0.98rem;
    }

}


/* =====================================================
   14. ACCESSIBILITY
===================================================== */

.search-section button:focus-visible,
.search-section input:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}


/* REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {

    .search-section *,
    .search-section *::before,
    .search-section *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

}
