/* ==========================================================================
   Search Modal
   ========================================================================== */
.search-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}
.search-modal.active {
    display: flex;
}
.search-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}
.search-modal-content {
    position: relative;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 640px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: searchSlideDown 0.2s ease;
}
@keyframes searchSlideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header / Input */
.search-modal-header {
    padding: 0;
    border-bottom: 1px solid #eee;
}
.search-input-wrap {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    gap: 0.75rem;
}
.search-input-wrap > i {
    color: var(--text-light);
    font-size: 1.1rem;
}
.search-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.05rem;
    font-family: inherit;
    color: var(--text-dark);
}
.search-input-wrap input::placeholder {
    color: #bbb;
}
.search-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 1.1rem;
    padding: 0.25rem;
}
.search-close-btn:hover {
    color: var(--text-dark);
}

/* Tags */
.search-tags {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    overflow-x: auto;
}
.tag-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}
.tag-group-label {
    font-size: 0.75rem;
    color: var(--text-light);
    min-width: 50px;
    font-weight: 600;
}
.tag-chip {
    background: var(--bg-light);
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 0.2rem 0.7rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-dark);
    transition: all 0.15s ease;
    font-family: inherit;
}
.tag-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.tag-chip.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* Selected Tags */
.search-selected-tags {
    padding: 0 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.search-selected-tags:not(:empty) {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}
.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--primary-color);
    color: var(--white);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}
.selected-tag button {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}

/* Results */
.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}
.search-empty, .search-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}
.search-loading i {
    margin-right: 0.5rem;
}
.search-result-card {
    display: block;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
}
.search-result-card:hover {
    background: var(--bg-light);
}
.search-result-card h3 {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.3rem;
}
.search-result-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .search-modal {
        padding-top: 0;
    }
    .search-modal-content {
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
        width: 100%;
    }
}
