/**
 * YouTube Sidebar Video Popup — Frontend Styles
 * ──────────────────────────────────────────────
 * Prefix: ysp-
 * YouTube-style vertical recommendation list + modal player.
 */

/* ─────────────────────────────────────────────
   Video List Container
   ───────────────────────────────────────────── */
.ysp-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ─────────────────────────────────────────────
   Video Item Row  (thumbnail left + title right)
   ───────────────────────────────────────────── */
.ysp-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-bottom: 1px solid transparent;
    transition: background-color 0.15s ease;
    box-sizing: border-box;
    outline: none;
}

.ysp-item:last-child {
    border-bottom: none;
}

.ysp-item:hover,
.ysp-item:focus-visible {
    background-color: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
}

.ysp-item:hover .ysp-thumbnail {
    transform: scale(1.03);
}

/* ─────────────────────────────────────────────
   Thumbnail Wrapper  (16 : 9)
   ───────────────────────────────────────────── */
.ysp-thumb-wrap {
    position: relative;
    flex-shrink: 0;
    width: 45%;
    max-width: 168px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background-color: #e8e8e8;
}

/* ─────────────────────────────────────────────
   Thumbnail Image
   ───────────────────────────────────────────── */
.ysp-thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    transition: transform 0.25s ease;
}

/* ─────────────────────────────────────────────
   Title
   ───────────────────────────────────────────── */
.ysp-title {
    margin: 0;
    padding: 2px 0 0 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: #0f0f0f;
    word-break: break-word;
    overflow-wrap: break-word;
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ysp-item:hover .ysp-title {
    color: #065fd4;
}

/* ─────────────────────────────────────────────
   Empty state
   ───────────────────────────────────────────── */
.ysp-empty {
    padding: 16px 0;
    color: #888;
    font-size: 13px;
    text-align: center;
}

/* ═════════════════════════════════════════════
   Modal Overlay
   ═════════════════════════════════════════════ */
.ysp-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.82);
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    animation: yspFadeIn 0.2s ease-out;
}

.ysp-modal-overlay--active {
    display: flex;
}

@keyframes yspFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ─────────────────────────────────────────────
   Modal Dialog
   ───────────────────────────────────────────── */
.ysp-modal {
    position: relative;
    width: 100%;
    max-width: 960px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* ─────────────────────────────────────────────
   Responsive 16:9 Player Container
   ───────────────────────────────────────────── */
.ysp-player {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
}

.ysp-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ─────────────────────────────────────────────
   Close Button
   ───────────────────────────────────────────── */
.ysp-close {
    position: absolute;
    top: -40px;
    right: 0;
    z-index: 10;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}

.ysp-close:hover,
.ysp-close:focus-visible {
    background: rgba(255, 255, 255, 0.3);
    outline: none;
}

/* ─────────────────────────────────────────────
   Body scroll lock
   ───────────────────────────────────────────── */
.ysp-body-locked {
    overflow: hidden !important;
}

/* ─────────────────────────────────────────────
   Responsive — narrow sidebars / mobile
   ───────────────────────────────────────────── */
@media (max-width: 360px) {
    .ysp-thumb-wrap {
        width: 40%;
        max-width: 120px;
    }
    .ysp-title {
        font-size: 13px;
        -webkit-line-clamp: 2;
    }
}

@media (max-width: 600px) {
    .ysp-modal {
        max-width: 100%;
        border-radius: 8px;
    }
    .ysp-close {
        top: -36px;
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
}
