/* Search Modal Styles */
.search-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
}

.search-modal.active {
    display: flex;
}

.search-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 42rem;
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideDown 0.3s ease-out;
    margin-top: 2rem;
}

@media (min-width: 768px) {
    .search-container {
        margin-top: 4rem;
    }
}

.search-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: var(--bg-gray);
    border-radius: 0.5rem;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.search-input-wrapper:focus-within {
    background-color: white;
    border-color: var(--primary);
}

.search-icon {
    color: var(--text-gray);
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 1rem;
    color: var(--text-dark);
    outline: none;
    font-family: var(--font-sans);
}

.search-input::placeholder {
    color: var(--text-gray);
}

.search-close {
    padding: 0.25rem;
    border-radius: 0.25rem;
    color: var(--text-gray);
    transition: all 0.2s;
    flex-shrink: 0;
}

.search-close:hover {
    background-color: #e5e7eb;
    color: var(--text-dark);
}

.search-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-gray);
}

.search-hint kbd {
    padding: 0.125rem 0.375rem;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.search-results {
    max-height: 28rem;
    overflow-y: auto;
    padding: 1rem;
}

.search-results::-webkit-scrollbar {
    width: 0.5rem;
}

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

.search-results::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 0.25rem;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.search-empty,
.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-gray);
}

.search-empty p,
.search-loading p {
    margin-top: 1rem;
}

.search-category {
    margin-bottom: 1.5rem;
}

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

.search-category-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-gray);
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.search-category-results {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    cursor: pointer;
}

.search-result-item:hover {
    background-color: var(--indigo-50);
}

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

.search-result-title {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-description {
    font-size: 0.875rem;
    color: var(--text-gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-arrow {
    color: var(--text-gray);
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    opacity: 0;
    transform: translateX(-0.5rem);
    transition: all 0.2s;
}

.search-result-item:hover .search-result-arrow {
    opacity: 1;
    transform: translateX(0);
}

.search-result-title mark,
.search-result-description mark {
    background-color: var(--accent-sec);
    color: var(--indigo-900);
    padding: 0.125rem 0.25rem;
    border-radius: 0.125rem;
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-2rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .search-modal {
        padding: 0;
    }

    .search-container {
        margin-top: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    .search-results {
        max-height: calc(100vh - 10rem);
    }
}