/* Pretpark TV CSS Design System */

/* Root Colors & Variables */
:root {
    /* Color Tokens (Dark Cinematic Theme) */
    --bg-primary: #08080c;
    --bg-secondary: #0f0f15;
    --bg-tertiary: #161622;
    --bg-card: rgba(22, 22, 34, 0.6);
    --surface-glass: rgba(255, 255, 255, 0.03);
    --surface-glass-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --accent-primary: #e50914; /* Netflix Red */
    --accent-secondary: #ff6b35; /* Orange Accent */
    --accent-gradient: linear-gradient(135deg, #e50914 0%, #ff521b 100%);
    --accent-gradient-hover: linear-gradient(135deg, #ff1a25 0%, #ff6b35 100%);
    
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1b5;
    --text-muted: #62627a;
    
    /* Function Colors */
    --success: #00e676; /* Live badge color */
    --info: #00b0ff;
    --warning: #ffd600;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: 'Outfit', var(--font-sans);
    
    /* Layout */
    --header-height: 72px;
    --sidebar-width: 260px;
    --max-width: 1440px;
    --border-radius: 12px;
    --border-radius-sm: 6px;
    --border-radius-lg: 20px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.8);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    background-color: var(--bg-primary);
}

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

button, input, select {
    font-family: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

button {
    cursor: pointer;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Hide Scrollbar helper classes */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Base Layout */
#app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header Component */
#app-header {
    height: var(--header-height);
    background: rgba(8, 8, 12, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: background var(--transition-normal);
}

#app-header.scrolled {
    background: rgba(8, 8, 12, 0.95);
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
}

.app-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

/* Nav Menu */
#app-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-secondary);
    position: relative;
    padding: 0.5rem 0;
    transition: color var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-gradient);
    transition: width var(--transition-fast);
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

.fav-count {
    background: var(--accent-gradient);
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 2px;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Search Bar styling */
.search-container {
    display: flex;
    align-items: center;
    background: var(--surface-glass);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 0.4rem 1rem;
    width: 250px;
    transition: all var(--transition-normal);
}

.search-container:focus-within {
    width: 320px;
    border-color: var(--accent-secondary);
    background: var(--bg-tertiary);
    box-shadow: 0 0 12px rgba(255, 107, 53, 0.15);
}

.search-icon {
    font-size: 0.9rem;
    margin-right: 0.5rem;
    color: var(--text-secondary);
}

.search-container input {
    width: 100%;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.search-container input::placeholder {
    color: var(--text-muted);
}

#clear-search {
    font-size: 1.2rem;
    line-height: 1;
    color: var(--text-secondary);
    padding: 0 0.2rem;
    cursor: pointer;
}

#clear-search:hover {
    color: var(--text-primary);
}

.hidden {
    display: none !important;
}

/* Country Button Selector */
.country-selector-wrapper {
    position: relative;
}

.country-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-glass);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.country-btn:hover {
    background: var(--surface-glass-hover);
    border-color: var(--text-muted);
}

.country-btn .arrow {
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform var(--transition-fast);
}

.country-selector-wrapper.active .arrow {
    transform: rotate(180deg);
}

