:root {
    --bg-dark: #050505;
    --bg-card: #121212;
    --bg-sidebar: rgba(10, 10, 10, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border: #262626;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
    background: radial-gradient(circle at top right, #1a1a1a 0%, #050505 40%);
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 2rem;
    color: #fff;
    letter-spacing: -0.5px;
}

.filters {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input,
select {
    background-color: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

input:focus,
select:focus {
    border-color: var(--accent);
    background-color: rgba(37, 99, 235, 0.1);
}

select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.favorites-btn {
    background-color: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.favorites-btn:hover {
    border-color: var(--accent);
    background-color: rgba(37, 99, 235, 0.1);
}

.favorites-btn.active {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.stats {
    margin-top: auto;
    color: var(--text-secondary);
    font-size: 0.8rem;
    opacity: 0.7;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    overflow-y: auto;
    scroll-behavior: smooth;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.channel-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 200px;
    position: relative;
    overflow: hidden;
}

.channel-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 10px 30px -10px rgba(37, 99, 235, 0.3);
    background-color: #1a1a1a;
}

.channel-card .favorite-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    z-index: 5;
    padding: 0;
}

.channel-card .favorite-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.channel-card .favorite-btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

.channel-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin-bottom: 1rem;
    background-color: #fff;
    border-radius: 18px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}

.channel-card:hover .channel-logo {
    transform: scale(1.05);
}

.channel-logo.placeholder {
    background-color: var(--glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: none;
}

.channel-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #fff;
}

.channel-category {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background-color: var(--glass);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    margin-top: auto;
    text-transform: capitalize;
    border: 1px solid var(--glass-border);
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem;
    color: var(--text-secondary);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s ease-in-out infinite;
    margin-bottom: 1.5rem;
}

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

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.pagination button {
    background-color: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: visible;
    transition: opacity 0.3s, visibility 0s;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s, visibility 0s linear 0.3s;
}

.modal-content {
    background-color: #121212;
    width: 90%;
    max-width: 1100px;
    border-radius: 1.5rem;
    padding: 2rem;
    position: relative;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    line-height: 1;
    z-index: 10;
}



.channel-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 10px 30px -10px rgba(37, 99, 235, 0.3);
    background-color: #1a1a1a;
}

.channel-card .favorite-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    z-index: 5;
    padding: 0;
}

.channel-card .favorite-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.channel-card .favorite-btn.active {
    background: var(--accent);
    border-color: var(--accent);
}

.channel-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin-bottom: 1rem;
    background-color: #fff;
    border-radius: 18px;
    padding: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}

.channel-card:hover .channel-logo {
    transform: scale(1.05);
}

.channel-logo.placeholder {
    background-color: var(--glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: none;
}

.channel-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #fff;
}

.channel-category {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background-color: var(--glass);
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    margin-top: auto;
    text-transform: capitalize;
    border: 1px solid var(--glass-border);
}

.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem;
    color: var(--text-secondary);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s ease-in-out infinite;
    margin-bottom: 1.5rem;
}

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

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.pagination button {
    background-color: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: #121212;
    width: 90%;
    max-width: 1100px;
    border-radius: 1.5rem;
    padding: 2rem;
    position: relative;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border);
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
    line-height: 1;
    z-index: 10;
}

.close-modal:hover {
    color: #fff;
}

.video-container {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #000;
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

.player-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    transition: opacity 0.3s;
}

.player-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

video {
    width: 100%;
    height: 100%;
}

.channel-info h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.channel-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (min-width: 1440px) {
    .channel-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        backdrop-filter: blur(20px);
        background-color: rgba(10, 10, 10, 0.9);
    }

    .main-content {
        padding: 1rem;
    }

    .filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .filter-group:first-child {
        grid-column: 1 / -1;
    }

    .stats {
        display: none;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        padding: 1rem;
    }

    .close-modal {
        top: 1rem;
        right: 1rem;
    }
}

@media (max-width: 480px) {
    .filters {
        grid-template-columns: 1fr;
    }

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

    .channel-card {
        height: 180px;
    }
}