* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 1rem;
    padding: 1rem;
    height: 100vh;
    overflow: hidden;
}

.channels-sidebar {
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    height: 100%;
}

.sidebar-header {
    padding: 1rem;
    background: #2a2a2a;
    border-bottom: 1px solid #3a3a3a;
    flex-shrink: 0;
}

.logo {
    padding: 0 0 1rem 0;
    border-bottom: 1px solid #3a3a3a;
    margin-bottom: 1rem;
    text-align: center;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    justify-content: flex-start;
}

.logo-img {
    width: 150px;
    height: 60px;
    object-fit: contain;
}

.filters {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-input, .category-select {
    padding: 0.5rem;
    background: #333;
    border: 1px solid #444;
    color: #fff;
    border-radius: 6px;
    font-size: 0.9rem;
}

.search-input:focus, .category-select:focus {
    outline: none;
    border-color: #007bff;
}

.channels-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.channels-counter {
    font-size: 0.7rem;
    color: #888;
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.25rem;
    background: #2a2a2a;
    border-radius: 4px;
    display: none;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    text-decoration: none;
    color: #e0e0e0;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.channel-item:hover {
    background: #2c2c2c;
}

.channel-item.active {
    background: #007bff20;
    border-left: 3px solid #007bff;
}

.channel-logo-wrapper {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 12px;
    padding: 2px;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.channel-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    background: #ffffff;
    display: block;
}

.channel-item.active .channel-logo-wrapper {
    background: linear-gradient(135deg, #007bff, #00ff88);
    box-shadow: 0 0 8px rgba(0,123,255,0.5);
}

.channel-info-block {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.channel-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-current-program {
    font-size: 0.7rem;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.channel-item.active .channel-current-program {
    color: #007bff;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #3a3a3a;
    background: #2a2a2a;
    flex-shrink: 0;
}

.sidebar-contacts {
    text-align: center;
}

.sidebar-contacts p {
    margin: 0.3rem 0;
    font-size: 0.75rem;
    color: #aaa;
}

.sidebar-contacts a {
    color: #007bff;
    text-decoration: none;
}

.sidebar-contacts a:hover {
    color: #00ff88;
    text-decoration: underline;
}

.sidebar-copyright-mobile {
    display: none;
}

.player-area {
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    height: 100%;
}

.player-wrapper {
    background: #000;
    position: relative;
    padding-top: 56.25%;
    flex-shrink: 0;
    min-height: 0;
}

#tvPlayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: contain;
}

.channel-info {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.channel-info h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.channel-info p {
    font-size: 0.9rem;
    color: #ccc;
}

.program-sidebar {
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    height: 100%;
}

.program-header {
    padding: 1rem;
    background: #2a2a2a;
    border-bottom: 1px solid #3a3a3a;
    flex-shrink: 0;
}

.program-header h2 {
    font-size: 1.2rem;
}

.program-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.program-list.empty-program,
.program-list.homepage-empty {
    flex: 1;
}

.program-item {
    padding: 0.8rem;
    border-bottom: 1px solid #2c2c2c;
    transition: all 0.2s ease;
    position: relative;
}

.program-item.current {
    background: #007bff20;
    border-left: 3px solid #007bff;
    margin-left: -3px;
}

.program-item.current .program-time::before {
    content: "▶ ";
    color: #007bff;
    font-size: 0.7rem;
}

.program-item.past {
    opacity: 0.6;
    filter: grayscale(0.3);
}

.program-item.past .program-time {
    color: #666;
}

.program-item.past .program-title {
    color: #888;
}

.program-item.past .program-desc {
    color: #666;
}

.program-item.past .program-time::before {
    content: "✓ ";
    color: #4caf50;
    font-size: 0.7rem;
}

.program-item.past:hover {
    opacity: 0.8;
    filter: grayscale(0.1);
    background: #2a2a2a;
}

.program-item:not(.current):not(.past) {
    opacity: 1;
}

.program-item:not(.current):not(.past) .program-time {
    color: #aaa;
}

.program-item:not(.current):not(.past) .program-title {
    color: #e0e0e0;
}

.program-item.past + .program-item:not(.past) {
    border-top: 2px solid #007bff40;
    margin-top: 4px;
    padding-top: 12px;
}

.program-time {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 4px;
}

.program-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.program-desc {
    font-size: 0.8rem;
    color: #bbb;
}

.no-program {
    padding: 1rem;
    text-align: center;
    color: #aaa;
}

.select-channel-message {
    padding: 1rem;
}

.program-footer {
    padding: 0.8rem;
    border-top: 1px solid #3a3a3a;
    background: #2a2a2a;
    flex-shrink: 0;
}

.program-copyright {
    text-align: center;
}

.program-copyright p {
    margin: 0.2rem 0;
    font-size: 0.7rem;
    color: #aaa;
}

.program-copyright p:first-child {
    color: #fff;
    font-weight: 500;
}

.info-wrapper {
    padding: 2rem;
    overflow-y: auto;
    height: 100%;
}

.info-wrapper h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #fff;
}

.info-wrapper > p {
    font-size: 1rem;
    line-height: 1.6;
    color: #ccc;
    margin-bottom: 2rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature {
    background: #2a2a2a;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.feature h2 {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    color: #fff;
}

.feature p {
    font-size: 0.9rem;
    color: #bbb;
    line-height: 1.5;
}

.start-message {
    background: #007bff20;
    border: 1px solid #007bff;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-top: 2rem;
}

.start-message p {
    font-size: 1.1rem;
    color: #fff;
    margin: 0;
}

.start-message p:first-child {
    font-weight: bold;
}

.channels-list::-webkit-scrollbar,
.program-list::-webkit-scrollbar {
    width: 6px;
}

.channels-list::-webkit-scrollbar-track,
.program-list::-webkit-scrollbar-track {
    background: #2a2a2a;
}

.channels-list::-webkit-scrollbar-thumb,
.program-list::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 3px;
}

.channels-list::-webkit-scrollbar-thumb:hover,
.program-list::-webkit-scrollbar-thumb:hover {
    background: #777;
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 240px 1fr 280px;
        gap: 0.8rem;
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
    }
    
    .app-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
        height: auto;
        overflow: visible;
    }
    
    .player-area {
        order: 1;
        min-height: 500px;
    }
    
    .program-sidebar {
        order: 2;
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: 60vh;
    }
    
    .channels-sidebar {
        order: 3;
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: 85vh;
    }
    
    .program-list {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding: 0.5rem;
    }
    
    .program-list.empty-program,
    .program-list.homepage-empty {
        flex: 0 0 auto;
        overflow-y: visible;
    }
    
    .channels-list {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding: 0.5rem;
    }
    
    .program-footer {
        display: none;
    }
    
    .sidebar-copyright-mobile {
        display: block;
        margin-top: 0.8rem;
        padding-top: 0.8rem;
        border-top: 1px solid #3a3a3a;
        text-align: center;
    }
    
    .sidebar-copyright-mobile p {
        margin: 0.2rem 0;
        font-size: 0.7rem;
        color: #aaa;
    }
    
    .sidebar-copyright-mobile p:first-child {
        color: #fff;
        font-weight: 500;
    }
    
    .channel-logo-wrapper {
        width: 60px;
        height: 60px;
        border-radius: 10px;
    }
    
    .channel-logo {
        border-radius: 8px;
    }
    
    .logo-link {
        justify-content: flex-start;
    }
    
    .logo-img {
        width: 135px;
        height: 50px;
    }
    
    .info-wrapper {
        padding: 1rem;
    }
    
    .features {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .feature {
        padding: 1rem;
    }
    
    .channel-name {
        font-size: 1rem;
    }
    
    .channel-current-program {
        font-size: 0.8rem;
    }
    
    .program-title {
        font-size: 1rem;
    }
    
    .program-time {
        font-size: 0.85rem;
    }
    
    .program-item.past {
        opacity: 0.5;
    }
    
    .program-item.past .program-time::before,
    .program-item.current .program-time::before {
        font-size: 0.6rem;
    }
    
    .select-channel-message,
    .no-program {
        padding: 0.8rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .player-area {
        min-height: 400px;
    }
    
    .program-sidebar {
        max-height: 55vh;
    }
    
    .channels-sidebar {
        max-height: 80vh;
    }
    
    .channel-logo-wrapper {
        width: 55px;
        height: 55px;
        border-radius: 8px;
        padding: 1.5px;
    }
    
    .channel-logo {
        border-radius: 6px;
    }
    
    .logo-img {
        width: 130px;
        height: 50px;
    }
    
    .channel-info h1 {
        font-size: 1.2rem;
    }
    
    .feature h2 {
        font-size: 1rem;
    }
    
    .feature p {
        font-size: 0.8rem;
    }
    
    .sidebar-contacts p,
    .sidebar-copyright-mobile p {
        font-size: 0.65rem;
    }
    
    .select-channel-message,
    .no-program {
        padding: 0.6rem;
        font-size: 0.8rem;
    }
}