/**
 * ===================================
 * SEARCH SYSTEM STYLES
 * Comprehensive styling for search overlay and results page
 * ===================================
 */

/* ===================================
   SEARCH OVERLAY STYLES
   ================================== */

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.search-overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(62, 162, 191, 0.95), rgba(141, 182, 63, 0.85));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    height: 100vh;
    overflow-y: auto;
    transform: translateY(-30px);
    transition: transform 0.3s ease;
}

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

/* ===================================
   SEARCH HEADER (OVERLAY)
   ================================== */

.search-header {
    position: relative;
    margin-top: 8vh;
    margin-bottom: 2rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    /* box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15); */
    /* border: 2px solid rgba(255, 255, 255, 0.2); */
    transition: all 0.3s ease;
}

/* .search-input-wrapper:focus-within {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
} */

.search-icon {
    position: absolute;
    left: 24px;
    color: #3EA2BE;
    font-size: 1.5rem;
    z-index: 2;
    transition: color 0.3s ease;
}

.search-input-wrapper:focus-within .search-icon {
    color: #2B7A8F;
}

#globalSearchInput {
    width: 100%;
    padding: 24px 80px 24px 70px;
    font-size: 1.5rem;
    font-weight: 400;
    border: none;
    background: transparent;
    outline: none;
    color: #2d3748;
    font-family: 'Manrope', sans-serif;
}

#globalSearchInput::placeholder {
    color: #94a3b8;
    font-weight: 300;
}

.search-close {
    position: absolute;
    right: 20px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.search-close:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    transform: rotate(90deg);
}

/* ===================================
   SEARCH SUGGESTIONS (OVERLAY)
   ================================== */

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    max-height: 300px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 10;
}

.search-suggestions.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

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

.suggestion-item:hover,
.suggestion-item.selected {
    background: #f8fafc;
    color: #3EA2BE;
}

.suggestion-item i {
    margin-right: 12px;
    color: #94a3b8;
    width: 16px;
    text-align: center;
}

.suggestion-item:hover i,
.suggestion-item.selected i {
    color: #3EA2BE;
}

/* ===================================
   SEARCH CONTENT (OVERLAY)
   ================================== */

.search-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 60vh;
    overflow: hidden;
}

/* Search Empty State */
.search-empty {
    display: none;
    padding: 4rem 2rem;
    text-align: center;
}

.search-empty.active,
.search-empty[style*="block"] {
    display: block;
}

.search-empty-content i {
    font-size: 4rem;
    color: #cbd5e0;
    margin-bottom: 1.5rem;
}

.search-empty-content h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.search-empty-content > p {
    font-size: 1.1rem;
    color: #4a5568;
    margin-bottom: 2rem;
}

.search-examples {
    margin-bottom: 3rem;
}

.search-examples p {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 1rem;
}

.search-example-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.search-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3EA2BE, #2B7A8F);
    color: white;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.search-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(62, 162, 190, 0.3);
    text-decoration: none;
    color: white;
}

/* Search Loading */
.search-loading {
    display: none;
    padding: 4rem 2rem;
    text-align: center;
}

.search-loading.active,
.search-loading[style*="block"] {
    display: block;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1.5rem;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #3EA2BE;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.search-loading p {
    color: #4a5568;
    font-size: 1.1rem;
}

/* ===================================
   SEARCH RESULTS PAGE STYLES
   ================================== */

.page-search .search-layout {
    max-width: 1000px;
    margin: 0 auto;
}

.search-form-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    padding: 2rem;
    margin-bottom: 2rem;
}

.search-form .search-input-group {
    margin-bottom: 1.5rem;
}

.search-form .search-input-wrapper {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.search-form .search-input-wrapper:focus-within {
    background: white;
    border-color: #3EA2BE;
    box-shadow: 0 0 0 3px rgba(62, 162, 190, 0.15);
}

.search-form .search-input {
    width: 100%;
    padding: 1rem 60px 1rem 50px;
    font-size: 1.1rem;
    border: none;
    background: transparent;
    outline: none;
    color: #2d3748;
}

.search-form .search-icon {
    left: 18px;
    font-size: 1.2rem;
}

.search-submit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #3EA2BE;
    border: none;
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-submit:hover {
    background: #2B7A8F;
    transform: translateY(-50%) scale(1.05);
}

/* ===================================
   SEARCH FILTERS
   ================================== */

.search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.filter-group select {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.95rem;
    color: #2d3748;
    transition: all 0.2s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #3EA2BE;
    box-shadow: 0 0 0 3px rgba(62, 162, 190, 0.15);
}

.filter-apply-btn {
    padding: 0.75rem 1.5rem;
    background: #3EA2BE;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    height: fit-content;
}

.filter-apply-btn:hover {
    background: #2B7A8F;
    transform: translateY(-2px);
}

/* ===================================
   SEARCH EMPTY STATES (PAGE)
   ================================== */

.search-empty-state,
.search-no-results {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    padding: 4rem 2rem;
    text-align: center;
}

.search-empty-content i,
.no-results-content i {
    font-size: 4rem;
    color: #cbd5e0;
    margin-bottom: 1.5rem;
    display: block;
}

.search-empty-content h2,
.no-results-content h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.search-empty-content > p,
.no-results-content > p {
    font-size: 1.1rem;
    color: #4a5568;
    margin-bottom: 2.5rem;
}

.search-examples,
.search-suggestions,
.alternative-searches {
    margin-bottom: 2.5rem;
}

.search-examples h3,
.search-suggestions h3,
.alternative-searches h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
}

