/* Global Search Feature Styles */

/* Overlay wrapper */
#globalSearchOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 25, 0.85); /* Premium dark tint */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 8vh 0;
    overflow-y: auto;
}

#globalSearchOverlay.active {
    opacity: 1;
    visibility: visible;
}

/* Close Button */
.search-close-btn {
    position: fixed;
    top: 10px;
    right: 15px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.search-close-btn:hover {
    color: #fff;
    transform: rotate(90deg);
    background: rgba(255, 255, 255, 0.15);
}

/* Inner Container */
.search-container {
    width: 90%;
    max-width: 800px;
    transform: translateY(-20px) scale(0.98);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

#globalSearchOverlay.active .search-container {
    transform: translateY(0) scale(1);
}

/* Input Box */
.search-box-wrap {
    position: relative;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 12px;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
}

.search-box-wrap:focus-within {
    border-color: #f7a500; /* CIT Theme Gold/Orange accent */
}

.search-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-size: 2.4rem;
    font-weight: 500;
    color: #fff;
    padding-right: 50px;
    font-family: "Mona Sans", "Inter", sans-serif;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-icon-inside {
    position: absolute;
    right: 15px;
    top: 10px;
    color: #f7a500;
    font-size: 1rem;
    pointer-events: none;
    transition: color 0.3s ease;
}

.search-box-wrap:focus-within .search-icon-inside {
    color: #f7a500;
}

/* Loader Spinner */
.search-loader {
    display: none;
    text-align: center;
    padding: 30px 0;
}

.search-loader .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #f7a500;
    animation: search-spin 1s linear infinite;
    display: inline-block;
}

@keyframes search-spin {
    to { transform: rotate(360deg); }
}

/* Live Results container */
.search-results-preview {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
    display: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.search-results-preview.show {
    display: block;
    animation: search-fade-in 0.3s ease forwards;
}

@keyframes search-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar for results preview */
.search-results-preview::-webkit-scrollbar {
    width: 6px;
}
.search-results-preview::-webkit-scrollbar-track {
    background: transparent;
}
.search-results-preview::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.search-results-preview::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Results Categories */
.search-category-section {
    margin-bottom: 25px;
}

.search-category-section:last-child {
    margin-bottom: 0;
}

.search-category-title {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #f7a500; /* Theme Gold */
    margin-bottom: 12px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Result Items */
.search-result-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    text-decoration: none !important;
    transition: background-color 0.2s ease, transform 0.2s ease;
    background: rgba(255, 255, 255, 0.02);
}

.search-result-item:hover, .search-result-item.highlighted {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
    outline: none;
}

.search-result-icon {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
    margin-right: 15px;
    margin-top: 2px;
    width: 20px;
    text-align: center;
}

.search-result-item:hover .search-result-icon, 
.search-result-item.highlighted .search-result-icon {
    color: #f7a500;
}

.search-result-content {
    flex: 1;
}

.search-result-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 3px;
    line-height: 1.4;
}

.search-result-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
}

.search-result-meta {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 4px;
}

/* Match highlighting */
.search-match-highlight {
    background: rgba(247, 165, 0, 0.25);
    color: #ffc44d;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* See All Results link */
.search-see-all {
    display: block;
    text-align: center;
    padding: 15px 0 0;
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.search-see-all a {
    color: #f7a500;
    font-weight: 600;
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.search-see-all a:hover {
    color: #fff;
}

/* Empty State */
.search-no-results {
    text-align: center;
    padding: 40px 0;
    color: rgba(255, 255, 255, 0.6);
}

.search-no-results i {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 15px;
    display: block;
}

/* Tip Footer inside search */
.search-tip-footer {
    text-align: center;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.85rem;
}

.search-tip-footer kbd {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: inherit;
    font-size: 0.75rem;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

/* Header Trigger Button */
.global-search-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: #00003c;
    background: #f6b900 !important;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 15px;
}

.global-search-trigger:hover {
    background: #00003c;
    color: #fff;
    border-color: #00003c;
    transform: scale(1.05);
}

/* Responsive fixes */
@media (max-width: 1199px) {
    .global-search-trigger {
        margin-right: 10px;
        width: 40px;
        height: 40px;
    }
}
