/* Design System & Tokens */
:root {
    --bg-color: #0b0c10;
    --card-bg: rgba(20, 22, 37, 0.6);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-border-hover: rgba(99, 102, 241, 0.4);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Neon Accents */
    --accent-primary: #6366f1; /* Indigo */
    --accent-secondary: #8b5cf6; /* Violet */
    --accent-glow: rgba(99, 102, 241, 0.15);
    --success: #10b981; /* Live green */
    --success-glow: rgba(16, 185, 129, 0.2);
    
    /* Fonts */
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Layout */
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background Glow Effects */
.glow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.18;
}

.sphere-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    top: -10%;
    right: -10%;
    animation: float-slow 20s infinite alternate;
}

.sphere-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    bottom: -15%;
    left: -10%;
    animation: float-slow 25s infinite alternate-reverse;
}

@keyframes float-slow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 40px) scale(1.1); }
}

/* Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.card-blur {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    text-decoration: none;
    transition: var(--transition-smooth);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-color: rgba(99, 102, 241, 0.2);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Header */
.app-header {
    padding: 24px 0;
    border-bottom: 1px solid var(--card-border);
    background: rgba(11, 12, 16, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 60%, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sub-logo {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.api-links {
    display: flex;
    gap: 12px;
}

/* Main Section Controls */
.controls-section {
    margin-top: 32px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.search-box input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    outline: none;
    transition: var(--transition-smooth);
}

.search-box input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px var(--accent-glow);
    background: rgba(0, 0, 0, 0.4);
}

.search-box input:focus + .search-icon {
    color: var(--accent-primary);
}

/* Category Filters */
.category-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.category-filters::-webkit-scrollbar {
    height: 4px;
}

.category-filters::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.filter-chip {
    flex-shrink: 0;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.filter-chip:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.filter-chip.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-color: transparent;
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* Grid & Layout Section */
.epg-grid-section {
    margin-top: 40px;
    margin-bottom: 60px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--card-border);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Grid layout */
.epg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

/* Channel Card */
.channel-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    cursor: pointer;
    position: relative;
    transition: var(--transition-smooth);
    overflow: hidden;
}

.channel-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: var(--transition-smooth);
}

.channel-card:hover {
    border-color: var(--card-border-hover);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
    background: rgba(24, 27, 47, 0.7);
}

.channel-card:hover::before {
    opacity: 1;
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.logo-wrapper {
    width: 54px;
    height: 54px;
    border-radius: var(--border-radius-md);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.channel-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.channel-title-wrap {
    flex-grow: 1;
    min-width: 0;
}

.channel-name {
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ffffff;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success);
    background: var(--success-glow);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Currently Playing */
.current-show {
    flex-grow: 1;
    margin-bottom: 16px;
}

.show-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.show-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.show-category {
    font-size: 0.75rem;
    color: var(--accent-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Progress bar container */
.progress-container {
    height: 6px;
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    margin: 8px 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 3px;
    width: 0%;
    transition: width 1s linear;
}

/* Next Show */
.next-show {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
    font-size: 0.85rem;
}

.next-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}

.next-title {
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading & Empty States */
.loading-state, .empty-state {
    grid-column: 1 / -1;
    padding: 60px 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 8, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 90%;
    max-width: 650px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
}

.modal-channel-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.modal-channel-logo {
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius-md);
    background: white;
    padding: 6px;
    object-fit: contain;
}

.modal-channel-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Program List Item in Modal */
.prog-item {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: relative;
    transition: var(--transition-smooth);
}

.prog-item:last-child {
    border-bottom: none;
}

.prog-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.05) 0%, transparent 100%);
    padding-left: 12px;
    border-left: 3px solid var(--accent-primary);
}

.prog-time-col {
    width: 80px;
    flex-shrink: 0;
    font-weight: 600;
}

.prog-start {
    font-size: 1.1rem;
    color: #ffffff;
    display: block;
}

.prog-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.prog-content-col {
    flex-grow: 1;
    min-width: 0;
}

.prog-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.prog-badge-live {
    font-size: 0.7rem;
    color: var(--success);
    background: var(--success-glow);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.prog-category-badge {
    font-size: 0.7rem;
    color: var(--accent-secondary);
    background: rgba(139, 92, 246, 0.1);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.prog-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Footer */
.app-footer {
    margin-top: auto;
    padding: 30px 0;
    border-top: 1px solid var(--card-border);
    background: rgba(11, 12, 16, 0.8);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        text-align: center;
    }
    
    .logo-area {
        flex-direction: column;
        gap: 6px;
    }
    
    .api-links {
        width: 100%;
        justify-content: center;
    }
    
    .epg-grid {
        grid-template-columns: 1fr;
    }
    
    .controls-section {
        padding: 16px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .prog-item {
        flex-direction: column;
        gap: 6px;
    }
    
    .prog-time-col {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .prog-item.active {
        padding-left: 12px;
    }
}
