/**
 * Search System Styles
 * Global search overlay and results
 */

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

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.search-overlay.hidden {
    display: none;
    opacity: 0;
}

.search-overlay.entering {
    animation: fadeIn 0.3s ease;
}

.search-overlay.exiting {
    animation: fadeOut 0.2s ease;
}

.search-content {
    width: 90%;
    max-width: 800px;
    background: var(--bg-primary);
    border: 3px solid var(--border-color);
    padding: 0;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* ========================================
   SEARCH HEADER
   ======================================== */

.search-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-primary);
}

.search-input {
    flex: 1;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'Atkinson Hyperlegible', sans-serif;
    font-size: 1.2rem;
    padding: 0.75rem 1rem;
    outline: none;
}

.search-input:focus {
    border-color: var(--text-primary);
    background: var(--bg-primary);
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.close-search {
    background: var(--text-primary);
    border: 2px solid var(--text-primary);
    color: var(--bg-primary);
    font-family: 'Atkinson Hyperlegible', sans-serif;
    font-size: 0.9rem;
    font-weight: bold;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.close-search:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

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

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-primary);
}

.search-result {
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    margin-bottom: 1rem;
    cursor: pointer;
    background: var(--bg-primary);
    transition: all 0.15s ease;
}

.search-result:hover {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

.search-result:hover .result-title,
.search-result:hover .result-description,
.search-result:hover .result-meta {
    color: var(--bg-primary);
}

.search-result:hover .result-type {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--bg-primary);
}

.search-result.selected {
    background: var(--text-primary);
    border-color: var(--text-primary);
    border-width: 3px;
}

.search-result.selected .result-title,
.search-result.selected .result-description,
.search-result.selected .result-meta {
    color: var(--bg-primary);
}

.search-result.selected .result-type {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--bg-primary);
}

.search-result:last-child {
    margin-bottom: 0;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.result-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    opacity: 0.8;
}

.result-description {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
    opacity: 0.9;
}

.result-type {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
    align-self: flex-start;
}

.no-results {
    padding: 3rem;
    text-align: center;
    color: var(--text-primary);
    font-size: 1.1rem;
    opacity: 1;
}

/* ========================================
   SEARCH RESULT HIGHLIGHTS
   ======================================== */

.search-highlight {
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 0 2px;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .search-overlay {
        padding-top: 5vh;
    }

    .search-content {
        width: 95%;
        max-height: 85vh;
    }

    .search-header {
        padding: 1rem;
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        font-size: 1rem;
        padding: 0.6rem 0.8rem;
    }

    .close-search {
        width: 100%;
        text-align: center;
    }

    .search-result {
        padding: 1rem;
    }

    .result-title {
        font-size: 1.1rem;
    }

    .result-description {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .search-overlay {
        padding-top: 2vh;
    }

    .search-content {
        width: 100%;
        max-height: 90vh;
        border-left: none;
        border-right: none;
    }

    .search-header {
        padding: 0.8rem;
    }

    .search-input {
        font-size: 0.95rem;
    }

    .search-result {
        padding: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .result-title {
        font-size: 1rem;
    }

    .result-meta,
    .result-description {
        font-size: 0.85rem;
    }

    .result-type {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

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

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

.search-results::-webkit-scrollbar {
    width: 12px;
}

.search-results::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-left: 2px solid var(--border-color);
}

.search-results::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border: 2px solid var(--bg-primary);
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}
