/* =========================
   TRANG SHORT KIỂU REELS
   ========================= */

/* Bỏ padding mặc định của layout khi vào trang short */
.app-main:has(.shorts-page) .page-content {
    padding: 0 !important;
}

/* =========================
   KHUNG NGOÀI TRANG SHORTS
   ========================= */
.shorts-page {
    width: 100%;
    max-width: 560px; /* desktop giữ khung dọc */
    margin: 0 auto;
    height: calc(100dvh - var(--topbar-h));
    min-height: calc(100dvh - var(--topbar-h));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #000;
}

/* =========================
   FEED CUỘN DỌC
   ========================= */
.shorts-feed {
    flex: 1;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    border-radius: 0;
    background: #000;
}

.shorts-feed::-webkit-scrollbar {
    display: none;
}

/* =========================
   MỖI SHORT = 1 KHUNG MÀN HÌNH
   ========================= */
.short-slide {
    position: relative;
    width: 100%;
    height: calc(100dvh - var(--topbar-h));
    min-height: calc(100dvh - var(--topbar-h));
    scroll-snap-align: start;
    overflow: hidden;
    border-radius: 0;
    background: #000;
    border: 0;
    isolation: isolate;
}

.short-slide + .short-slide {
    margin-top: 0;
}

/* =========================
   KHỐI VIDEO FULL SLIDE
   ========================= */
.short-video-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
    border-radius: 0;
}

/* Video native */
.short-video-wrap > video.short-video {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    background: #000;
    display: block;
    border-radius: 0;
}

/* Nếu SophiePlayer / Plyr bọc thêm div */
.short-video-wrap .plyr,
.short-video-wrap .plyr__video-wrapper,
.short-video-wrap .plyr video {
    width: 100% !important;
    height: 100% !important;
    min-height: 100%;
    border-radius: 0 !important;
    background: #000;
}

.short-video-wrap .plyr {
    position: absolute;
    inset: 0;
}

.short-video-wrap .plyr video {
    object-fit: cover !important;
}

/* Ẩn control của Plyr trên short */
.short-video-wrap .plyr__controls,
.short-video-wrap .plyr__control--overlaid {
    display: none !important;
}

/* =========================
   ICON PLAY / PAUSE Ở GIỮA VIDEO
   ========================= */
.short-play-state {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.short-play-state.show {
    opacity: 1;
    transform: scale(1);
}

.short-play-state i {
    width: 76px;
    height: 76px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(6px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

/* =========================
   LỚP PHỦ GRADIENT TRÊN VIDEO
   ========================= */
.short-gradient {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
            to top,
            rgba(0, 0, 0, 0.72) 0%,
            rgba(0, 0, 0, 0.22) 36%,
            rgba(0, 0, 0, 0.08) 58%,
            rgba(0, 0, 0, 0.12) 100%
    );
    pointer-events: none;
}

/* =========================
   NÚT BẬT TIẾNG
   ========================= */
.short-unmute-overlay {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    height: 40px;
    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.88rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    cursor: pointer;
    transition: 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}

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

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

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

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

/* =========================
   CỘT NÚT ACTION BÊN PHẢI
   ========================= */
.short-actions {
    position: absolute;
    right: 12px;
    bottom: 96px;
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.short-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 0.8rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.short-action-btn {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    border: 0;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    cursor: pointer;
    transition: 0.2s ease;
}

.short-action-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.short-action-btn.is-liked {
    background: rgba(255, 45, 45, 0.24);
    color: #fff;
}

.short-action-btn i {
    font-size: 1.1rem;
}

/* =========================
   KHỐI THÔNG TIN PHÍA DƯỚI
   ========================= */
.short-bottom {
    position: absolute;
    left: 14px;
    right: 78px; /* chừa chỗ cho cột action */
    bottom: 18px;
    z-index: 6;
    color: #fff;
}

.short-caption {
    font-size: 0.92rem;
    line-height: 1.45;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
    word-break: break-word;
}

.short-caption strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.96rem;
    font-weight: 700;
}

/* Nếu sau này bật lại author thì đã có sẵn css */
.short-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.short-author-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
}

.short-author-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: #fff;
}

/* =========================
   LOADING NỔI
   ========================= */
.short-loading {
    position: fixed;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    z-index: 30;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    color: #fff;
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(8px);
    font-size: 0.85rem;
}

/* =========================
   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;
    cursor: pointer;
    white-space: nowrap;
}

/* =========================
   MOBILE
   ========================= */
@media (max-width: 767.98px) {
    .app-main:has(.shorts-page) .page-content {
        padding: 0 !important;
    }

    .shorts-page {
        width: 100%;
        max-width: 100%;
        margin: 0;
        height: calc(100dvh - var(--topbar-h));
        min-height: calc(100dvh - var(--topbar-h));
    }

    .shorts-feed {
        border-radius: 0;
    }

    .short-slide {
        width: 100%;
        height: calc(100dvh - var(--topbar-h));
        min-height: calc(100dvh - var(--topbar-h));
        border-radius: 0;
    }

    .short-video-wrap,
    .short-video-wrap > video.short-video,
    .short-video-wrap .plyr,
    .short-video-wrap .plyr__video-wrapper,
    .short-video-wrap .plyr video {
        width: 100% !important;
        height: 100% !important;
    }

    .short-video-wrap > video.short-video,
    .short-video-wrap .plyr video {
        object-fit: cover !important;
    }

    .short-unmute-overlay {
        top: 12px;
        right: 12px;
        height: 36px;
        padding: 0 12px;
        font-size: 0.82rem;
    }

    .short-play-state i {
        width: 68px;
        height: 68px;
        font-size: 1.8rem;
    }

    .short-actions {
        right: 10px;
        bottom: 84px;
    }

    .short-bottom {
        left: 12px;
        right: 70px;
        bottom: 14px;
    }

    .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%;
    }
}