/* ============================================
   Search Modal/Overlay
   Popup Search Interface
   ============================================ */

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-overlay.active {
    display: block;
    opacity: 1;
}

/* Search Container */
.search-modal-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 2rem;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-overlay.active .search-modal-container {
    transform: translateY(0);
}

/* Search Header */
.search-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-modal-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.search-modal-close:hover {
    background: #e5e7eb;
    transform: rotate(90deg);
}

.search-modal-close i {
    font-size: 20px;
    color: #6b7280;
}

/* Search Input */
.search-modal-input-wrapper {
    flex: 1;
    position: relative;
}

.search-modal-input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.5rem;
    border: 3px solid #e5e7eb;
    border-radius: 50px;
    font-size: 1.125rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.search-modal-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.search-modal-input::placeholder {
    color: #9ca3af;
}

.search-modal-submit {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-modal-submit:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.search-modal-submit i {
    font-size: 18px;
}

/* Search Filters */
.search-modal-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-filter-chip {
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-filter-chip:hover {
    background: #e5e7eb;
}

.search-filter-chip.active {
    background: white;
    border-color: #667eea;
    color: #667eea;
}

/* Quick Suggestions */
.search-suggestions {
    margin-bottom: 2rem;
}

.search-suggestions-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.search-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-suggestion-item {
    padding: 0.5rem 1rem;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-suggestion-item:hover {
    background: #f3f4f6;
    color: #667eea;
}

.search-suggestion-item i {
    font-size: 0.85rem;
    opacity: 0.6;
}

/* Search Results */
.search-results {
    max-height: 60vh;
    overflow-y: auto;
}

.search-results-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.search-result-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.search-result-item:hover {
    background: #f9fafb;
    border-color: #667eea;
    transform: translateX(4px);
}

.search-result-cover {
    width: 60px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    flex-shrink: 0;
}

.search-result-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-author {
    font-size: 0.85rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.search-result-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.search-result-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Empty State */
.search-empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.search-empty-state i {
    font-size: 3rem;
    color: #cbd5e0;
    margin-bottom: 1rem;
}

.search-empty-state h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.search-empty-state p {
    font-size: 0.95rem;
    color: #718096;
}

/* Loading State */
.search-loading {
    text-align: center;
    padding: 2rem;
}

.search-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.search-loading-text {
    font-size: 0.9rem;
    color: #9ca3af;
}

/* Mobile Optimizations */
@media (max-width: 767px) {
    .search-modal-container {
        padding: 1.5rem;
    }

    .search-modal-header {
        margin-bottom: 1.5rem;
    }

    .search-modal-input {
        font-size: 1rem;
        padding: 0.875rem 3rem 0.875rem 1.25rem;
    }

    .search-modal-close {
        width: 40px;
        height: 40px;
    }

    .search-modal-submit {
        width: 40px;
        height: 40px;
    }

    .search-modal-filters {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .search-filter-chip {
        padding: 0.4rem 0.875rem;
        font-size: 0.85rem;
    }

    .search-result-item {
        padding: 0.875rem;
    }

    .search-result-cover {
        width: 50px;
        height: 70px;
    }

    .search-result-title {
        font-size: 0.9rem;
    }

    .search-result-author {
        font-size: 0.8rem;
    }
}

/* Keyboard Navigation */
.search-result-item:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Prevent Body Scroll */
body.search-modal-open {
    overflow: hidden;
}

/* Smooth Scrollbar */
.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}