/* ════════════════════════════════════════
   Iconos de competición / país
   ════════════════════════════════════════ */

.comp-icon {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

.comp-icon--empty {
    display: inline-block;
    width: 26px;
    height: 18px;
}

.comp-icon--text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 20px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .05em;
    background: var(--bg-3);
    color: var(--fg-2);
    text-transform: uppercase;
    flex-shrink: 0;
}


/* ════════════════════════════════════════
   Agenda — tabla de partidos
   ════════════════════════════════════════ */

.agenda-table {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Cabecera */
.agenda-row--head {
    display: grid;
    grid-template-columns: 72px 36px 1fr 130px;
    gap: 12px;
    padding: 8px 16px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--fg-3);
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.agenda-row--head span:first-child,
.agenda-row--head span:last-child {
    text-align: center;
}

/* Filas de evento */
.agenda-row {
    background: var(--bg-1);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: background .15s, border-color .15s;
}

.agenda-row.has-channels {
    cursor: pointer;
}

.agenda-row.has-channels:hover {
    background: var(--bg-2);
    border-color: rgba(229, 57, 53, .2);
}

.agenda-row.is-open {
    background: var(--bg-2);
    border-color: rgba(229, 57, 53, .35);
}

/* Botón principal de la fila */
.agenda-row__main {
    display: grid;
    grid-template-columns: 72px 36px 1fr 130px;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: default;
}

.agenda-row.has-channels .agenda-row__main {
    cursor: pointer;
}

.agenda-row__main:disabled {
    cursor: default;
}

/* Hora */
.cell-time {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    padding: 4px 8px;
    background: var(--bg-3);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--fg-0);
    letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.cell-time--none {
    color: var(--fg-3);
    font-weight: 400;
    background: transparent;
}

/* País / competición */
.cell-country {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Evento: liga + equipos */
.cell-event {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.cell-league {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--fg-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-teams {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--fg-0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Estado */
.cell-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    justify-self: center;
    white-space: nowrap;
}

.status--live {
    background: var(--live-grad);
    color: #fff;
    box-shadow: 0 2px 12px rgba(229, 57, 53, .35);
}

.status--scheduled {
    background: rgba(21, 101, 192, .18);
    color: #64b5f6;
    border: 1px solid rgba(21, 101, 192, .3);
}

.status--finished {
    background: rgba(255, 255, 255, .05);
    color: var(--fg-3);
}

/* Punto pulsante para "En vivo" */
@keyframes live-pulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%       { opacity: .5; transform: scale(.8); }
}

.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    flex-shrink: 0;
    animation: live-pulse 1.4s ease-in-out infinite;
}

/* Lista de señales expandida */
.agenda-row__streams {
    border-top: 1px solid var(--border);
    background: var(--bg-1);
    display: flex;
    flex-direction: column;
    padding: 4px 0;
    list-style: none;
    margin: 0;
}

.stream-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-2);
    text-decoration: none;
    transition: background .12s, color .12s;
}

.stream-link:hover {
    background: rgba(229, 57, 53, .08);
    color: var(--fg-0);
}

.stream-link__name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stream-link__quality {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .05em;
    color: var(--fg-3);
    background: var(--bg-3);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Estado vacío */
.agenda-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 64px 24px;
    text-align: center;
    color: var(--fg-3);
}

.agenda-empty__icon {
    font-size: 2.5rem;
    line-height: 1;
}

.agenda-empty p {
    font-size: 1rem;
    font-weight: 500;
}


/* ════════════════════════════════════════
   Grid de canales
   ════════════════════════════════════════ */

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.channel-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 12px 16px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: transform .18s, box-shadow .18s, border-color .18s, background .18s;
    cursor: pointer;
    text-decoration: none;
}

.channel-card:hover {
    transform: translateY(-3px);
    background: var(--bg-2);
    border-color: rgba(229, 57, 53, .3);
    box-shadow: 0 8px 24px rgba(229, 57, 53, .12);
}

/* Canal con múltiples señales — dropdown inline */
.channel-card--multi {
    overflow: visible;
    z-index: 1;
}

.channel-card--multi[aria-expanded="true"] {
    border-color: rgba(229, 57, 53, .45);
    box-shadow: 0 4px 20px rgba(229, 57, 53, .15);
    z-index: 200;
    transform: translateY(-2px);
    background: var(--bg-2);
}

.channel-card__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    background: var(--bg-2);
    border: 1px solid rgba(229, 57, 53, .2);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
    z-index: 300;
    list-style: none;
    margin: 0;
    padding: 6px 0;
    overflow: hidden;
}

.channel-dropdown-item {
    display: block;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-1);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background .12s, color .12s;
}

.channel-dropdown-item:hover {
    background: rgba(229, 57, 53, .1);
    color: var(--fg-0);
}

.channel-card__logo-wrap {
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-2);
}

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

.channel-logo-placeholder {
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    border-radius: var(--radius-sm);
    background: var(--accent-grad);
    color: #fff;
    letter-spacing: -.02em;
}

