/**
 * Full-text search results styling
 */

/* Search container */
.search-container {
    position: relative;
    margin-bottom: 10px;
}

/* Search input enhancements */
#nav-search {
    width: 100%;
    box-sizing: border-box;
}

/* Search results dropdown - fixed position to escape nav overflow */
.search-results {
    position: fixed;
    top: 80px;
    left: 10px;
    width: 500px;
    max-width: calc(100vw - 300px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    z-index: 2147483000;
    display: none;
}

/* Filter container */
.search-filter-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Filter tags header */
.search-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.search-filter-label {
    font-size: 11px;
    color: #888;
    margin-right: 4px;
}

/* Filter tag button */
.search-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    background: var(--tag-color, #4a90d9);
    border-radius: 12px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    transition: all 0.15s ease;
    opacity: 1;
}

.search-filter-tag:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.search-filter-tag.hidden {
    background: #e0e0e0;
    color: #999;
    opacity: 0.7;
}

.search-filter-tag.hidden:hover {
    opacity: 0.9;
}

.search-filter-tag-label {
    white-space: nowrap;
}

.search-filter-tag-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.search-filter-tag.hidden .search-filter-tag-count {
    background: rgba(0, 0, 0, 0.1);
}

/* Results body */
.search-results-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Category section */
.search-category {
    margin-bottom: 8px;
}

.search-category:last-child {
    margin-bottom: 0;
}

.search-category.hidden {
    display: none;
}

/* Category header */
.search-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 15px;
    background: #f8f9fa;
    border-left: 3px solid #4a90d9;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-category-title {
    color: #555;
}

.search-category-count {
    color: #999;
    font-size: 10px;
    font-weight: normal;
}

.search-category-more {
    padding: 6px 15px;
    font-size: 11px;
    color: #888;
    text-align: center;
    background: #fafafa;
}

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

/* Individual result item */
.search-result-item {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

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

.search-result-item:hover,
.search-result-item.selected {
    background-color: #f0f7ff;
}

/* Result title */
.search-result-title {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Result content preview */
.search-result-content {
    font-size: 12px;
    color: #777;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

/* Highlighted text */
.search-result-item mark {
    background-color: #fff3cd;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* No results message */
.search-no-results {
    padding: 20px 15px;
    text-align: center;
    color: #666;
    font-size: 13px;
}

/* More results indicator */
.search-more-results {
    padding: 10px 15px;
    text-align: center;
    color: #999;
    font-size: 12px;
    font-style: italic;
    background: #f9f9f9;
}

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

.search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

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

/* Dark mode support (if applicable) */
@media (prefers-color-scheme: dark) {
    .search-results {
        background: #2d2d2d;
        border-color: #444;
    }

    .search-result-item {
        border-bottom-color: #444;
    }

    .search-result-item:hover,
    .search-result-item.selected {
        background-color: #3a3a3a;
    }

    .search-result-title {
        color: #e0e0e0;
    }

    .search-result-content {
        color: #aaa;
    }

    .search-result-item mark {
        background-color: #5a4a00;
        color: #fff;
    }

    .search-no-results {
        color: #999;
    }

    .search-more-results {
        background: #333;
        color: #888;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .search-results {
        max-height: 50vh;
        position: fixed;
        top: auto;
        left: 10px;
        right: 10px;
        bottom: 10px;
        border-radius: 8px;
        border: 1px solid #ddd;
    }

    .search-result-item {
        padding: 15px;
    }

    .search-result-title {
        font-size: 15px;
    }

    .search-result-content {
        font-size: 13px;
    }
}

