/**
 * Sticky Search Overlay
 * Expandable search bar that appears below the header
 */

/* Overlay Container */
.sticky-search-overlay {
    position: fixed;
    top: 56px; /* Start below navbar */
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 1029; /* Below navbar (1030) but above content */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.sticky-search-overlay.active {
    max-height: 200px; /* Adjust based on content */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Wrapper */
.sticky-search-wrapper {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Close Button */
.sticky-search-close {
    flex-shrink: 0;
    background: transparent;
    border: 2px solid var(--bs-gray-300);
    color: var(--bs-gray-600);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    order: 2; /* Place after search form */
}

.sticky-search-close:hover {
    background: var(--bs-danger);
    border-color: var(--bs-danger);
    color: white;
    transform: scale(1.05);
}

.sticky-search-close i {
    font-size: 1.1rem;
}

/* Search Form */
.sticky-search-form {
    flex: 1;
    order: 1;
}

.sticky-search-input-group {
    border: 2px solid var(--bs-gray-300);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bs-light);
    transition: all 0.2s ease;
}

.sticky-search-input-group:focus-within {
    border-color: var(--bs-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1);
}

.sticky-search-input-group .input-group-text {
    background: transparent;
    border: none;
    padding-left: 1.25rem;
    color: var(--bs-gray-500);
    font-size: 1.25rem;
}

.sticky-search-input {
    background: transparent;
    border: none;
    padding: 0.875rem 0.5rem;
    font-size: 1rem;
    box-shadow: none !important;
}

.sticky-search-input:focus {
    outline: none;
    box-shadow: none !important;
}

.sticky-search-input::placeholder {
    color: var(--bs-gray-500);
}

.sticky-search-input-group .btn {
    border: none;
    padding: 0.875rem 1.75rem;
    font-weight: 600;
    background: var(--bs-primary);
    transition: all 0.2s ease;
}

.sticky-search-input-group .btn:hover {
    background: #0056b3;
}

/* Search Hint - Removed */

/* Header Search Toggle Button */
#headerSearchToggle {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

#headerSearchToggle:hover {
    color: rgba(255, 255, 255, 1) !important;
    text-shadow: 0 0 20px rgba(13, 110, 253, 0.8),
                 0 0 30px rgba(13, 110, 253, 0.6),
                 0 0 40px rgba(13, 110, 253, 0.4);
}

#headerSearchToggle i {
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

#headerSearchToggle:hover i {
    filter: drop-shadow(0 0 8px rgba(13, 110, 253, 0.8))
            drop-shadow(0 0 12px rgba(13, 110, 253, 0.6));
}

/* Glow effect for all nav-links */
.modern-header .nav-link:hover,
.modern-header .nav-link:focus {
    color: #ffffff !important;
    text-shadow: 0 0 20px rgba(13, 110, 253, 0.8),
                 0 0 30px rgba(13, 110, 253, 0.6),
                 0 0 40px rgba(13, 110, 253, 0.4);
}

.modern-header .nav-link:hover i,
.modern-header .nav-link:focus i {
    filter: drop-shadow(0 0 8px rgba(13, 110, 253, 0.8))
            drop-shadow(0 0 12px rgba(13, 110, 253, 0.6));
}

/* Dark Mode Support */
[data-bs-theme="dark"] .sticky-search-overlay {
    background: var(--bs-dark);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .sticky-search-input-group {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .sticky-search-input-group:focus-within {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--bs-primary);
}

[data-bs-theme="dark"] .sticky-search-input {
    color: white;
}

[data-bs-theme="dark"] .sticky-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

[data-bs-theme="dark"] .sticky-search-close {
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

[data-bs-theme="dark"] .sticky-search-close:hover {
    background: var(--bs-danger);
    border-color: var(--bs-danger);
    color: white;
}

/* Responsive Design */
@media (max-width: 991.98px) {
    /* Hide sticky search on mobile - use existing mobile search instead */
    .sticky-search-overlay {
        display: none !important;
    }
}

/* Original Responsive Design */
@media (max-width: 991.98px) {
    .sticky-search-overlay.active {
        transform: translateY(56px); /* Adjust for mobile navbar height */
    }
    
    .sticky-search-wrapper {
        padding: 1rem 0.5rem;
    }
    
    .sticky-search-input-group .btn {
        padding: 1rem 1.5rem;
    }
    
    .sticky-search-input {
        font-size: 1rem;
    }
}

@media (max-width: 767.98px) {
    .sticky-search-input-group .btn {
        padding: 1rem 1rem;
    }
    
    .sticky-search-input-group .btn span {
        display: none;
    }
    
    .sticky-search-input-group .btn i {
        margin: 0 !important;
    }
    
}

/* Prevent body scroll when search is open */
body.search-overlay-open {
    overflow: hidden;
}

/* Backdrop */
.sticky-search-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1028;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sticky-search-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Focus styles */
.sticky-search-input:focus {
    outline: 3px solid rgba(255, 255, 255, 0.3);
    outline-offset: -3px;
}

/* Loading state */
.sticky-search-input-group.loading .btn {
    pointer-events: none;
    opacity: 0.7;
}

.sticky-search-input-group.loading .btn i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