.channel-card__name {
    font-size: 11px;
    font-weight: 600;
    color: var(--fg-2);
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
}

.channel-card__streams-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 9px;
    font-weight: 700;
    background: var(--accent-grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ════════════════════════════════════════
   Página de reproductor (single-ad_channel)
   ════════════════════════════════════════ */

.player-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stream-picker-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.stream-picker-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stream-picker-header__logo .channel-logo,
.stream-picker-header__logo .channel-logo-placeholder {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stream-picker-header__sub {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--accent-from);
    margin-bottom: 4px;
}

.stream-picker-header__title {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--fg-0);
    line-height: 1.1;
}

.stream-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.stream-pick-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: transform .18s, border-color .18s, background .18s;
}

.stream-pick-card:hover {
    transform: translateY(-2px);
    background: var(--bg-2);
    border-color: rgba(229, 57, 53, .35);
}

.stream-pick-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-grad);
    color: #fff;
    font-size: 13px;
    flex-shrink: 0;
}

.stream-pick-card__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--fg-0);
    line-height: 1.2;
}

.player-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    color: var(--fg-2);
    background: var(--bg-2);
    border: 1px solid var(--border);
    flex-shrink: 0;
    transition: background .15s, color .15s;
    text-decoration: none;
}

.player-back:hover {
    background: var(--bg-3);
    color: var(--fg-0);
}

.player-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.player-channel {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-from);
}

.player-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--fg-0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-header .channel-logo,
.player-header .channel-logo-placeholder {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    font-size: 1rem;
}

.player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.player-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.player-no-embed,
.player-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 64px 24px;
    text-align: center;
    color: var(--fg-3);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    background: var(--accent-grad);
    color: #fff;
    text-decoration: none;
    transition: opacity .15s;
}

.btn-back:hover {
    opacity: .88;
}


/* ════════════════════════════════════════
   Chat panel (reproductor)
   ════════════════════════════════════════ */

.player-layout {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.player-video-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.btn-chat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-2);
    color: var(--fg-1);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    flex-shrink: 0;
    white-space: nowrap;
    font-family: var(--font-sans);
}

.btn-chat-toggle:hover {
    background: var(--bg-3);
    color: var(--fg-0);
    border-color: rgba(99, 102, 241, .4);
}


.chat-panel {
    width: 340px;
    flex-shrink: 0;
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.chat-panel.is-hidden {
    display: none;
}


.chat-panel__iframe {
    width: 100%;
    height: 0;        /* flex: 1 distribuye el espacio restante */
    flex: 1;
    border: none;
    display: block;
    min-height: 0;
}

/* ── Single reproductor: ocupa toda la altura disponible ── */

.single-ad_channel .site-content {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.single-ad_channel .player-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.single-ad_channel .player-section {
    flex: 1;
    gap: 0;
}

.single-ad_channel .player-header {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-1);
    flex-shrink: 0;
}

.single-ad_channel .player-layout {
    flex: 1;
}

.single-ad_channel .player-video-wrap {
    flex: 1;
}

.single-ad_channel .player-wrapper {
    aspect-ratio: unset;
    height: 100%;
    border-radius: 0;
}

/* ── Estados del botón de chat ── */

.btn-chat-toggle__close {
    display: none;
}

.btn-chat-toggle[aria-expanded="true"] .btn-chat-toggle__open  { display: none; }
.btn-chat-toggle[aria-expanded="true"] .btn-chat-toggle__close { display: inline; }

.btn-chat-toggle[aria-expanded="false"] .btn-chat-toggle__open  { display: inline; }
.btn-chat-toggle[aria-expanded="false"] .btn-chat-toggle__close { display: none; }

.btn-chat-toggle[aria-expanded="false"] {
    background: var(--accent-grad);
    border-color: transparent;
    color: #fff;
}

.btn-chat-toggle[aria-expanded="true"] {
    background: rgba(99, 102, 241, .12);
    border-color: rgba(99, 102, 241, .45);
    color: var(--accent-from);
}

@media (max-width: 900px) {
    .player-layout {
        flex-direction: column;
    }
    .chat-panel {
        width: 100%;
        height: 400px;
    }
    .single-ad_channel .player-wrapper {
        aspect-ratio: 16 / 9;
        height: auto;
    }
}


/* ════════════════════════════════════════
   Responsive
   ════════════════════════════════════════ */

@media (max-width: 640px) {
    .agenda-row--head {
        display: none;
    }

    /* Fila 1: hora | país | estado — Fila 2: nombre del evento (ancho completo) */
    .agenda-row__main {
        grid-template-columns: auto auto 1fr;
        grid-template-rows: auto auto;
        gap: 6px 10px;
        padding: 10px 14px;
    }

    .cell-time    { grid-column: 1; grid-row: 1; }
    .cell-country { grid-column: 2; grid-row: 1; }

    .cell-status {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        align-self: center;
    }

    .cell-event {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .cell-league {
        white-space: normal;
    }

    .cell-teams {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        font-size: 0.9375rem;
        line-height: 1.3;
    }

    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
}
