/* Enhanced Search Modal Styles - Works with your existing design */
.search-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 12, 36, 0.8);
    backdrop-filter: blur(10px);
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.search-modal-content {
    background: var(--white-color);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #f0f0f0;
    background: var(--gradient-btn);
}

.search-modal-header h3 {
    margin: 0;
    color: var(--white-color);
    font-family: var(--nav-font);
    font-size: 24px;
    font-weight: 400;
}

.search-close {
    color: var(--white-color);
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease;
    user-select: none;
}

.search-close:hover {
    color: rgba(255, 255, 255, 0.8);
}

.search-modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

.search-modal-body::-webkit-scrollbar {
    width: 6px;
}

.search-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.search-modal-body::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 3px;
}

.search-input-container {
    position: relative;
    margin-bottom: 24px;
}

#search-input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    font-size: 16px;
    font-family: var(--nav-font);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: var(--white-color);
}

#search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(38, 170, 225, 0.1);
}

.search-spinner {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-results {
    min-height: 200px;
}

.search-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-border);
}

.search-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--pale-blue);
}

.search-placeholder p {
    font-size: 16px;
    margin: 0;
    font-family: var(--nav-font);
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid var(--pale-blue);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    margin-bottom: 4px;
}

.search-result-item:hover {
    background-color: var(--pale-blue);
    transform: translateX(4px);
}

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

.search-result-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--pale-blue);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
}

.search-result-icon i {
    color: var(--dark-blue);
    font-size: 18px;
}

.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-family: var(--nav-font);
    font-size: 16px;
    font-weight: 500;
    color: var(--navy-color);
    margin: 0 0 4px 0;
    line-height: 1.4;
}

.search-result-excerpt {
    font-size: 14px;
    color: var(--gray-border);
    margin: 0 0 4px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: var(--nav-font);
}

.search-result-meta {
    font-size: 12px;
    color: var(--gray-border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--nav-font);
}

.search-result-type {
    background: var(--accent-color);
    color: var(--white-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 500;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-border);
}

.no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--pale-blue);
}

.no-results p {
    font-family: var(--nav-font);
    font-size: 16px;
    margin: 0;
}

/* Make your existing search icons clickable and add hover effects */
.search_icons a {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.search_icons a:hover {
    transform: scale(1.1);
}

.search_icons a svg {
    transition: all 0.2s ease;
}

.search_icons a:hover svg path {
    fill: var(--accent-color);
    stroke: var(--accent-color);
}

/* Mobile search icon styling */
.search_icon {
    cursor: pointer;
    transition: color 0.2s ease;
}

.search_icon:hover {
    color: var(--accent-color) !important;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .search-modal {
        padding-top: 50px;
    }
    
    .search-modal-content {
        width: 95%;
        margin: 0 auto;
    }
    
    .search-modal-header,
    .search-modal-body {
        padding: 16px;
    }
    
    .search-result-item {
        padding: 12px;
    }
    
    .search-result-icon {
        width: 35px;
        height: 35px;
        margin-right: 12px;
    }
    
    .search-result-title {
        font-size: 15px;
    }
    
    .search-result-excerpt {
        font-size: 13px;
    }
    
    /* Show mobile search icon when needed */
    .search_icon {
        display: block !important;
    }
}

/* Integration with your existing header styles */
@media (max-width: 1199px) {
    /* Mobile navigation active state */
    .mobile-nav-active .search_icon {
        color: var(--white-color);
    }
}

/* Dark mode compatibility if you add it later */
[data-bs-theme="dark"] .search-modal-content {
    background: var(--navy-color);
    color: var(--white-color);
}

[data-bs-theme="dark"] #search-input {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--white-color);
}

[data-bs-theme="dark"] .search-result-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}