/* ============================================
   Search Modal
   ============================================ */
.search-modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}

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

.search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.search-modal__content {
    position: relative;
    width: 90%;
    max-width: 900px;
    background: var(--apple-bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--apple-border);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.search-modal__header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    border-bottom: 1px solid var(--apple-border);
}

.search-modal__input {
    flex: 1;
    background: var(--apple-bg-tertiary);
    border: 1px solid var(--apple-border);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-size: 17px;
    color: var(--apple-text-primary);
    outline: none;
    transition: all var(--transition-base);
}

.search-modal__input:focus {
    border-color: var(--apple-accent);
    box-shadow: 0 0 0 3px var(--apple-accent-glow);
}

.search-modal__input::placeholder {
    color: var(--apple-text-tertiary);
}

.search-modal__close {
    background: transparent;
    border: none;
    color: var(--apple-text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-base);
}

.search-modal__close:hover {
    background: var(--apple-bg-elevated);
    color: var(--apple-text-primary);
}

.search-modal__results {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.search-empty,
.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--apple-text-tertiary);
}

.search-empty svg,
.search-loading svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.search-empty p {
    font-size: 15px;
}

.search-loading .loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--apple-bg-elevated);
    border-top-color: var(--apple-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.search-grid .video-card {
    flex: 1;
}

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

    .search-modal__content {
        width: 95%;
        max-height: 90vh;
    }

    .search-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
}