/* ========================================
   Watch Page Styles
   Version: 20260722e
   ======================================== */

/* --- Reset & Base --- */
.watch-page { box-sizing: border-box; }
.watch-page *, .watch-page *::before, .watch-page *::after { box-sizing: inherit; }

/* --- Desktop Layout (>= 768px) --- */
@media (min-width: 768px) {

  /* === Layout: Two-Column === */
  .watch-desktop {
    display: flex;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    align-items: flex-start;
  }
  .watch-main {
    flex: 1;
    min-width: 0;
  }
  .watch-sidebar {
    width: 400px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }

  /* === Video Player (16:9) === */
  .watch-player {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
  }
  .watch-player .plyr {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  /* === Info Section === */
  .watch-info {
    padding: 16px 0;
  }
  .watch-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px;
  }
  .watch-meta {
    font-size: 0.85rem;
    color: var(--text-secondary, #606060);
  }

  /* === Publisher Row === */
  .watch-publisher-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color, #e5e5e5);
  }
  .watch-publisher {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .watch-publisher-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
  }
  .watch-publisher-name {
    font-weight: 600;
    color: var(--text-color, #0f0f0f);
    text-decoration: none;
  }
  .watch-publisher-name:hover {
    color: var(--main-color, #2CB742);
  }
  .watch-follow-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    background: var(--main-color, #2CB742);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
  }
  .watch-follow-btn:hover {
    filter: brightness(0.9);
  }

  /* === Description === */
  .watch-description {
    font-size: 16px;
    background: var(--bg-secondary, #f2f2f2);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
  }
  .watch-description-text {
    max-height: 80px;
    overflow: hidden;
    line-height: 1.5;
    white-space: pre-line;
    word-break: break-word;
  }
  .watch-description-expanded {
    max-height: none;
    overflow: visible;
  }
  .watch-description-toggle {
    display: inline-block;
    margin-top: 8px;
    background: none;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary, #606060);
    cursor: pointer;
    padding: 0;
  }

}

/* --- Mobile Layout (< 768px) --- */
@media (max-width: 767px) {

  /* === Hide site header/footer/sidebar when mobile watch is active === */
  body.watch-mobile-active {
    overflow: hidden;
  }
  body.watch-mobile-active #site-header,
  body.watch-mobile-active #site-footer,
  body.watch-mobile-active #site-sidebar,
  body.watch-mobile-active .site-header,
  body.watch-mobile-active .site-footer,
  body.watch-mobile-active .site-sidebar {
    display: none !important;
  }

  /* === Container: Fullscreen Black === */
  .watch-mobile {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #000;
    overflow: hidden;
    z-index: 9999;
  }

  /* === Slides === */
  .watch-mobile-slides {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }
  .watch-mobile-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
  }
  .watch-mobile-slide.active {
    display: block;
  }

  /* === Video === */
  .watch-mobile-video {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
  }
  .watch-mobile-video video,
  .watch-mobile-video iframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
  }

  /* === Tap Zone (invisible overlay for play/pause) === */
  .watch-mobile-tap-zone {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: pointer;
  }

  /* === Pause Icon === */
  .watch-mobile-pause-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 3;
    pointer-events: none;
  }
  .watch-mobile-pause-icon.visible {
    opacity: 1;
  }
  .watch-mobile-pause-icon svg {
    width: 28px;
    height: 28px;
    fill: #fff;
  }

  /* === Back Button (top-left) === */
  .watch-mobile-back {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    color: #fff;
  }
  .watch-mobile-back svg {
    width: 20px;
    height: 20px;
    fill: #fff;
  }

  /* === Progress Dots (top center) === */
  .watch-mobile-progress {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .watch-mobile-progress-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.25s ease;
  }
  .watch-mobile-progress-dot.active {
    background: #fff;
    width: 8px;
    height: 8px;
  }

  /* === Bottom Info (left side) === */
  .watch-mobile-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 80px;
    z-index: 5;
    padding: 48px 16px 24px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  }
  .watch-mobile-username {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  }
  .watch-mobile-caption-wrap {
    margin-bottom: 4px;
  }
  .watch-mobile-caption {
    font-size: 0.85rem;
    color: #fff;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    word-break: break-word;
  }
  .watch-mobile-caption.expanded {
    -webkit-line-clamp: unset;
    overflow: visible;
  }
  .watch-mobile-caption-toggle {
    display: inline-block;
    background: none;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 4px 0;
    margin-top: 2px;
  }

  /* === Right-side Action Buttons === */
  .watch-mobile-actions {
    position: absolute;
    bottom: 24px;
    right: 12px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  .watch-mobile-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
  }
  .watch-mobile-action-btn svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
  }
  .watch-mobile-action-count {
    font-size: 0.7rem;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 600;
    line-height: 1;
  }
  .watch-mobile-like-btn.liked svg {
    fill: #ff2d55;
  }
  .watch-mobile-comment-btn,
  .watch-mobile-share-btn,
  .watch-mobile-post-link {
    color: #fff;
  }

  /* === Avatar (right side, above buttons) === */
  .watch-mobile-avatar-wrap {
    position: relative;
    margin-bottom: 8px;
  }
  .watch-mobile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  }

  /* === Comment Panel (slides up from bottom) === */
  .watch-mobile-comment-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: #fff;
    border-radius: 16px 16px 0 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }
  .watch-mobile-comment-panel.active {
    transform: translateY(0);
  }

  /* --- Comment Panel Header --- */
  .watch-mobile-comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
  }
  .watch-mobile-comment-count {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a1a;
  }
  .watch-mobile-comment-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #666;
    border-radius: 50%;
  }
  .watch-mobile-comment-close svg {
    width: 18px;
    height: 18px;
    fill: #666;
  }

  /* --- Comment List --- */
  .watch-mobile-comment-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 16px;
  }

  /* --- Single Comment --- */
  .wm-comment-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
  }
  .wm-comment-item + .wm-comment-item {
    border-top: 1px solid #f0f0f0;
  }
  .wm-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
  }
  .wm-comment-body {
    flex: 1;
    min-width: 0;
  }
  .wm-comment-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
  }
  .wm-comment-text {
    font-size: 0.85rem;
    color: #1a1a1a;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-line;
  }
  .wm-comment-time {
    font-size: 0.7rem;
    color: #999;
    margin-top: 4px;
  }

  /* --- Comment Form --- */
  .watch-mobile-comment-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
    background: #fff;
  }
  .watch-mobile-comment-form-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
  }
  .watch-mobile-comment-form input,
  .watch-mobile-comment-form textarea {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.85rem;
    outline: none;
    resize: none;
    background: #f5f5f5;
  }
  .watch-mobile-comment-form input:focus,
  .watch-mobile-comment-form textarea:focus {
    border-color: #2CB742;
  }
  .watch-mobile-comment-send {
    background: var(--main-color, #2CB742);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
  }
  .watch-mobile-comment-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
  }

  /* --- Empty Comments State --- */
  .watch-mobile-comment-empty {
    text-align: center;
    padding: 40px 16px;
    color: #999;
    font-size: 0.9rem;
  }

}
