/* Catppuccin Mocha Theme Colors */
:root {
    --ctp-base: #1e1e2e;
    --ctp-mantle: #181825;
    --ctp-crust: #11111b;
    --ctp-surface0: #313244;
    --ctp-surface1: #45475a;
    --ctp-surface2: #585b70;
    --ctp-text: #cdd6f4;
    --ctp-subtext1: #bac2de;
    --ctp-subtext0: #a6adc8;
    --ctp-overlay0: #6c7086;
    --ctp-overlay1: #7f849c;
    --ctp-lavender: #b4befe;
    --ctp-mauve: #cba6f7;
    --ctp-pink: #f5c2e7;
    --ctp-maroon: #eba0ac;
    --ctp-red: #f38ba8;
    --ctp-peach: #fab387;
    --ctp-yellow: #f9e2af;
    --ctp-green: #a6e3a1;
    --ctp-teal: #94e2d5;
    --ctp-sky: #89dceb;
    --ctp-sapphire: #74c7ec;
    --ctp-blue: #89b4fa;
}

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

html {
    overscroll-behavior: none;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--ctp-base);
    color: var(--ctp-text);
    height: 100vh;
    overflow: hidden;
    overscroll-behavior: none;
    position: fixed;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: var(--ctp-mantle);
    padding: 1rem 2rem;
    border-bottom: 2px solid var(--ctp-surface0);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--ctp-mauve);
    margin-bottom: 0.25rem;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--ctp-subtext0);
}

.search-container {
    flex: 1;
    max-width: 500px;
}

#searchInput {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--ctp-surface0);
    border: 2px solid var(--ctp-surface1);
    border-radius: 10px;
    color: var(--ctp-text);
    font-size: 1rem;
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--ctp-mauve);
    background: var(--ctp-surface1);
}

#searchInput::placeholder {
    color: var(--ctp-overlay0);
}

.stats {
    color: var(--ctp-subtext0);
    font-size: 0.9rem;
}

/* Country Selector */
.country-selector {
    display: flex;
    gap: 0.5rem;
}

.country-btn {
    padding: 0.625rem 1.25rem;
    background: var(--ctp-surface0);
    border: 2px solid var(--ctp-surface1);
    border-radius: 10px;
    color: var(--ctp-text);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.country-btn:hover {
    background: var(--ctp-surface1);
    border-color: var(--ctp-mauve);
    transform: translateY(-2px);
}

.country-btn.active {
    background: var(--ctp-mauve);
    color: var(--ctp-base);
    border-color: var(--ctp-mauve);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 350px;
    background: var(--ctp-mantle);
    border-right: 2px solid var(--ctp-surface0);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--ctp-crust);
    border-bottom: 1px solid var(--ctp-surface0);
    overflow-x: auto;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background: var(--ctp-surface0);
    border: none;
    border-radius: 8px;
    color: var(--ctp-text);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: var(--ctp-surface1);
    color: var(--ctp-mauve);
}

.filter-btn.active {
    background: var(--ctp-mauve);
    color: var(--ctp-base);
}

.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--ctp-surface0);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.channel-item:hover {
    background: var(--ctp-surface1);
    border-color: var(--ctp-mauve);
    transform: translateX(5px);
}

.channel-item.active {
    background: var(--ctp-surface1);
    border-color: var(--ctp-mauve);
}

.channel-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--ctp-crust);
    padding: 5px;
}

.channel-logo.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.channel-details {
    flex: 1;
    min-width: 0;
}

.channel-name {
    font-weight: 600;
    color: var(--ctp-text);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.channel-category {
    font-size: 0.75rem;
    color: var(--ctp-subtext0);
    padding: 0.2rem 0.5rem;
    background: var(--ctp-surface2);
    border-radius: 4px;
    display: inline-block;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--ctp-subtext0);
}

/* Player Section */
.player-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--ctp-crust);
}

.player-container {
    flex: 1;
    position: relative;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
}

#videoPlayer {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.player-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: var(--ctp-subtext0);
    font-size: 1.2rem;
}

.overlay-text-mobile {
    display: none;
}

.overlay-text-desktop {
    display: block;
}

.now-playing {
    background: var(--ctp-mantle);
    padding: 1.5rem 2rem;
    border-top: 2px solid var(--ctp-surface0);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.current-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 10px;
    background: var(--ctp-surface0);
    padding: 8px;
}

