/* ==========================================================================
   Professional Search Feature Styles
   ========================================================================== */

/* --- Search Toggle Button in Header --- */
.search-toggle-button {
    background: transparent;
    border: none;
    color: var(--header-text-light); /* Assuming you have these variables */
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.search-toggle-button:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

html.dark-mode .search-toggle-button {
    color: var(--header-text-dark);
}

/* --- Full-Screen Search Overlay --- */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 24, 39, 0.98); /* Dark, semi-transparent background */
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4rem 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.05);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
}

.search-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.search-overlay-content {
    width: 100%;
    max-width: 700px;
    position: relative;
    animation: fadeInDown 0.4s ease forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Close Button --- */
.search-close-button {
    position: absolute;
    top: -2.5rem;
    right: -1rem;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

.search-close-button:hover {
    color: #ffffff;
    transform: rotate(90deg);
}

/* --- Search Form within Overlay --- */
.search-label {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 1.5rem;
    text-align: center;
}

.search-input-wrapper {
    position: relative;
}

.search-field-overlay {
    width: 100%;
    background-color: transparent;
    border: 0;
    border-bottom: 2px solid #4b5563;
    color: #ffffff;
    font-size: 2rem;
    font-weight: 300;
    padding: 0.5rem 0;
    text-align: center;
    transition: border-color 0.3s ease;
}

.search-field-overlay:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-field-overlay::placeholder {
    color: #6b7280;
}

/* --- AJAX Spinner --- */
.search-spinner {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* --- Search Results Container --- */
.search-results-container {
    margin-top: 2.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.search-result-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.result-thumbnail {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
}

.result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-thumbnail.placeholder {
    background-color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.result-thumbnail.placeholder svg {
    width: 24px;
    height: 24px;
}

.result-content {
    min-width: 0;
}

.result-title {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-excerpt {
    color: #9ca3af;
    font-size: 0.9rem;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}