/* =========================
   TRANG VIDEO CHI TIẾT
   ========================= */

/* Layout 2 cột desktop */
.watch-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
    align-items: start;
}

.watch-main,
.watch-side {
    min-width: 0;
}

/* =========================
   KHUNG PLAYER
   ========================= */

/* Khung player */
.player-shell {
    position: relative;
    width: 100%;
    background: #000;
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;

    /* Cố định khung như YouTube */
    aspect-ratio: 16 / 9;
}

/* Lớp overlay */
.player-shell--overlay {
    position: relative;
}

/* Video native */
.player-shell > video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: #000;

    /* Giữ video gọn trong khung, không tràn */
    object-fit: contain;
}

/* Plyr / HLS / DASH wrapper */
.player-shell .plyr,
.player-shell .plyr__video-wrapper,
.player-shell .plyr video {
    width: 100% !important;
    height: 100% !important;
    background: #000;
}

/* Video bên trong Plyr */
.player-shell .plyr video {
    object-fit: contain !important;
}

/* =========================
   NÚT BẬT TIẾNG
   ========================= */

.player-unmute-overlay {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 15, 15, 0.78);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    opacity: 0.96;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

.player-unmute-overlay:hover {
    background: rgba(15, 15, 15, 0.92);
}

.player-unmute-overlay.hidden {
    display: none;
}

.player-unmute-overlay__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.player-unmute-overlay__text {
    line-height: 1;
}

/* =========================
   TIÊU ĐỀ + META
   ========================= */

.watch-title {
    margin: 16px 0 12px;
    font-size: 1.22rem;
    line-height: 1.35;
    font-weight: 700;
    color: var(--text);
}

.watch-meta-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

/* Channel */
.watch-channel {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.watch-channel-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
}

.watch-channel-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text);
    line-height: 1.35;
}

.watch-channel-sub {
    color: var(--text-soft);
    font-size: 0.82rem;
    line-height: 1.35;
}

/* Nút hành động */
.watch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.watch-btn {
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 0;
    background: var(--btn-bg);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.watch-btn:hover {
    background: var(--btn-bg-hover);
}

.watch-btn.is-liked {
    background: rgba(255, 45, 45, 0.12);
    color: #d93025;
}

/* =========================
   MÔ TẢ + NỘI DUNG
   ========================= */

.watch-desc,
.watch-content-box {
    margin-top: 12px;
    padding: 16px;
    border-radius: 16px;
    background: var(--card);
    border: 1px solid var(--border);
}

.watch-desc-meta,
.watch-content-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text);
}

.watch-desc-body,
.watch-content-body {
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.6;
    word-break: break-word;
}

.watch-desc-body img,
.watch-content-body img,
.watch-desc-body iframe,
.watch-content-body iframe,
.watch-desc-body table,
.watch-content-body table,
.watch-desc-body video,
.watch-content-body video {
    max-width: 100%;
}

/* =========================
   VIDEO LIÊN QUAN
   ========================= */

.related-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.related-card {
    display: grid;
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 10px;
}

.related-thumb {
    border-radius: 14px;
    overflow: hidden;
    background: var(--card-2);
    border: 1px solid var(--border);
}

.related-info {
    min-width: 0;
}

.related-title {
    margin: 0 0 6px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-desc,
.related-meta {
    color: var(--text-soft);
    font-size: 0.82rem;
    line-height: 1.4;
}

.related-meta {
    margin-top: 2px;
}

.related-loading {
    display: none;
    justify-content: center;
    padding: 18px 0;
    color: var(--text-soft);
}

.related-loading.show {
    display: flex;
}

/* =========================
   EMPTY STATE
   ========================= */

.related-empty {
    padding: 28px 20px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: var(--card);
    text-align: center;
}

.related-empty__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--btn-bg);
    color: var(--text-soft);
    font-size: 1.6rem;
}

.related-empty__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.related-empty__text {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-soft);
    margin-bottom: 16px;
}

.related-empty__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 128px;
    height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--btn-bg);
    color: var(--text);
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.related-empty__btn:hover {
    background: var(--btn-bg-hover);
}

/* =========================
   POPUP CHIA SẺ
   ========================= */

.modal-open-custom {
    overflow: hidden;
}

.share-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
}

.share-modal.show {
    display: block;
}

.share-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.share-modal__dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    width: min(560px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.share-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.share-modal__title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text);
}

.share-modal__close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: var(--btn-bg);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.share-modal__close:hover {
    background: var(--btn-bg-hover);
}

.share-platforms {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.share-platform {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    color: var(--text);
}

.share-platform__icon {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--btn-bg);
    border: 1px solid var(--border);
    font-size: 1.2rem;
    font-weight: 700;
}

.share-platform__text {
    font-size: 0.82rem;
    color: var(--text-soft);
}

.share-platform:hover .share-platform__icon {
    background: var(--btn-bg-hover);
}

.share-copy-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.share-copy-input {
    flex: 1;
    min-width: 0;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    padding: 0 12px;
}

.share-copy-btn-popup {
    height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 0;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

/* =========================
   PLYR CUSTOM
   ========================= */

.plyr {
    border-radius: 18px;
}

.plyr--video {
    background: #000;
}

.plyr__control--overlaid {
    background: rgba(255, 45, 45, 0.9);
}

.plyr__menu__container {
    border-radius: 14px;
}

.plyr--full-ui input[type="range"] {
    color: var(--brand);
}

.plyr__control--loop-custom {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    min-width: auto;
}

.plyr__control--loop-custom .bi {
    font-size: 1rem;
    line-height: 1;
}

.plyr__control--loop-custom .plyr__custom-text {
    font-size: 0.82rem;
    line-height: 1;
}

.plyr__control--loop-custom.is-active {
    background: rgba(255, 45, 45, 0.18) !important;
    color: #ff4d4f !important;
}

/* =========================
   TABLET
   ========================= */

@media (max-width: 1199.98px) {
    .watch-layout {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .watch-side {
        margin-top: 4px;
    }
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 767.98px) {
    .watch-layout {
        display: block;
    }

    .watch-main,
    .watch-side {
        width: 100%;
    }

    /* Player full width kiểu YouTube mobile */
    .player-shell {
        width: calc(100% + 24px);
        margin-left: -12px;
        margin-right: -12px;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        aspect-ratio: 16 / 9;
    }

    .plyr {
        border-radius: 0;
    }

    .watch-title {
        font-size: 1.02rem;
        margin: 14px 0 10px;
    }

    .watch-meta-top {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .watch-channel {
        align-items: center;
    }

    .watch-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .watch-actions::-webkit-scrollbar {
        display: none;
    }

    .watch-btn {
        flex: 0 0 auto;
        height: 38px;
        font-size: 0.86rem;
        padding: 0 12px;
    }

    .watch-desc,
    .watch-content-box {
        padding: 14px;
        border-radius: 14px;
    }

    .related-card {
        grid-template-columns: 140px minmax(0, 1fr);
    }

    .share-modal__dialog {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        padding: 16px;
        border-radius: 16px;
    }

    .share-platforms {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .share-copy-row {
        flex-direction: column;
        align-items: stretch;
    }

    .share-copy-btn-popup {
        width: 100%;
    }

    .player-unmute-overlay {
        top: 12px;
        right: 12px;
        height: 38px;
        padding: 0 12px;
        font-size: 0.84rem;
    }

    .plyr__control--loop-custom .plyr__custom-text {
        display: none;
    }
}