.channel-info h2 {
    font-size: 1.3rem;
    color: var(--ctp-mauve);
    margin-bottom: 0.25rem;
}

.category-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: var(--ctp-surface0);
    color: var(--ctp-text);
    border-radius: 6px;
    font-size: 0.85rem;
}

.player-controls {
    display: flex;
    gap: 1rem;
}

.control-btn {
    background: var(--ctp-surface0);
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: var(--ctp-surface1);
    transform: scale(1.1);
}

/* Scrollbar */
.channel-list::-webkit-scrollbar {
    width: 8px;
}

.channel-list::-webkit-scrollbar-track {
    background: var(--ctp-crust);
}

.channel-list::-webkit-scrollbar-thumb {
    background: var(--ctp-surface1);
    border-radius: 4px;
}

.channel-list::-webkit-scrollbar-thumb:hover {
    background: var(--ctp-surface2);
}

/* Mobile Toggle Button */
.mobile-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--ctp-mauve);
    color: var(--ctp-base);
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.mobile-toggle:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 768px) {
    html, body {
        overflow: hidden;
        position: fixed;
        overscroll-behavior: none;
        touch-action: none;
    }
    
    body {
        overflow-y: hidden;
    }

    .header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }

    .country-selector {
        width: 100%;
        justify-content: center;
    }

    .country-btn {
        flex: 1;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .search-container {
        width: 100%;
        max-width: none;
    }

    #searchInput {
        padding: 0.875rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .stats {
        font-size: 0.85rem;
    }

    .main-content {
        flex-direction: column;
        position: relative;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .filter-buttons {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 0.75rem;
    }

    .filter-buttons::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        padding: 0.625rem 1.125rem;
        font-size: 0.9rem;
        min-width: fit-content;
    }

    .channel-list {
        padding: 0.75rem;
    }

    .channel-item {
        padding: 1rem;
        margin-bottom: 0.75rem;
        border-radius: 12px;
    }

    .channel-logo {
        width: 60px;
        height: 60px;
    }

    .channel-name {
        font-size: 1rem;
    }

    .channel-category {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }

    .player-section {
        flex: 1;
        min-height: calc(100vh - 200px);
    }

    .player-container {
        min-height: 40vh;
    }

    .now-playing {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .channel-info {
        width: 100%;
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .channel-info h2 {
        font-size: 1.1rem;
    }

    .current-logo {
        width: 80px;
        height: 80px;
    }

    .player-controls {
        width: 100%;
        justify-content: center;
    }

    .control-btn {
        padding: 1rem 1.5rem;
        font-size: 1.3rem;
        flex: 1;
        max-width: 150px;
    }

    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Close button for mobile sidebar */
    .sidebar::before {
        content: '✕';
        display: block;
        position: absolute;
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        background: var(--ctp-surface0);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        color: var(--ctp-text);
        cursor: pointer;
        z-index: 10;
    }

    .overlay-content {
        font-size: 1rem;
        padding: 1rem;
    }

    .overlay-text-desktop {
        display: none;
    }

    .overlay-text-mobile {
        display: block;
    }
}

/* Portrait mode - hide overlay text, looks cleaner */
@media (max-width: 768px) and (orientation: portrait) {
    .overlay-content {
        display: none;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .player-container {
        min-height: 60vh;
    }

    .now-playing {
        flex-direction: row;
        padding: 0.75rem 1rem;
    }

    .channel-info {
        flex-direction: row;
        text-align: left;
    }

    .channel-info h2 {
        font-size: 1rem;
    }

    .current-logo {
        width: 50px;
        height: 50px;
    }

    .control-btn {
        padding: 0.75rem 1rem;
        font-size: 1.1rem;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .header {
        padding: 0.75rem;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .filter-btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.85rem;
    }

    .channel-logo {
        width: 50px;
        height: 50px;
    }

    .channel-name {
        font-size: 0.9rem;
    }

    .mobile-toggle {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
        bottom: 15px;
        right: 15px;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .channel-item {
        min-height: 70px;
    }

    .filter-btn {
        min-height: 44px; /* Apple's recommended touch target */
    }

    .control-btn {
        min-height: 44px;
    }
}
