:root {
    --bg: #0b0b0b;
    --panel: #161616;
    /*--accent: #007bff;*/
    --accent: #0E4D64;
    --text: #eee;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, sans-serif;
    display: flex;
    height: 100vh;
    /*overflow: hidden;*/
}

.main-content {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
}

.video-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    position: relative;
    transition: box-shadow 0.2s ease;
    overflow: hidden;
    border-radius: 1.5vw;
    margin: 1.5vw;
}

video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    position: relative;
    z-index: 1;
    transform: scale(1.02);
}

.video-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-shadow: inset 0 0 30px 10px rgba(0,0,0,0.5);
    pointer-events: none;
    z-index: 2;
}

.sidebar {
    width: 320px;
    min-width: 320px;
    background: color-mix(in srgb, var(--panel), transparent 20%);
    border-left: 1px solid #282828;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

.header {
    padding: 12px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.header-top {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.header-top input {
    flex-grow: 1;
    margin-bottom: 0;
    min-width: 150px;
}

input[type="text"] {
    width: 100%;
    background: #000;
    border: 1px solid #333;
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
}

input[type="text"]:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.tabs {
    display: flex;
    background: #000;
    padding: 2px;
    border-radius: 4px;
}

.tab-btn {
    flex: 1;
    padding: 6px;
    font-size: 10px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    text-transform: uppercase;
}

.tab-btn.active {
    background: var(--accent);
    color: #fff;
    border-radius: 3px;
}

.channel-list {
    overflow-y: auto;
    flex-grow: 1;
    position: relative;
}

.channel-item {
    padding: 8px 12px;
    border-bottom: 1px solid #222;
    cursor: pointer;
    display: flex;
    align-items: center;
    position: relative;
}

.channel-item:hover {
    background: #222;
}

.channel-item.active {
    background: #002d5a;
}

.channel-item.focused {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    background: rgba(0, 123, 255, 0.1);
}

.channel-logo {
    width: 28px;
    height: 28px;
    margin-right: 10px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 3px;
}

.channel-info {
    flex-grow: 1;
    overflow: hidden;
    margin-right: 20px;
}

.channel-name {
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.current-program {
    font-size: 10px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.fav-star {
    position: absolute;
    right: 8px;
    color: #333;
    font-size: 16px;
}

.fav-star.active {
    color: #ffc107;
}

#fileInput {
    display: none;
}

.footer {
    padding: 12px;
    background: #1a1a1a;
    border-top: 1px solid #333;
}

.footer-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    color: #999;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-toggle:hover {
    color: #fff;
}

.footer-content {
    transition: max-height 0.3s ease;
    overflow: hidden;
}

.footer-content.collapsed {
    max-height: 0;
    margin: 0;
    padding: 0;
}

.footer .file-btn {
    display: block;
    background: #333;
    color: #fff;
    padding: 8px;
    text-align: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    border: 1px solid #444;
    margin-bottom: 8px;
    margin-top: 8px;
    width: 100%;
}

.footer .url-load {
    display: flex;
    gap: 4px;
}

.footer .url-load input {
    flex-grow: 1;
    margin-bottom: 0;
}

.footer .url-load button {
    background: #333;
    border: 1px solid #444;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    font-weight: bold;
    width: fit-content;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: #333;
}

/* Кастомный тултип */
.custom-tooltip {
    position: fixed;
    background: #000;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.5;
    max-width: 250px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
    border: 1px solid #444;
    z-index: 100000;
    pointer-events: none;
    white-space: pre-line;
}

.tooltip-current {
    font-weight: bold;
    color: #fff;
}

.tooltip-next {
    opacity: 0.7;
    font-size: 10px;
    margin-top: 2px;
}

/* Мобильные правки */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    .main-content {
        width: 100%;
        height: 40vh;
    }
    .video-wrapper {
        height: 100%;
        margin: 0;
        border-radius: 0;
        box-shadow: none !important;
    }
    .sidebar {
        width: 100%;
        min-width: 100%;
        height: 60vh;
        border-left: none;
        border-top: 1px solid #333;
    }
    .header-top {
        flex-wrap: wrap;
    }
    .video-wrapper::after {
        box-shadow: inset 0 0 15px 5px rgba(0,0,0,0.7);
    }
}

.channel-progress {
    margin-top: 5px;
    bottom: 0;
    left: 0;
    height: 2px;
    background: rgba(255,255,255,0.05);
    width: 100%;
}

.channel-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(65, 88, 208, 0.3) 0%, rgba(200, 80, 192, 0.3) 50%, rgba(255, 204, 112, 0.3) 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.channel-item.active .channel-progress-fill,
.channel-item.focused .channel-progress-fill,
.channel-item:hover .channel-progress-fill {
    background: linear-gradient(90deg, rgba(65, 88, 208, 0.7) 0%, rgba(200, 80, 192, 0.7) 50%, rgba(255, 204, 112, 0.7) 100%);
}