/* ── Contenedor principal ── */
#ytp-app {
    font-family: inherit;
    color: #fff;
    max-width: 100%;
}

/* ── Slider de playlists ── */
#ytp-slider-wrap {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 0 40px;
}

#ytp-slider {
    display: flex;
    gap: 12px;
    transition: transform 0.4s ease;
    will-change: transform;
    width: 100%;
}

.ytp-card {
    flex: 0 0 calc(33.333% - 8px);
    max-width: calc(33.333% - 8px);
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid transparent;
}

.ytp-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

.ytp-card.ytp-active {
    border-color: #FFD700;
}

.ytp-card img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}

.ytp-card-title {
    display: block;
    padding: 8px 10px;
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.3;
    color: #eee;
    background: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Flechas del slider ── */
.ytp-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    line-height: 1;
}

.ytp-arrow:hover       { background: rgba(255,215,0,0.8); color: #000; }
.ytp-arrow.ytp-disabled { opacity: 0.3; pointer-events: none; }
.ytp-prev { left: 2px; }
.ytp-next { right: 2px; }

/* ── Sección de videos ── */
#ytp-videos-section {
    margin-top: 32px;
}

#ytp-playlist-title {
    font-size: 1.2em;
    font-weight: 700;
    color: #cc2200;
    margin: 0 0 16px 0;
    border-left: 4px solid #cc2200;
    padding-left: 10px;
}

/* Grid sin scroll propio — la página hace el scroll */
#ytp-videos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ── Tarjeta de video ── */
.ytp-video-card {
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ytp-video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

.ytp-thumb-wrap {
    position: relative;
    overflow: hidden;
}

.ytp-thumb-wrap img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.ytp-video-card:hover .ytp-thumb-wrap img {
    transform: scale(1.04);
}

.ytp-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.65);
    color: #fff;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.ytp-video-card:hover .ytp-play-icon {
    opacity: 1;
}

.ytp-video-title {
    padding: 8px 10px;
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.4;
    color: #eee;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Loading / Error ── */
#ytp-loading {
    text-align: center;
    padding: 20px;
    color: #aaa;
    font-style: italic;
}

#ytp-error {
    color: #ff6b6b;
    padding: 12px;
    background: rgba(255,0,0,0.1);
    border-radius: 6px;
    margin-top: 12px;
}

/* ── Modal ── */
#ytp-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

#ytp-modal.ytp-modal-open {
    display: flex;
}

#ytp-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    cursor: pointer;
}

#ytp-modal-inner {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 900px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    animation: ytpModalIn 0.25s ease;
}

@keyframes ytpModalIn {
    from { opacity: 0; transform: scale(0.93); }
    to   { opacity: 1; transform: scale(1); }
}

#ytp-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 2;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

#ytp-modal-close:hover {
    background: #FFD700;
    color: #000;
}

#ytp-modal-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
}

#ytp-modal-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

#ytp-modal-title {
    padding: 10px 14px;
    font-size: 0.9em;
    font-weight: 600;
    color: #eee;
    margin: 0;
    background: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bloquear scroll del body cuando el modal está abierto */
body.ytp-no-scroll {
    overflow: hidden;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    #ytp-videos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ytp-card {
        flex: 0 0 calc(50% - 6px);
    }

    #ytp-modal-inner {
        width: 96%;
    }
}

@media (max-width: 480px) {
    #ytp-videos-grid {
        grid-template-columns: 1fr;
    }

    .ytp-card {
        flex: 0 0 80%;
    }
}
