/**
 * Advanced Search Modal Styles
 * Modern streaming platform design (Netflix/YouTube inspired)
 */

:root {
    --vh-modal-bg: #0f0f0f;
    --vh-modal-surface: rgba(255, 255, 255, 0.03);
    --vh-modal-border: rgba(255, 255, 255, 0.1);
    --vh-modal-accent: #10b981;
    --vh-modal-accent-hover: #34d399;
    --vh-modal-text: #f1f5f9;
    --vh-modal-text-muted: #94a3b8;
    --vh-modal-chip-bg: rgba(255, 255, 255, 0.06);
    --vh-modal-chip-hover: rgba(255, 255, 255, 0.1);
    --vh-modal-chip-active: #10b981;
}

.vh-search-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s ease;
}

.vh-search-modal[aria-hidden="false"] {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity 0.3s ease;
}

.vh-search-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.vh-search-modal-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100vh;
    background: var(--vh-modal-bg);
    display: flex;
    flex-direction: column;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.vh-search-modal[aria-hidden="false"] .vh-search-modal-container {
    transform: translateY(0);
    opacity: 1;
}

.vh-search-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--vh-modal-border);
    flex-shrink: 0;
}

.vh-search-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--vh-modal-text);
    margin: 0;
    letter-spacing: -0.02em;
}

.vh-search-modal-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vh-modal-chip-bg);
    border: 1px solid var(--vh-modal-border);
    border-radius: 12px;
    color: var(--vh-modal-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vh-search-modal-close:hover {
    background: var(--vh-modal-chip-hover);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--vh-modal-text);
}

.vh-search-modal-close svg {
    width: 20px;
    height: 20px;
}

.vh-search-modal-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vh-search-modal-input-wrapper {
    position: relative;
    padding: 24px;
    flex-shrink: 0;
}

.vh-search-modal-input-icon {
    position: absolute;
    left: 44px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    color: var(--vh-modal-text-muted);
    pointer-events: none;
}

.vh-search-modal-input {
    width: 100%;
    height: 60px;
    padding: 0 56px;
    background: var(--vh-modal-surface);
    border: 2px solid var(--vh-modal-border);
    border-radius: 16px;
    font-size: 18px;
    font-weight: 500;
    color: var(--vh-modal-text);
    outline: none;
    transition: all 0.3s ease;
}

.vh-search-modal-input::placeholder {
    color: var(--vh-modal-text-muted);
    font-weight: 400;
}

.vh-search-modal-input:focus {
    border-color: var(--vh-modal-accent);
    background: rgba(16, 185, 129, 0.05);
}

.vh-search-modal-clear {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vh-modal-chip-bg);
    border: none;
    border-radius: 10px;
    color: var(--vh-modal-text-muted);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.vh-search-modal-clear.vh-visible {
    opacity: 1;
    visibility: visible;
}

.vh-search-modal-clear:hover {
    background: var(--vh-modal-chip-hover);
    color: var(--vh-modal-text);
}

.vh-search-modal-clear svg {
    width: 18px;
    height: 18px;
}

.vh-search-modal-filters {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 24px;
    -webkit-overflow-scrolling: touch;
}

.vh-search-filter-group {
    margin-bottom: 28px;
}

.vh-search-filter-group:last-child {
    margin-bottom: 0;
}

.vh-search-filter-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--vh-modal-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
}

.vh-search-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vh-filter-chip {
    display: inline-flex;
    cursor: pointer;
}

.vh-filter-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.vh-filter-chip-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--vh-modal-chip-bg);
    border: 1px solid var(--vh-modal-border);
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    color: var(--vh-modal-text-muted);
    transition: all 0.25s ease;
}

.vh-filter-chip:hover .vh-filter-chip-text {
    background: var(--vh-modal-chip-hover);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--vh-modal-text);
}