.search-suggestions ul {
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
    color: #4a5568;
    line-height: 1.6;
}

.search-suggestions li {
    margin-bottom: 0.5rem;
}

.search-suggestions a {
    color: #3EA2BE;
    text-decoration: none;
}

.search-suggestions a:hover {
    text-decoration: underline;
}

.search-shortcuts {
    margin-top: 2rem;
}

.shortcut-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.shortcut-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-decoration: none;
    color: #4a5568;
    transition: all 0.3s ease;
}

.shortcut-link:hover {
    background: white;
    border-color: #3EA2BE;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: #3EA2BE;
}

.shortcut-link i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: #3EA2BE;
}

/* ===================================
   SEARCH RESULTS
   ================================== */

.search-results-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.search-summary {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.results-count {
    margin: 0;
    color: #4a5568;
    font-size: 1rem;
}

.search-time {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.search-results {
    padding: 0;
}

.search-result {
    display: flex;
    align-items: flex-start;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.3s ease;
}

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

.search-result:hover {
    background: #f8fafc;
}

.result-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3EA2BE, #2B7A8F);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
    margin-top: 0.25rem;
}

.result-icon i {
    color: white;
    font-size: 1.1rem;
}

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

.result-header {
    margin-bottom: 0.75rem;
}

.result-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
}

.result-title a {
    color: #2d3748;
    text-decoration: none;
    transition: color 0.3s ease;
}

.result-title a:hover {
    color: #3EA2BE;
    text-decoration: underline;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.result-type,
.result-category,
.result-date {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: #f1f5f9;
    color: #4a5568;
}

.result-type {
    background: linear-gradient(135deg, #3EA2BE, #2B7A8F);
    color: white;
}

.result-category {
    background: #e0f2fe;
    color: #0369a1;
}

.result-excerpt {
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
}

.result-excerpt mark {
    background: rgba(62, 162, 190, 0.2);
    color: #2B7A8F;
    padding: 0.1em 0.2em;
    border-radius: 3px;
    font-weight: 600;
}

/* ===================================
   SEARCH PAGINATION
   ================================== */

.search-pagination {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: #4a5568;
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 0.9rem;
}

.pagination-btn:hover {
    background: #3EA2BE;
    border-color: #3EA2BE;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.pagination-btn.active {
    background: #3EA2BE;
    border-color: #3EA2BE;
    color: white;
}

.pagination-ellipsis {
    padding: 0.5rem;
    color: #94a3b8;
}

/* ===================================
   OVERLAY FILTERS (IN SEARCH OVERLAY)
   ================================== */

.search-results-container .search-filters {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.search-results-container .search-meta {
    display: flex;
    align-items: center;
    margin-left: auto;
}

#searchResultsCount {
    color: #4a5568;
    font-weight: 500;
    font-size: 0.9rem;
}

/* ===================================
   ERROR STATES
   ================================== */

.search-error,
.no-results {
    text-align: center;
    padding: 3rem 2rem;
    color: #4a5568;
}

.search-error i,
.no-results i {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
    display: block;
}

.search-error h3,
.no-results h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 0.5rem;
}

/* ===================================
   RESPONSIVE DESIGN
   ================================== */

@media (max-width: 768px) {
    .search-container {
        padding: 1rem;
    }
    
    .search-header {
        margin-top: 5vh;
    }
    
    #globalSearchInput {
        font-size: 1.2rem;
        padding: 20px 60px 20px 50px;
    }
    
    .search-form-container {
        padding: 1.5rem;
    }
    
    .search-filters {
        grid-template-columns: 1fr;
    }
    
    .search-result {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .result-icon {
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .search-pagination {
        flex-direction: column;
        text-align: center;
    }
    
    .pagination-controls {
        justify-content: center;
    }
    
    .shortcut-links {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .search-example-tags {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .search-container {
        padding: 0.5rem;
    }
    
    #globalSearchInput {
        font-size: 1.1rem;
        padding: 18px 50px 18px 45px;
    }
    
    .search-icon {
        left: 18px;
        font-size: 1.2rem;
    }
    
    .search-close {
        right: 15px;
        font-size: 1.3rem;
    }
    
    .search-empty-state,
    .search-no-results {
        padding: 2rem 1rem;
    }
    
    .shortcut-links {
        grid-template-columns: 1fr;
    }
    
    .search-result {
        padding: 1rem;
    }
}

/* ===================================
   ACCESSIBILITY IMPROVEMENTS
   ================================== */

.search-overlay:focus-within .search-suggestions {
    outline: 2px solid #3EA2BE;
    outline-offset: 2px;
}

.suggestion-item:focus {
    outline: 2px solid #3EA2BE;
    outline-offset: -2px;
    background: #f8fafc;
}

.pagination-btn:focus {
    outline: 2px solid #3EA2BE;
    outline-offset: 2px;
}

.search-tag:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* ===================================
   PERFORMANCE OPTIMIZATIONS
   ================================== */

.search-overlay,
.search-container,
.search-results {
    will-change: transform, opacity;
}

.search-result {
    contain: layout;
}

/* ===================================
   HIGHLIGHT STYLES
   ================================== */

mark {
    background: rgba(62, 162, 190, 0.25);
    color: #2B7A8F;
    padding: 0.1em 0.2em;
    border-radius: 3px;
    font-weight: 600;
}

.result-title mark {
    background: rgba(62, 162, 190, 0.3);
    color: #1a365d;
}

/* ===================================
   ANIMATION CLASSES
   ================================== */

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-up {
    animation: slideUp 0.3s ease;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}