/* =====================================================
   TuNoticia – Mundial Playlist | Frontend CSS
   ===================================================== */

/* ── Variables y reset ──────────────────────────────── */
.tnmw-widget {
    --tnmw-accent:  #fb852b;
    --tnmw-bg:      #111318;
    --tnmw-surface: #1c2030;
    --tnmw-border:  rgba(255,255,255,.08);
    --tnmw-text:    #e8eaf0;
    --tnmw-muted:   #7a8099;
    --tnmw-radius:  8px;

    background: var(--tnmw-bg);
    border-radius: var(--tnmw-radius);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    color: var(--tnmw-text);
    border: 1px solid var(--tnmw-border);
    box-shadow: 0 8px 32px rgba(0,0,0,.45);
}

/* ── HEADER ─────────────────────────────────────────── */
.tnmw-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(90deg, var(--tnmw-accent) 0%, #c96800 100%);
}

.tnmw-widget-title {
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: .04em;
    color: #fff;
    text-transform: uppercase;
}

.tnmw-live-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: tnmw-pulse 1.8s ease-in-out infinite;
    opacity: .9;
}

@keyframes tnmw-pulse {
    0%, 100% { transform: scale(1);   opacity: .9; }
    50%       { transform: scale(1.5); opacity: .4; }
}

/* ── PLAYER ─────────────────────────────────────────── */
.tnmw-player-wrap {
    position: relative;
}

.tnmw-player-ratio {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
}

/* El div/iframe que inyecta la IFrame API */
#tnmw-yt-player,
#tnmw-yt-player iframe {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
    display: block;
}

/* ── Overlay de control ──────────────────────────── */
.tnmw-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    z-index: 10;
    /* Oculto hasta que el player esté listo */
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}

.tnmw-overlay.is-ready {
    opacity: 1;
    pointer-events: auto;
}

/* Mostrar overlay al hacer hover sobre el player */
.tnmw-player-wrap:hover .tnmw-overlay.is-ready {
    opacity: 1;
}

/* Cuando está reproduciendo: overlay casi invisible, solo aparece al hover */
.tnmw-overlay.is-playing {
    opacity: 0;
}
.tnmw-player-wrap:hover .tnmw-overlay.is-playing {
    opacity: 1;
    background: rgba(0, 0, 0, .25);
}

/* Botón play/pause */
.tnmw-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .65);
    border: 2px solid rgba(255, 255, 255, .8);
    color: #fff;
    cursor: pointer;
    transition: transform .15s, background .15s, border-color .15s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.tnmw-play-btn:hover {
    transform: scale(1.12);
    background: var(--tnmw-accent, #fb852b);
    border-color: var(--tnmw-accent, #fb852b);
}

.tnmw-play-btn svg {
    width: 24px;
    height: 24px;
    pointer-events: none;
}

/* Alternar ícono play/pause */
.tnmw-icon-pause              { display: none; }
.tnmw-overlay.is-playing .tnmw-icon-play  { display: none; }
.tnmw-overlay.is-playing .tnmw-icon-pause { display: block; }

.tnmw-now-playing {
    margin: 0;
    padding: 8px 12px 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--tnmw-text);
    background: var(--tnmw-surface);
    border-bottom: 1px solid var(--tnmw-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ── PLAYLIST ───────────────────────────────────────── */
.tnmw-playlist {
    max-height: 280px;
    overflow-y: auto;
    background: var(--tnmw-bg);
    scrollbar-width: thin;
    scrollbar-color: var(--tnmw-accent) transparent;
}

.tnmw-playlist::-webkit-scrollbar       { width: 3px; }
.tnmw-playlist::-webkit-scrollbar-track { background: transparent; }
.tnmw-playlist::-webkit-scrollbar-thumb { background: var(--tnmw-accent); border-radius: 4px; }

.tnmw-thumb {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 12px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--tnmw-border);
    cursor: pointer;
    text-align: left;
    transition: background .18s;
    color: var(--tnmw-text);
}

.tnmw-thumb:hover {
    background: rgba(255,255,255,.05);
}

.tnmw-thumb.is-active {
    background: rgba(255,255,255,.09);
    border-left: 3px solid var(--tnmw-accent);
}

.tnmw-thumb-img-wrap {
    position: relative;
    flex-shrink: 0;
    width: 68px;
    height: 38px;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
}

.tnmw-thumb-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: .85;
    transition: opacity .2s;
}

.tnmw-thumb:hover .tnmw-thumb-img-wrap img,
.tnmw-thumb.is-active .tnmw-thumb-img-wrap img {
    opacity: 1;
}

.tnmw-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    opacity: 0;
    background: rgba(0,0,0,.35);
    transition: opacity .2s;
}

.tnmw-thumb:hover .tnmw-thumb-play { opacity: 1; }
.tnmw-thumb.is-active .tnmw-thumb-play {
    opacity: 1;
    background: rgba(251,133,43,.55);
}

.tnmw-thumb-title {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--tnmw-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tnmw-thumb.is-active .tnmw-thumb-title {
    color: var(--tnmw-accent);
}

/* ── SPONSORS ───────────────────────────────────────── */
.tnmw-sponsors-wrap {
    padding: 12px 12px 14px;
    background: var(--tnmw-surface);
    border-top: 1px solid var(--tnmw-border);
}

.tnmw-sponsors-label {
    margin: 0 0 10px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tnmw-muted);
}

/* Grilla de 2 columnas para que los logos sean más grandes */
.tnmw-sponsors-track {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.tnmw-sponsor-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .08);
    overflow: hidden;
    opacity: .85;
    transition: opacity .2s, transform .2s, border-color .2s, background .2s;
    text-decoration: none;
}

.tnmw-sponsor-logo:hover {
    opacity: 1;
    transform: translateY(-2px);
    background: rgba(255, 255, 255, .12);
    border-color: var(--tnmw-accent, #fb852b);
}

.tnmw-sponsor-logo img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 56px;
    object-fit: contain;
}