.vh-filter-chip input:checked + .vh-filter-chip-text {
    background: var(--vh-modal-chip-active);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.vh-filter-chip input:focus-visible + .vh-filter-chip-text {
    outline: 2px solid var(--vh-modal-accent);
    outline-offset: 2px;
}

.vh-tag-count {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.7;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.vh-filter-chip input:checked + .vh-filter-chip-text .vh-tag-count {
    background: rgba(255, 255, 255, 0.2);
}

.vh-search-filter-tags .vh-tag-chips {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 8px;
}

.vh-search-filter-tags .vh-tag-chips::-webkit-scrollbar {
    width: 6px;
}

.vh-search-filter-tags .vh-tag-chips::-webkit-scrollbar-track {
    background: transparent;
}

.vh-search-filter-tags .vh-tag-chips::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.vh-search-modal-footer {
    display: flex;
    gap: 14px;
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--vh-modal-border);
    flex-shrink: 0;
}

.vh-search-reset-btn {
    flex: 0 0 auto;
    padding: 16px 24px;
    background: transparent;
    border: 1px solid var(--vh-modal-border);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--vh-modal-text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
}

.vh-search-reset-btn:hover {
    background: var(--vh-modal-chip-bg);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--vh-modal-text);
}

.vh-search-submit-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 28px;
    background: var(--vh-modal-chip-active);
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
}

.vh-search-submit-btn:hover {
    background: var(--vh-modal-accent-hover);
}

.vh-search-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.vh-search-result-count {
    font-weight: 500;
    opacity: 0.9;
}

.vh-search-result-count:empty {
    display: none;
}

.vh-search-result-count::before {
    content: '(';
}

.vh-search-result-count::after {
    content: ')';
}

@media (min-width: 768px) {
    .vh-search-modal {
        padding: 80px 24px;
        align-items: flex-start;
    }
    
    .vh-search-modal-container {
        max-width: 680px;
        max-height: calc(100vh - 160px);
        height: auto;
        border-radius: 16px;
        border: 1px solid var(--vh-modal-border);
        box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    }
    
    .vh-search-modal-header {
        padding: 24px 28px;
    }
    
    .vh-search-modal-title {
        font-size: 22px;
    }
    
    .vh-search-modal-input-wrapper {
        padding: 28px;
    }
    
    .vh-search-modal-input-icon {
        left: 52px;
    }
    
    .vh-search-modal-clear {
        right: 52px;
    }
    
    .vh-search-modal-filters {
        padding: 0 28px 28px;
        max-height: 400px;
    }
    
    .vh-search-modal-footer {
        padding: 24px 28px;
    }
}

body.vh-modal-open {
    overflow: hidden;
}

.vh-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vh-spin 0.7s linear infinite;
}

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

.vh-applied-filters {
    padding: 16px 24px;
    background: rgba(16, 185, 129, 0.05);
    border-bottom: 1px solid var(--vh-modal-border);
}

.vh-filters-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vh-filter-chip-removable {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.vh-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.vh-chip-remove:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.vh-chip-remove svg {
    width: 12px;
    height: 12px;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --vh-modal-bg: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
        --vh-modal-surface: rgba(0, 0, 0, 0.02);
        --vh-modal-border: rgba(0, 0, 0, 0.08);
        --vh-modal-text: #1e293b;
        --vh-modal-text-muted: #64748b;
        --vh-modal-chip-bg: rgba(0, 0, 0, 0.04);
        --vh-modal-chip-hover: rgba(0, 0, 0, 0.08);
    }
    
    :root:not([data-theme="dark"]) .vh-search-modal-backdrop {
        background: rgba(0, 0, 0, 0.5);
    }
    
    :root:not([data-theme="dark"]) .vh-search-modal-header {
        background: rgba(255, 255, 255, 0.5);
    }
    
    :root:not([data-theme="dark"]) .vh-search-modal-footer {
        background: rgba(255, 255, 255, 0.5);
    }
    
    :root:not([data-theme="dark"]) .vh-filter-chip-removable {
        background: rgba(16, 185, 129, 0.1);
        color: #059669;
    }
    
    :root:not([data-theme="dark"]) .vh-tag-count {
        background: rgba(0, 0, 0, 0.05);
    }
}
