/* ===================================
   Search Page - Prime Video Style
   =================================== */

/* Search Header */
.search-header-section {
    background: var(--gray-50);
    padding: 1rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.search-top {
    margin-bottom: 1rem;
}

.back-link {
    color: #999;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--primary-600);
}

.search-form {
    max-width: 800px;
    margin: 0 auto;
}

.search-box-large {
    position: relative;
}

.search-box-large i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 18px;
}

.search-box-large input {
    width: 100%;
    padding: 12px 44px 12px 44px;
    height: 44px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: #fff;
    color: var(--gray-900);
    font-size: 16px;
    transition: all 0.2s ease;
}

.search-box-large input:focus {
    border-color: var(--primary-400);
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.clear-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s ease;
}

.clear-btn:hover {
    color: var(--primary-600);
}

/* Search Results Layout */
.search-results-section {
    background: #fff;
    min-height: 70vh;
    padding: 2rem 0 4rem;
}

.search-layout {
    display: flex;
    gap: 2rem;
}

/* Top filters row (desktop) */
.top-filters {
    display: none;
    /* hidden by default; shown on desktop */
    gap: var(--spacing-md);
    align-items: center;
    margin-bottom: 1rem;
}

.filter-select {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--gray-800);
}

@media (min-width: 769px) {
    .top-filters {
        display: flex;
    }
}

/* Filters Sidebar (hidden on desktop; used as mobile drawer only) */
.filters-sidebar {
    display: none;
}

.filters-sidebar.active {
    display: block;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.filters-header h3 {
    color: var(--gray-900);
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.clear-all-btn {
    background: none;
    border: none;
    color: var(--primary-600);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.clear-all-btn:hover {
    color: var(--primary-700);
}

.toggle-filters-btn {
    display: none;
}

/* Active Filters */
.active-filters {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    background: var(--primary-50);
    color: var(--primary-600);
    border: 1px solid var(--primary-600);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-chip i {
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.filter-chip i:hover {
    opacity: 1;
}

/* Filter Groups */
.filter-group {
    margin-bottom: 2rem;
}

.filter-group h4 {
    color: var(--gray-900);
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 1rem 0;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.filter-option:hover {
    background: var(--gray-50);
}

.filter-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-600);
}

.filter-option span {
    color: var(--gray-700);
    font-size: 14px;
}

.filter-option input:checked+span {
    color: var(--primary-700);
    font-weight: 600;
}

/* Results Content */
.results-content {
    flex: 1;
    min-width: 0;
}

.mobile-filter-bar {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.show-filters-btn {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.show-filters-btn:hover {
    background: var(--gray-50);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.results-header h2 {
    color: var(--gray-900);
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.query-text {
    color: var(--primary-600);
}

.results-count,
.results-count-desktop {
    color: var(--gray-500);
    font-size: 14px;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (min-width: 992px) {
    .results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.video-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-300);
}

.video-card .thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    overflow: hidden;
    background: #000;
}

.video-card .thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card:hover .thumb img {
    transform: scale(1.05);
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.category-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--primary-700);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.video-card .info {
    padding: 1rem;
}

.video-card .title {
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    font-size: 15px;
}

.video-card .meta {
    color: var(--gray-500);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-card .meta i {
    font-size: 11px;
}

/* Loading Skeleton */
.loading-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.skeleton-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: var(--shadow-sm);
}

.skeleton-card::before {
    content: '';
    display: block;
    padding-top: 56.25%;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 6rem 2rem;
    color: var(--gray-500);
}

.empty-state i {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    color: var(--gray-900);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 2rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 3rem;
}

.pagination-btn {
    background: #fff;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-info {
    color: var(--gray-500);
    font-size: 14px;
    font-weight: 600;
}

/* Filters Overlay (Mobile) */
.filters-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 998;
}

.filters-overlay.active {
    display: block;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {

    .search-header-section {
        padding: 1.5rem 0 1rem;
    }

    .search-box-large input {
        font-size: 14px;
        padding: 14px 45px 14px 45px;
    }

    .mobile-filter-bar {
        display: flex;
        /* show filter button on mobile */
    }

    .results-count-desktop {
        display: none;
    }

    .results-header h2 {
        font-size: 1.5rem;
    }

    /* Mobile Filters (drawer styles) */
    .filters-sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        height: 100vh;
        width: 300px;
        z-index: 999;
        overflow-y: auto;
        transition: left 0.3s ease;
        margin: 0;
        border-radius: 0;
        background: #fff;
        /* White background for consistency */
        color: var(--gray-900);
        border: 1px solid var(--gray-200);
        box-shadow: var(--shadow-lg);
        padding: 16px;
        /* spacing inside drawer */
    }

    .filters-sidebar.active {
        left: 0;
    }

    .toggle-filters-btn {
        display: block;
        background: none;
        border: none;
        color: var(--gray-600);
        font-size: 20px;
        cursor: pointer;
        padding: 4px;
    }

    .clear-all-btn {
        margin-right: auto;
        color: var(--primary-600);
    }

    /* Hide active chips on mobile drawer to avoid duplication */
    .active-filters {
        display: none;
    }

    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .pagination {
        flex-direction: column;
        gap: 1rem;
    }

    .pagination-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .results-header h2 {
        font-size: 1.2rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}