:root {
    /* Modern Color Palette */
    --primary: #FF3B30;
    --primary-hover: #FF453A;
    --bg-main: #0a0a0a;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --border: #38383a;
    --glass-bg: rgba(28, 28, 30, 0.85);
    /* Slightly more opaque for mobile readibility */

    /* Effects */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --glass-blur: blur(20px);
    --radius-lg: 16px;
    --radius-md: 12px;

    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    /* Desktop default */
}

/* Glassmorphism Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    height: 70px;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #a5a5a5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.logo span {
    background: linear-gradient(135deg, #ff3b30 0%, #ff9500 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.search-container {
    flex: 1;
    max-width: 500px;
    margin: 0 1rem;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 0.7rem 1rem;
    padding-left: 2.5rem;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
}

.custom-select {
    padding: 0.6rem 1rem;
    padding-right: 2rem;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    font-size: 0.85rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* Main Layout */
.app-container {
    padding-top: 70px;
    display: flex;
    height: 100vh;
}

/* Player Section */
.player-section {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
    overflow-y: auto;
    /* Allow scrolling content like title */
}

.video-wrapper {
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 0 auto;
    box-shadow: var(--shadow-md);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.placeholder-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #121212, #1e1e1e);
    text-align: center;
    padding: 1rem;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.placeholder-text {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Channel Meta */
.channel-meta {
    max-width: 1200px;
    width: 100%;
    margin: 1.5rem auto 0;
    padding: 0 0.5rem;
}

.channel-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, #aaa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.channel-tags {
    display: flex;
    gap: 0.5rem;
}

.tag {
    padding: 0.3rem 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Sidebar Channels */
.sidebar {
    width: 380px;
    background: var(--bg-secondary);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.channels-grid {
    flex: 1;
    overflow-y: overlay;
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.8rem;
    align-content: start;
}

/* Channel Card */
.channel-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    aspect-ratio: 1;
    position: relative;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.channel-card:active {
    transform: scale(0.95);
}

.channel-card.active {
    border-color: var(--primary);
    background: rgba(255, 59, 48, 0.05);
    box-shadow: 0 0 0 1px var(--primary);
}

.channel-card img.lazy-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    transition: opacity 0.4s ease, transform 0.3s ease;
    opacity: 0.1;
}

.channel-card:hover img.lazy-image {
    transform: scale(1.05);
}

.channel-card img.lazy-image.loaded {
    opacity: 1;
}

.channel-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    opacity: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0.5rem;
    transition: opacity 0.2s;
}

.channel-card:hover .channel-overlay {
    opacity: 1;
}

.channel-name {
    color: #fff;
    font-size: 0.75rem;
    text-align: center;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* === MOBILE RESPONSIVE STYLES === */
@media (max-width: 900px) {
    body {
        overflow-y: auto;
        /* Allow full page scroll on mobile */
        overflow-x: hidden;
    }

    .header {
        height: auto;
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(10, 10, 10, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        min-height: 105px;
        align-content: flex-start;
    }

    .logo {
        flex: 0 0 auto;
        font-size: 1.1rem;
        line-height: 1;
    }

    .filter-group {
        flex: 1;
        justify-content: flex-end;
    }

    .custom-select {
        height: 28px;
        padding: 0 0.5rem;
        padding-right: 1.5rem;
        font-size: 0.75rem;
        background-color: rgba(255, 255, 255, 0.1);
    }

    .search-container {
        order: 3;
        flex: 0 0 100%;
        max-width: 100%;
        margin: 0;
    }

    .filter-group {
        order: 2;
    }

    .custom-select {
        padding: 0.4rem 0.5rem;
        padding-right: 1.2rem;
        /* reduced padding */
        font-size: 0.7rem;
        /* smaller font */
        background-position: right 4px center;
        height: 28px;
        /* compact height */
    }

    .app-container {
        flex-direction: column;
        height: auto;
        padding-top: 0;
        margin-top: 105px;
    }

    .player-section {
        padding: 0.5rem;
        min-height: auto;
        background: var(--bg-main);
        position: sticky;
        top: 105px;
        z-index: 900;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    }

    .video-wrapper {
        border-radius: var(--radius-md);
        box-shadow: none;
        /* Lighter on mobile */
    }

    .channel-title {
        font-size: 1.2rem;
    }

    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        background: var(--bg-main);
    }

    .sidebar-header {
        position: sticky;
        top: 60px;
        /* Below header */
        background: var(--bg-main);
        z-index: 10;
        padding: 0.8rem 1rem;
    }

    .channels-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.8rem;
        height: auto;
        overflow: visible;
        padding: 1rem;
    }

    /* Keep overlay visible on mobile for titles since no hover */
    .channel-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    }

    .channel-name {
        font-size: 0.65rem;
    }

    /* Bigger touch targets */
    .channel-card {
        aspect-ratio: 1;
    }
}