/* Dropdown menu options */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    max-height: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1010;
    animation: dropdownShow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes dropdownShow {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-search {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
}

.dropdown-search input {
    width: 100%;
    background: var(--surface-glass);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.dropdown-menu ul {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    padding: 0.4rem 0;
}

.dropdown-menu li {
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.dropdown-menu li:hover, .dropdown-menu li.selected {
    background: var(--surface-glass-hover);
}

.dropdown-menu li.selected {
    color: var(--accent-secondary);
    font-weight: 600;
}

.dropdown-menu li .flag {
    font-size: 1.1rem;
}

.dropdown-menu li .count {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Mobile Menu Toggle button styling */
#mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 30px;
    height: 24px;
    justify-content: space-between;
}

#mobile-menu-toggle .bar {
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-fast);
}

/* Main Content Area */
#app-view {
    flex: 1;
    margin-top: var(--header-height);
    padding: 2rem;
    max-width: var(--max-width);
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Hero Section / Banner */
.hero-banner {
    position: relative;
    border-radius: var(--border-radius-lg);
    background: linear-gradient(180deg, rgba(8, 8, 12, 0.4) 0%, rgba(8, 8, 12, 0.95) 100%), 
                radial-gradient(ellipse at center, rgba(229, 9, 20, 0.15) 0%, transparent 70%),
                var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 4rem 3rem;
    margin-bottom: 2.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.hero-tag {
    font-family: var(--font-display);
    color: var(--accent-secondary);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    max-width: 700px;
    margin-bottom: 1rem;
    letter-spacing: -1px;
    background: linear-gradient(to right, var(--text-primary), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin-bottom: 2rem;
}

.hero-ctas {
    display: flex;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.6rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: var(--font-display);
    transition: all var(--transition-normal);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 9, 20, 0.5);
    background: var(--accent-gradient-hover);
}

.btn-secondary {
    background: var(--surface-glass);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--surface-glass-hover);
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

/* Category Tabs Horizontal Scroll */
.category-tabs-container {
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.category-tabs {
    display: flex;
    gap: 0.8rem;
    list-style: none;
    width: max-content;
}

.category-tab {
    padding: 0.6rem 1.2rem;
    background: var(--surface-glass);
    border: 1px solid var(--border);
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.category-tab:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
    background: var(--surface-glass-hover);
}

.category-tab.active {
    color: white;
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(229, 9, 20, 0.25);
}

/* Netflix Style Rows Layout */
.rows-wrapper {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.channel-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.row-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.row-view-all {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-secondary);
}

.row-view-all:hover {
    text-decoration: underline;
}

/* Scroll wrapper and cards slider */
.row-cards-slider-container {
    position: relative;
    width: 100%;
}

.row-cards-slider {
    display: flex;
    gap: 1.2rem;
    overflow-x: auto;
    padding: 0.5rem 0.2rem 1rem 0.2rem;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

.row-cards-slider::-webkit-scrollbar {
    height: 6px;
}

.row-cards-slider::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.01);
    border-radius: 3px;
}

.row-cards-slider::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
    transition: background var(--transition-fast);
}

.row-cards-slider:hover::-webkit-scrollbar-thumb {
    background: var(--text-muted);
}

/* Channel Card component */
.channel-card {
    flex: 0 0 260px; /* fixed width in sliders */
    scroll-snap-align: start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.channel-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    background: var(--bg-tertiary);
}

.card-logo-container {
    height: 140px;
    background: linear-gradient(135deg, rgba(22, 22, 34, 0.8) 0%, rgba(8, 8, 12, 1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

/* Card Badge overlays */
.card-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 10;
}

.live-badge {
    background: var(--success);
    color: #000;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0, 230, 118, 0.4);
    animation: livePulse 2s infinite;
}

@keyframes livePulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.card-logo-img {
    max-height: 80px;
    max-width: 140px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
    transition: transform var(--transition-normal);
}

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

.card-fav-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    backdrop-filter: blur(5px);
    transition: all var(--transition-fast);
    z-index: 12;
}

.card-fav-btn:hover {
    background: rgba(229, 9, 20, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: scale(1.1);
}

.card-fav-btn.is-fav {
    color: var(--accent-primary) !important;
    background: rgba(255, 255, 255, 0.95);
    border-color: white;
}

.card-details {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
}

.card-channel-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.category-tag {
    text-transform: capitalize;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,0.05);
    font-size: 0.7rem;
}

.category-sports { color: var(--accent-secondary); background: rgba(255, 107, 53, 0.1); }
.category-news { color: #2196f3; background: rgba(33, 150, 243, 0.1); }
.category-movies { color: #e040fb; background: rgba(224, 64, 251, 0.1); }
.category-series { color: #00bcd4; background: rgba(0, 188, 212, 0.1); }
.category-music { color: #e91e63; background: rgba(233, 30, 99, 0.1); }
.category-kids { color: #ffeb3b; background: rgba(255, 235, 59, 0.1); }
.category-documentary { color: #4caf50; background: rgba(76, 175, 80, 0.1); }
.category-general { color: var(--text-secondary); background: rgba(255,255,255,0.05); }

.card-country {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Grid layout for full results view */
.grid-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.grid-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.grid-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
}

.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.grid-layout .channel-card {
    flex: initial;
    width: 100%;
}

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

.pagination-btn {
    background: var(--surface-glass);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--surface-glass-hover);
    border-color: var(--text-secondary);
}

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

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

/* Categories page view */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 180px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent-secondary);
    box-shadow: 0 8px 24px rgba(255, 107, 53, 0.15);
    background: var(--bg-tertiary);
}

.category-card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.category-card-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: capitalize;
    margin-bottom: 0.3rem;
}

.category-card-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* EPG / TV Guide View CSS */
.epg-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.epg-info-header {
    background: var(--surface-glass);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1.2rem 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.epg-grid-container {
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.epg-header-row {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.epg-channel-header-title {
    padding: 1rem 1.5rem;
    font-family: var(--font-display);
    font-weight: 700;
    border-right: 1px solid var(--border);
}

.epg-timeline {
    display: flex;
    overflow-x: auto;
    padding: 0 1rem;
    align-items: center;
}

.epg-row {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    border-bottom: 1px solid var(--border);
    min-height: 90px;
    align-items: stretch;
    transition: background var(--transition-fast);
}

.epg-row:hover {
    background: rgba(255, 255, 255, 0.01);
}

.epg-row-channel {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-right: 1px solid var(--border);
    font-weight: 600;
    cursor: pointer;
}

.epg-row-channel:hover {
    color: var(--accent-secondary);
}

.epg-row-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(255,255,255,0.02);
    padding: 2px;
}

.epg-programs-container {
    padding: 0.7rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}

.epg-program-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.epg-program-now {
    font-weight: 600;
}

.epg-program-next {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.epg-time {
    font-family: var(--font-display);
    font-size: 0.8rem;
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-secondary);
    min-width: 85px;
    text-align: center;
}

.epg-program-next .epg-time {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.02);
}

.epg-program-title {
    font-size: 0.95rem;
}

.epg-no-guide {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
}

/* Empty View / States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5rem 2rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px dashed var(--border);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

.empty-state-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.empty-state-desc {
    color: var(--text-secondary);
    max-width: 400px;
    margin-bottom: 1.5rem;
}

/* Skeleton Loading CSS */
.skeleton-row {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 3rem;
}

.skeleton-title {
    height: 28px;
    width: 250px;
    border-radius: 4px;
    background: linear-gradient(90deg, #161622 25%, #232336 50%, #161622 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s infinite;
}

.skeleton-slider {
    display: flex;
    gap: 1.2rem;
    overflow: hidden;
}

.skeleton-card {
    flex: 0 0 260px;
    height: 236px;
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.skeleton-card-image {
    height: 140px;
    background: linear-gradient(90deg, #161622 25%, #232336 50%, #161622 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s infinite;
}

.skeleton-card-text {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.skeleton-line-name {
    height: 16px;
    width: 80%;
    border-radius: 3px;
    background: linear-gradient(90deg, #161622 25%, #232336 50%, #161622 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s infinite;
}

.skeleton-line-meta {
    height: 12px;
    width: 40%;
    border-radius: 3px;
    background: linear-gradient(90deg, #161622 25%, #232336 50%, #161622 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s infinite;
}

@keyframes skeletonPulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Video Player Modal overlay styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 1200px;
    overflow: hidden;
    position: relative;
    z-index: 10;
    animation: modalShow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 100;
    transition: color var(--transition-fast);
}

.close-btn:hover {
    color: var(--accent-primary);
}

.player-content-wrapper {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    height: 580px;
}

.video-container {
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    border-right: 1px solid var(--border);
}

.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    outline: none;
}

/* Stream offline/error container */
#video-error-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    z-index: 5;
}

.error-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
}

#video-error-message h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

#video-error-message p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 440px;
    margin-bottom: 2rem;
}

.player-details {
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    background: var(--bg-tertiary);
}

.player-header {
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
    position: relative;
}

.player-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    padding: 4px;
}

.player-title-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.player-title-info h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
}

.player-badges {
    display: flex;
    gap: 0.5rem;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    text-transform: capitalize;
}

.fav-toggle-btn {
    align-self: flex-start;
    background: var(--surface-glass);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.fav-toggle-btn:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(229, 9, 20, 0.2);
}

.fav-toggle-btn.is-fav {
    background: white;
    color: #000;
    border-color: white;
}

/* EPG section in player side sidebar */
.player-epg-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 1.2rem;
    border-radius: var(--border-radius);
}

.player-epg-section h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.epg-now-playing, .epg-next-playing {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.time-indicator {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--accent-secondary);
    letter-spacing: 1px;
}

.epg-next-playing .time-indicator {
    color: var(--text-muted);
}

.player-website a {
    display: inline-flex;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-secondary);
}

.player-website a:hover {
    text-decoration: underline;
}

/* Loading Overlay for initial app loading */
.loading-overlay {
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-radius: 50%;
    border-top-color: var(--accent-secondary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1.5rem;
}

.loading-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

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

/* Footer Component */
#app-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 4rem 2rem 2rem 2rem;
    margin-top: 5rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1.5fr 1fr 2fr;
    gap: 4rem;
    max-width: var(--max-width);
    margin: 0 auto 3rem auto;
}

.footer-info h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.footer-links h4, .footer-legal h4 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.2rem;
    color: var(--text-primary);
}

.footer-links ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-links a {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-legal p {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.6;
}

.footer-legal a {
    color: var(--text-secondary);
    text-decoration: underline;
}

.footer-bottom {
    max-width: var(--max-width);
    margin: 0 auto;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============================================
   Mobile Bottom Navigation Bar (app-like)
   Hidden on desktop, shown on mobile
   ============================================ */
.mobile-bottom-nav {
    display: none; /* hidden on desktop */
}

/* ============================================
   RESPONSIVE: TABLET (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
    #app-header {
        padding: 0 1rem;
    }
    
    #app-nav {
        display: none;
    }
    
    #mobile-menu-toggle {
        display: none !important;
    }
    
    /* Show bottom navigation bar on tablet and mobile */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: rgba(8, 8, 12, 0.92);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border);
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        justify-content: space-around;
        align-items: center;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 12px;
        border-radius: 12px;
        min-width: 64px;
        min-height: 44px;
        color: var(--text-muted);
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-item.active {
        color: var(--accent-secondary);
    }

    .bottom-nav-icon {
        font-size: 1.25rem;
        line-height: 1;
    }

    .bottom-nav-label {
        font-size: 0.65rem;
        font-weight: 600;
        letter-spacing: 0.3px;
    }

    #app-view {
        padding-bottom: 80px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Player: stack video and details vertically */
    .player-content-wrapper {
        grid-template-columns: 1fr;
        height: auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .video-container {
        height: 280px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .player-details {
        padding: 1.5rem;
    }
    
    /* Channel cards: slightly smaller */
    .channel-card {
        flex: 0 0 220px;
    }
    
    .card-logo-container {
        height: 120px;
    }
    
    /* Grid: 3 columns max */
    .grid-layout {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    /* Categories grid: 2 columns */
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }
    
    .category-card {
        height: 140px;
        padding: 1.5rem;
    }
    
    /* Hero sizing down */
    .hero-banner {
        padding: 3rem 2rem;
    }
    
    .hero-title {
        font-size: 2.4rem;
    }
    
    /* EPG sidebar shrinks */
    .epg-header-row,
    .epg-row {
        grid-template-columns: 180px 1fr;
    }
}

/* ============================================
   RESPONSIVE: MOBILE (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {

    /* --- Header: compact & streamlined --- */
    #app-header {
        height: 56px;
        padding: 0 0.75rem;
    }
    
    /* Recalculate top offset for content */
    #app-view {
        margin-top: 56px;
        padding: 1rem;
        /* Leave room for bottom nav */
        padding-bottom: 80px;
    }

    .app-logo {
        height: 30px;
    }

    .header-right {
        gap: 0.5rem;
    }

    /* Search: icon-only by default, expands on tap */
    .search-container {
        width: 42px;
        height: 42px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        overflow: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .search-container .search-icon {
        margin: 0;
        font-size: 1rem;
        flex-shrink: 0;
    }
    
    .search-container input {
        width: 0;
        opacity: 0;
        padding: 0;
        transition: all 0.3s ease;
    }

    .search-container:focus-within {
        width: calc(100vw - 120px);
        height: 42px;
        border-radius: 24px;
        padding: 0 1rem;
        position: absolute;
        right: 0.75rem;
        top: 7px;
        z-index: 100;
        background: var(--bg-tertiary);
    }
    
    .search-container:focus-within .search-icon {
        margin-right: 0.5rem;
    }
    
    .search-container:focus-within input {
        width: 100%;
        opacity: 1;
    }

    /* Country selector: flag only */
    #current-country-name {
        display: none;
    }

    .country-btn {
        padding: 0.4rem 0.8rem;
        min-height: 42px;
        min-width: 42px;
        justify-content: center;
    }

    .country-btn .arrow {
        display: none;
    }

    .dropdown-menu {
        width: calc(100vw - 2rem);
        right: -0.75rem;
        max-height: 60vh;
    }

    /* --- Mobile Bottom Navigation Bar --- */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: rgba(8, 8, 12, 0.92);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border);
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        justify-content: space-around;
        align-items: center;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 12px;
        border-radius: 12px;
        min-width: 64px;
        min-height: 44px;
        color: var(--text-muted);
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-item.active {
        color: var(--accent-secondary);
    }

    .bottom-nav-icon {
        font-size: 1.25rem;
        line-height: 1;
    }

    .bottom-nav-label {
        font-size: 0.65rem;
        font-weight: 600;
        letter-spacing: 0.3px;
    }

    /* Hide desktop hamburger since bottom nav handles it */
    #mobile-menu-toggle {
        display: none;
    }

    /* --- Footer: respect bottom bar spacing --- */
    #app-footer {
        padding-bottom: calc(2rem + 64px + env(safe-area-inset-bottom, 0px));
        margin-top: 3rem;
        padding-top: 2rem;
    }
    
    .footer-content {
        gap: 1.5rem;
    }

    /* --- Hero Section: mobile compact --- */
    .hero-banner {
        padding: 2rem 1.25rem;
        margin-bottom: 1.5rem;
        border-radius: var(--border-radius);
    }

    .hero-tag {
        font-size: 0.75rem;
    }

    .hero-title {
        font-size: 1.6rem;
        line-height: 1.2;
    }

    .hero-desc {
        font-size: 0.85rem;
        margin-bottom: 1.25rem;
    }

    .hero-ctas {
        flex-direction: column;
        gap: 0.6rem;
    }

    .hero-ctas .btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem;
    }

    /* --- Category tabs: horizontal touch scroll --- */
    .category-tabs-container {
        margin: 0 -1rem 1.5rem -1rem;
        padding: 0 1rem 0.5rem 1rem;
    }

    .category-tab {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        white-space: nowrap;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* --- Netflix rows: touch-optimised horizontal scrolling --- */
    .rows-wrapper {
        gap: 2rem;
    }

    .row-title {
        font-size: 1.1rem;
    }

    .row-cards-slider {
        /* Add edge padding so first/last card doesn't clip */
        padding: 0.25rem 0 0.75rem 0;
        gap: 0.8rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Cards: smaller width for phone screens */
    .channel-card {
        flex: 0 0 160px;
    }

    .card-logo-container {
        height: 95px;
        padding: 1rem;
    }

    .card-logo-img {
        max-height: 55px;
        max-width: 100px;
    }

    .card-details {
        padding: 0.8rem;
        gap: 0.4rem;
    }

    .card-channel-name {
        font-size: 0.8rem;
    }

    .card-meta {
        font-size: 0.65rem;
    }

    .category-tag {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    .live-badge {
        font-size: 0.55rem;
        padding: 1px 4px;
    }

    /* Touch-friendly favorite button */
    .card-fav-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    /* --- Grid Layout: 2 columns on mobile --- */
    .grid-layout {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .grid-layout .channel-card {
        flex: initial;
    }

    .grid-title {
        font-size: 1.3rem;
    }

    .grid-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    /* Pagination: compact for mobile */
    .pagination-container {
        gap: 0.8rem;
        margin-top: 2rem;
        flex-wrap: wrap;
    }

    .pagination-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
        min-height: 44px;
    }

    /* --- Categories Grid: 2 columns --- */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .category-card {
        height: 120px;
        padding: 1rem;
    }

    .category-card-icon {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .category-card-name {
        font-size: 1rem;
    }

    /* --- EPG / TV Guide: simplified mobile layout --- */
    .epg-header-row {
        display: none; /* hide the desktop header row on mobile */
    }

    .epg-row {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 0.5rem 0;
    }

    .epg-row-channel {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.8rem 1rem;
    }

    .epg-row-logo {
        width: 28px;
        height: 28px;
    }

    .epg-row-channel span {
        font-size: 0.85rem;
    }

    .epg-programs-container {
        padding: 0.8rem 1rem;
    }

    .epg-time {
        font-size: 0.7rem;
        min-width: 70px;
    }

    .epg-program-title {
        font-size: 0.8rem;
    }

    .epg-info-header {
        font-size: 0.8rem;
        padding: 1rem;
    }

    /* --- Player Modal: near-fullscreen on mobile --- */
    .modal {
        padding: 0;
    }

    .modal-container {
        border-radius: 0;
        width: 100vw;
        height: 100vh;
        max-width: none;
        display: flex;
        flex-direction: column;
    }

    .player-content-wrapper {
        grid-template-columns: 1fr;
        height: 100%;
        max-height: none;
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .video-container {
        height: 56.25vw; /* 16:9 aspect ratio */
        min-height: 200px;
        max-height: 300px;
        flex-shrink: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .player-details {
        padding: 1.2rem;
        flex: 1;
        overflow-y: auto;
        gap: 1.2rem;
        /* Bottom padding for iOS safe area */
        padding-bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
    }

    .close-btn {
        top: 0.5rem;
        right: 0.75rem;
        font-size: 1.8rem;
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .player-logo {
        width: 48px;
        height: 48px;
    }

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

    .fav-toggle-btn {
        min-height: 44px;
        padding: 0.5rem 1.2rem;
    }

    .player-epg-section {
        padding: 1rem;
    }

    #video-error-message {
        padding: 2rem 1.5rem;
    }

    #video-error-message h3 {
        font-size: 1.1rem;
    }

    #video-error-message p {
        font-size: 0.85rem;
    }

    /* --- Empty state: mobile sizes --- */
    .empty-state {
        padding: 3rem 1.5rem;
    }

    .empty-state-icon {
        font-size: 2.5rem;
    }

    .empty-state-title {
        font-size: 1.2rem;
    }

    .empty-state-desc {
        font-size: 0.85rem;
    }

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

    /* --- Loading overlay: mobile compact --- */
    .loading-overlay {
        height: 300px;
    }

    .loading-overlay p {
        font-size: 0.9rem;
    }

    /* Skeleton cards: match mobile card width */
    .skeleton-card {
        flex: 0 0 160px;
        height: 190px;
    }

    .skeleton-card-image {
        height: 95px;
    }
}

/* ============================================
   RESPONSIVE: SMALL PHONE (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    #app-view {
        padding: 0.75rem;
        padding-bottom: 80px;
    }

    .hero-banner {
        padding: 1.5rem 1rem;
    }

    .hero-title {
        font-size: 1.35rem;
    }

    .hero-desc {
        font-size: 0.8rem;
    }

    .btn {
        font-size: 0.8rem;
        padding: 0.7rem 1rem;
    }

    /* Cards: even smaller */
    .channel-card {
        flex: 0 0 140px;
    }

    .card-logo-container {
        height: 80px;
    }

    .card-logo-img {
        max-height: 45px;
    }

    .card-details {
        padding: 0.6rem;
    }

    .card-channel-name {
        font-size: 0.75rem;
    }

    /* Row titles smaller */
    .row-title {
        font-size: 1rem;
    }

    /* Grid: still 2 columns but tighter */
    .grid-layout {
        gap: 0.6rem;
    }

    .categories-grid {
        gap: 0.6rem;
    }

    .category-card {
        height: 100px;
        padding: 0.75rem;
    }

    .category-card-icon {
        font-size: 1.5rem;
        margin-bottom: 0.3rem;
    }

    .category-card-name {
        font-size: 0.85rem;
    }

    .category-card-count {
        font-size: 0.7rem;
    }

    /* Footer: even more compact */
    .footer-info p,
    .footer-legal p {
        font-size: 0.75rem;
    }

    .footer-links a {
        font-size: 0.8rem;
    }
}

/* ============================================
   LANDSCAPE PHONE OPTIMIZATION
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    /* Player: take full width, minimal chrome */
    .video-container {
        height: 100vh;
        max-height: none;
    }

    .player-details {
        display: none; /* Hide sidebar in landscape player, maximize video */
    }

    .modal-container {
        border-radius: 0;
    }

    .close-btn {
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
    }

    /* Bottom nav: shorter in landscape */
    .mobile-bottom-nav {
        height: 48px;
    }

    .bottom-nav-label {
        display: none;
    }
}
