/* --- Search Trigger Button in Nav --- */
.nav-search-btn {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    margin-left: 10px;
    outline: none;
}

.nav-search-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
}

.nav-search-btn svg {
    flex-shrink: 0;
}

/* --- Search Modal Overlay --- */
.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 70px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.search-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- Search Modal Card --- */
.search-modal-card {
    background: #ffffff;
    border-radius: 12px;
    width: 90%;
    max-width: 680px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transform: translateY(-10px);
    transition: transform 0.2s ease;
}

.search-modal-overlay.active .search-modal-card {
    transform: translateY(0);
}

/* --- Search Input Header --- */
.search-modal-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    gap: 12px;
}

.search-icon-svg {
    color: #64748b;
    flex-shrink: 0;
}

.search-modal-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.05rem;
    background: transparent;
    color: #1e293b;
    font-family: inherit;
}

.search-modal-input::placeholder {
    color: #94a3b8;
}

.search-clear-btn,
.search-close-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.search-clear-btn:hover,
.search-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* --- Results Stats Header --- */
.search-stats-bar {
    padding: 8px 20px;
    font-size: 0.85rem;
    color: #64748b;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
}

/* --- Results List Container --- */
.search-results-container {
    overflow-y: auto;
    padding: 12px 16px;
    flex: 1;
    max-height: 60vh;
}

/* --- Search Result Item --- */
.search-result-item {
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    background: #ffffff;
    transition: all 0.15s ease;
}

.search-result-item:hover {
    background-color: #f0f7ff;
    border-color: #004a91;
    box-shadow: 0 2px 6px rgba(0, 74, 145, 0.08);
}

.search-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.search-result-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background-color: #e0f2fe;
    color: #0369a1;
    display: inline-block;
}

.search-result-title {
    font-size: 1rem;
    font-weight: 600;
    color: #004a91;
    margin: 0;
}

.search-result-snippet {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.4;
    margin: 0;
}

/* --- Highlight Mark --- */
mark.search-highlight {
    background-color: #fef08a;
    color: #854d0e;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}

/* --- Empty / Initial States --- */
.search-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.search-empty-state svg {
    margin-bottom: 12px;
    color: #cbd5e1;
}

/* --- Target Element Flash Highlight --- */
@keyframes searchTargetFlash {
    0% {
        background-color: #fef08a;
        box-shadow: 0 0 0 4px #fde047;
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

.search-flash-target {
    animation: searchTargetFlash 2.5s ease-out;
    border-radius: 4px;
}

/* --- Responsive Adjustments --- */
@media (max-width: 640px) {
    .search-modal-overlay {
        padding-top: 20px;
    }
    .search-modal-card {
        width: 95%;
        max-height: 90vh;
    }
}
