/* ============================================================
   Global Live Search — Dropdown Styles
   Dr. Ambedkar College
   ============================================================ */

/* ── Wrapper (positioning context) ───────────────────────── */
.search-wrapper {
    position: relative;
}

/* ── Dropdown container ──────────────────────────────────── */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    min-width: 280px;
    z-index: 1060;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── Result list ─────────────────────────────────────────── */
.search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── Individual result item ──────────────────────────────── */
.search-result-item {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    transition: background-color 0.15s ease;
    min-height: 44px; /* touch target */
    justify-content: center;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
    background-color: #e8edf5;
}

.search-result-item.active {
    border-left: 3px solid #1a237e;
    padding-left: 11px;
}

/* ── Title ───────────────────────────────────────────────── */
.search-result-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #212529;
    line-height: 1.3;
    padding-right: 90px; /* room for badge */
}

/* ── Excerpt ─────────────────────────────────────────────── */
.search-result-excerpt {
    font-size: 0.78rem;
    color: #6c757d;
    margin-top: 2px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Section badge ───────────────────────────────────────── */
.search-result-badge {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.68rem;
    color: #1a237e;
    background: #e8eaf6;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 85px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Loading spinner ─────────────────────────────────────── */
.search-loading {
    padding: 16px 14px;
    text-align: center;
    color: #6c757d;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.search-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #dee2e6;
    border-top-color: #1a237e;
    border-radius: 50%;
    animation: search-spin 0.6s linear infinite;
}

@keyframes search-spin {
    to { transform: rotate(360deg); }
}

/* ── No results ──────────────────────────────────────────── */
.search-no-results {
    padding: 16px 14px;
    text-align: center;
    color: #6c757d;
    font-size: 0.85rem;
    font-style: italic;
}

/* ── Scrollbar styling ───────────────────────────────────── */
.search-results-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-results-dropdown::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 0 0.375rem 0.375rem 0;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 3px;
}

.search-results-dropdown::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 767px) {
    .search-results-dropdown {
        position: fixed;
        left: 12px;
        right: 12px;
        top: auto;
        min-width: unset;
        max-height: 50vh;
        border-radius: 0.5rem;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    }

    .search-result-item {
        padding: 12px 14px;
    }

    .search-result-title {
        font-size: 0.95rem;
        padding-right: 80px;
    }

    .search-result-excerpt {
        font-size: 0.82rem;
    }

    .search-result-badge {
        font-size: 0.7rem;
        right: 12px;
    }
}

@media (max-width: 480px) {
    .search-results-dropdown {
        left: 8px;
        right: 8px;
        max-height: 45vh;
    }

    .search-result-item {
        padding: 11px 10px;
    }

    .search-result-title {
        font-size: 0.9rem;
        padding-right: 70px;
    }

    .search-result-badge {
        font-size: 0.65rem;
        right: 8px;
        max-width: 65px;
    }
}
