/* ------------------------------------------------------------------
 * video.css — คลังวิดีโอ (หน้ารายการและหน้ารายละเอียด)
 * ------------------------------------------------------------------ */

/* ---------- ตัวเล่นวิดีโอ : ล็อกสัดส่วน 16:9 ทุกขนาดจอ ---------- */
.mhs-video-player {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
    aspect-ratio: 16 / 9;
}

.mhs-video-player iframe,
.mhs-video-player video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    object-fit: contain;
    background: #000;
}

/* เบราว์เซอร์เก่าที่ยังไม่รู้จัก aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .mhs-video-player {
        height: 0;
        padding-bottom: 56.25%;
    }
}

/* ---------- รูปปกในหน้ารายการ ---------- */
.mhs-video-thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background: #222;
}

.mhs-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}

.mhs-video-thumb:hover img {
    transform: scale(1.06);
}

/* ปุ่มเล่นตรงกลางรูป */
.mhs-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(161, 0, 0, .88);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding-left: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
    transition: background .2s ease, transform .2s ease;
}

.mhs-video-thumb:hover .mhs-video-play {
    background: #a10000;
    transform: translate(-50%, -50%) scale(1.1);
}

/* ป้ายมุมรูป */
.mhs-video-tag {
    position: absolute;
    left: 8px;
    bottom: 8px;
    background: rgba(0, 0, 0, .7);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 5px 8px;
    border-radius: 4px;
}

@media (max-width: 767px) {
    .mhs-video-play {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
}

/* ------------------------------------------------------------------
 * ปุ่มจัดการรายคลิป (เห็นเฉพาะตอนล็อกอินเป็นแอดมิน)
 * ------------------------------------------------------------------ */
.mhs-video-admin,
.mhs-post-admin {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
    margin-bottom: 4px;
}

.mhs-video-admin form,
.mhs-post-admin form {
    margin: 0;
}

.mhs-video-admin .btn,
.mhs-post-admin .btn {
    font-size: 13px;
    padding: 5px 12px;
    line-height: 1.4;
}

@media (max-width: 575px) {
    .mhs-video-admin .btn,
    .mhs-post-admin .btn {
        font-size: 12px;
        padding: 5px 9px;
    }
}

/* ------------------------------------------------------------------
 * แถบแสดงความคืบหน้าการอัปโหลดวิดีโอ (หน้าแอดมิน)
 * ------------------------------------------------------------------ */
.vdo-progress {
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    padding: 14px;
    background: #fafafa;
}

.vdo-progress[hidden] {
    display: none !important;
}

.vdo-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

.vdo-progress-head span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vdo-progress-head strong {
    color: #a10000;
    font-size: 16px;
    flex: none;
}

.vdo-progress-track {
    height: 12px;
    border-radius: 20px;
    background: #e4e4e4;
    overflow: hidden;
}

.vdo-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 20px;
    background: linear-gradient(90deg, #a10000, #d94b00);
    transition: width .18s ease;
}

/* ตอนรอเซิร์ฟเวอร์ประมวลผล ไม่รู้ว่าเหลืออีกเท่าไหร่ ใช้ลายวิ่งแทน */
.vdo-progress-bar.is-indeterminate {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, .25) 25%, transparent 25%,
        transparent 50%, rgba(255, 255, 255, .25) 50%,
        rgba(255, 255, 255, .25) 75%, transparent 75%, transparent
    );
    background-size: 24px 24px;
    animation: vdo-progress-move 1s linear infinite;
}

@keyframes vdo-progress-move {
    from { background-position: 0 0; }
    to   { background-position: 24px 0; }
}

.vdo-progress-info {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 7px;
    font-size: 12px;
    color: #777;
}

@media (prefers-reduced-motion: reduce) {
    .vdo-progress-bar {
        transition: none;
    }
    .vdo-progress-bar.is-indeterminate {
        animation: none;
    }
}
