.tv-channels-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-x: hidden;
    box-sizing: border-box;
}

.tv-channels-modal.active {
    display: flex;
}

.tv-channels-modal .modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
}

.tv-channels-modal .modal__content {
    position: relative;
    z-index: 1;
    background: var(--surface, #444654);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius, 12px);
    max-width: 920px;
    width: calc(100% - 32px);
    max-height: min(85vh, 900px);
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow: hidden;
    min-width: 0;
    box-sizing: border-box;
    color: var(--text, #e5e5e5);
}

.tv-channels-modal .modal__close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

.tv-channels-modal .modal__close:hover {
    color: rgba(255, 255, 255, 0.9);
}

.tv-channels-modal__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 16px;
    padding-right: 36px;
}

.tv-channels-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
    min-width: 0;
}

.tv-channels-search {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
    background: rgba(0, 0, 0, 0.15);
    color: var(--text, #fff);
    font: inherit;
    box-sizing: border-box;
}

.tv-channels-search::placeholder {
    color: var(--text-secondary, rgba(255, 255, 255, 0.45));
}

.tv-channels-count {
    font-size: 13px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.55));
    white-space: nowrap;
}

.tv-channels-list {
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 8px;
    flex: 1;
    min-width: 0;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--accent, #ff2a32) rgba(255, 255, 255, 0.08);
}

.tv-channels-list::-webkit-scrollbar {
    width: 8px;
}

.tv-channels-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
}

.tv-channels-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ff4d55 0%, var(--accent, #ff2a32) 50%, #d91f27 100%);
    border-radius: 999px;
    border: 2px solid rgba(20, 20, 24, 0.9);
}

.tv-channels-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent, #ff2a32);
}

.tv-channels-section {
    margin-bottom: 24px;
    min-width: 0;
}

.tv-channels-section__title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--accent, #ff2a32);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.tv-channels-premium-note {
    display: inline;
    margin-left: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #ffd700;
}

@media (max-width: 640px) {
    .tv-channels-premium-note {
        display: block;
        margin-left: 0;
        margin-top: 4px;
    }
}

.tv-channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
    gap: 10px;
    min-width: 0;
}

.tv-channel-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.12);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    min-width: 0;
    overflow: hidden;
}

.tv-channel-card__logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
}

.tv-channel-card__logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.tv-channel-card span {
    font-size: 13px;
    line-height: 1.3;
    color: var(--text, rgba(255, 255, 255, 0.92));
    min-width: 0;
    overflow-wrap: anywhere;
}

.tv-channels-loading,
.tv-channels-error,
.tv-channels-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.65));
}

.tv-channels-error {
    color: #ff6b6b;
}

.btn-tv-channels-preview {
    width: 100%;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: var(--radius, 12px);
    border: 1px solid var(--border, #5a5c61);
    background: rgba(0, 0, 0, 0.12);
    color: var(--text, #e5e5e5);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-tv-channels-preview:hover {
    background: rgba(0, 0, 0, 0.22);
    border-color: var(--accent, #ff2a32);
    color: var(--text, #fff);
}
