/* ============================================================
   WATCH PAGE — Full-Screen SPA Reels Viewer
   ============================================================ */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: #000;
    overflow: hidden;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Sarabun', sans-serif;
}

/* ── Full-page container ── */
#watchPage {
    position: fixed;
    inset: 0;
    background: #000;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Single video element (NEVER recreated) ── */
#watchVideo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    background: #000;
    transition: opacity 0.18s ease;
}

@media (min-width: 768px) {
    #watchVideo {
        object-fit: contain;
    }
}

/* ── Overlay wrapper ── */
#watchOverlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ── Top gradient + bar ── */
.watch-top-bar {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.72) 0%, transparent 100%);
}

.watch-back-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    text-decoration: none;
    background: rgba(0,0,0,0.35);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.watch-back-btn:hover,
.watch-back-btn:focus {
    background: rgba(0,0,0,0.6);
    color: #fff;
    outline: none;
}

.watch-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.4px;
}

/* ── Bottom section (info + actions) ── */
.watch-bottom {
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
    padding-top: 70px;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.88) 0%,
        rgba(0,0,0,0.55) 45%,
        transparent 100%
    );
}

/* ── Profile info (left) ── */
.watch-info {
    flex: 1;
    padding: 0 8px 0 16px;
    pointer-events: auto;
    min-width: 0;
}

.watch-profile-row {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-bottom: 10px;
}

.watch-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.9);
    object-fit: cover;
    object-position: top;
    flex-shrink: 0;
    background: #222;
}

.watch-username {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.watch-caption {
    font-size: 13px;
    color: rgba(255,255,255,0.88);
    margin: 0;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ── Action buttons (right column) ── */
.watch-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 0 16px 0 6px;
    pointer-events: auto;
    flex-shrink: 0;
}

.watch-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s ease;
}

.watch-action-btn:hover {
    transform: scale(1.12);
    color: #fff;
}

.watch-action-btn i {
    font-size: 30px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.7));
    transition: color 0.15s;
}

.watch-action-btn span {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    min-width: 24px;
    text-align: center;
}

/* Like active state */
#watchLikeBtn.active i {
    color: #ed1058;
}

/* Sound button — muted state dims the icon */
#watchSoundBtn.watch-sound-muted i {
    color: rgba(255, 255, 255, 0.45);
}
#watchSoundBtn:not(.watch-sound-muted) i {
    color: #fff;
}

/* ── Progress bar (bottom 3px) ── */
.watch-progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.18);
}

.watch-progress-fill {
    height: 100%;
    width: 0%;
    background: #ed1058;
    transition: width 0.12s linear;
}

/* ── Loading spinner ── */
#watchLoader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.2s;
}

#watchLoader .spinner {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: #fff;
    animation: watch-spin 0.85s linear infinite;
}

@keyframes watch-spin {
    to { transform: rotate(360deg); }
}

/* ── Big heart on double-tap ── */
.big-heart {
    position: absolute;
    font-size: 86px;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.4) translate(-50%, -50%);
    transform-origin: top left;
    transition: opacity 0.18s ease, transform 0.28s cubic-bezier(.2,.9,.2,1.1);
    z-index: 20;
    line-height: 1;
}

.big-heart.show {
    opacity: 1;
    transform: scale(1) translate(-50%, -50%);
}


/* ── Reel counter badge (top-right) ── */
.watch-counter {
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    font-weight: 600;
    letter-spacing: 0.5px;
}
