/* ==========================================================================
   YOUTUBE MINIMALIST KARAOKE STUDIO - PURE & BORDERLESS DESIGN
   Video Trung Tâm - Thông Số Chuẩn YouTube - Phụ Đề Trái - List Phải
   ========================================================================== */

:root {
  --font-primary: 'Roboto', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-display: 'Outfit', 'Plus Jakarta Sans', sans-serif;

  /* YouTube Dark Theme Palette */
  --bg-app: #0f0f0f;
  --yt-text-primary: #f1f1f1;
  --yt-text-secondary: #aaaaaa;
  --yt-pill-bg: rgba(255, 255, 255, 0.1);
  --yt-pill-hover: rgba(255, 255, 255, 0.2);
  --yt-card-bg: rgba(255, 255, 255, 0.08);
  --yt-card-hover: rgba(255, 255, 255, 0.12);
  --yt-link: #3ea6ff;
  --yt-red: #ff0033;

  /* Karaoke Accent */
  --karaoke-active: #ffd700;
  --karaoke-active-glow: rgba(255, 215, 0, 0.45);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  background-color: var(--bg-app);
  color: var(--yt-text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Khung cuộn toàn trang 2 nấc mượt mà (Không delay, giấu thanh cuộn) */
.app-scroll-container {
  width: 100vw;
  height: 100vh;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.app-scroll-container::-webkit-scrollbar {
  display: none;
}

/* Custom Minimal Scrollbar */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Subtle Ambient Background */
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background: radial-gradient(circle at 50% 25%, rgba(255, 0, 51, 0.08) 0%, rgba(15, 15, 25, 0.2) 50%, transparent 80%);
  transition: background 1.2s ease;
}



/* ==========================================================================
   NẤC 1: STUDIO 3 CỘT (SUBTITLE TRÁI - VIDEO GIỮA - RECOMMEND PHẢI)
   ========================================================================== */

.studio-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 310px 1fr 340px;
  gap: 20px;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0 0 0 24px; /* Sát mép ngoài bên phải màn hình */
  margin: 0;
  align-items: center;
  box-sizing: border-box;
  overflow: hidden;
  flex-shrink: 0;
}

/* ==========================================================================
   CỘT TRÁI: PHỤ ĐỀ KARAOKE (KHÔNG KHÓA STICKY, CUỘN TỰ DO CÙNG TOÀN TRANG)
   ========================================================================== */

.sidebar-karaoke {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: relative; /* KHÔNG KHÓA - SẼ CUỘN ĐI KHI XUỐNG BÌNH LUẬN */
}

.sidebar-karaoke::-webkit-scrollbar {
  display: none;
}

.karaoke-scroll-area {
  height: 100vh;
  overflow-y: auto;
  scroll-behavior: smooth;
  /* 1. Bỏ thanh scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* 2. Fade out spotlight: Text đang phát ở giữa sáng rõ nhất, 2 đầu mờ dần */
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.15) 15%,
    black 38%,
    black 62%,
    rgba(0, 0, 0, 0.15) 85%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.15) 15%,
    black 38%,
    black 62%,
    rgba(0, 0, 0, 0.15) 85%,
    transparent 100%
  );
}

.karaoke-scroll-area::-webkit-scrollbar {
  display: none;
}

.karaoke-lines-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
  /* Padding 48vh trên và dưới giúp câu đầu tiên và câu cuối cùng đều cuộn đúng vào giữa màn hình */
  padding: 48vh 0;
}

.karaoke-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  background: transparent !important;
  border: none !important;
  padding: 6px 0;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0.35; /* Các câu chưa hát hoặc đã qua mờ hơn để tôn câu ở giữa */
}

.karaoke-line .line-time {
  font-family: monospace;
  font-size: 11px;
  color: var(--yt-text-secondary);
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.karaoke-line:hover {
  opacity: 0.8;
}

.karaoke-line:hover .line-time {
  opacity: 1;
}

.karaoke-line .line-text {
  font-size: 16px;
  font-weight: 500;
  color: #a0a0a0;
  line-height: 1.5;
  transition: all 0.3s ease;
}

/* CÂU HÁT ĐANG PHÁT - SÁNG HƠN CÁC CÂU KHÁC (KHÔNG CHẠY GRADIENT) */
.karaoke-line.active {
  opacity: 1; /* Sáng tối đa 100% */
  transform: scale(1.06) translateX(4px);
}

.karaoke-line.active .line-time {
  color: #ffffff;
  opacity: 0.9;
  font-weight: 700;
}

.karaoke-line.active .line-text {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-display);
  color: #ffffff; /* Chữ trắng sáng nổi bật, không chạy gradient */
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.4);
}

.karaoke-line.passed .line-text {
  color: #666666;
}

/* ==========================================================================
   CỘT TRUNG TÂM: VIDEO NHÚNG CHÍNH GIỮA TRỤC X & TRỤC Y
   ========================================================================== */

.main-video-stage {
  height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible; /* Cột giữa không cần scroll riêng */
  box-sizing: border-box;
}

.main-video-stage::-webkit-scrollbar {
  display: none; /* Chrome/Safari: Bỏ hoàn toàn scrollbar */
}

.center-content-inner {
  width: 100%;
  max-width: 980px;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   THANH SEARCH YOUTUBE TRÊN CÙNG TAB GIỮA (NẰM CHÍNH GIỮA)
   ========================================================================== */

.yt-top-search-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 980px;
  display: flex;
  align-items: center;
  justify-content: center; /* NẰM CHÍNH GIỮA TAB GIỮA */
  z-index: 10;
}

/* Hộp search ngắn gọn nằm giữa */
.yt-search-box-wrapper {
  position: relative;
  width: 360px;
  max-width: 90%;
  margin: 0 auto;
}

/* Cụm công cụ góc trên bên phải: Lịch sử & Đã lưu (Tab bên phải) */
.yt-right-tab-header {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
}

.yt-search-form {
  display: flex;
  align-items: center;
  width: 100%;
  height: 40px;
  background: rgba(18, 18, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 40px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.yt-search-form:focus-within {
  border-color: #3ea6ff;
  box-shadow: 0 0 0 1px #3ea6ff, 0 4px 20px rgba(0, 0, 0, 0.7);
}

.yt-search-input-container {
  display: flex;
  align-items: center;
  flex: 1;
  padding: 0 12px 0 16px;
  gap: 10px;
  height: 100%;
}

.yt-search-icon-inside {
  font-size: 16px;
  color: var(--yt-text-secondary);
}

.yt-search-input {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--yt-text-primary);
}

.yt-search-input::placeholder {
  color: var(--yt-text-secondary);
  font-size: 13.5px;
}

.yt-search-clear-btn {
  background: transparent;
  border: none;
  color: var(--yt-text-secondary);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.yt-search-clear-btn:hover {
  color: #ffffff;
}

.yt-search-submit-btn {
  width: 58px;
  height: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--yt-text-primary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.yt-search-submit-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Cụm công cụ cố định góc trên 2 bên: Trái (Ambilight) & Phải (Lịch sử & Đã lưu) */
.yt-left-tab-header {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
}

.yt-right-tab-header {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
}

/* Nút công cụ (Ambilight, Lịch sử & Đã lưu) */
.yt-nav-tool-btn {
  font-weight: 500;
  gap: 6px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  user-select: none;
}
.yt-nav-tool-btn.active {
  background: #ffffff !important;
  color: #0f0f0f !important;
}
.yt-nav-tool-btn.active i {
  color: #0f0f0f !important;
}

.yt-badge-count {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 2px;
}
.yt-nav-tool-btn.active .yt-badge-count {
  background: #0f0f0f;
  color: #ffffff;
}

/* Search suggestions dropdown */
.yt-search-dropdown {
  position: absolute;
  top: 48px;
  left: 0;
  width: 100%;
  background: #212121;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  z-index: 100;
}

.yt-dropdown-header {
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--yt-text-secondary);
}

.yt-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.yt-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}
.yt-dropdown-item-thumb {
  width: 44px;
  height: 26px;
  border-radius: 4px;
  object-fit: cover;
  background: #181820;
}
.yt-dropdown-item-info {
  display: flex;
  flex-direction: column;
}
.yt-dropdown-item-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--yt-text-primary);
}
.yt-dropdown-item-artist {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

/* Modal Sheet Popup Lịch sử & Đã lưu (Neo góc trên tab bên phải) */
.yt-modal-sheet {
  position: absolute;
  top: 56px;
  right: 14px;
  left: auto;
  transform: none;
  width: 320px;
  max-width: calc(100vw - 28px);
  background: #212121;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.95);
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.yt-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.yt-modal-tabs {
  display: flex;
  gap: 8px;
}

.yt-tab-btn {
  background: transparent;
  border: none;
  color: var(--yt-text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.yt-tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.yt-modal-close-btn {
  background: transparent;
  border: none;
  color: var(--yt-text-secondary);
  font-size: 20px;
  cursor: pointer;
}
.yt-modal-close-btn:hover {
  color: #ffffff;
}

.yt-modal-body {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
}

.yt-modal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.yt-modal-item:hover {
  background: rgba(255, 255, 255, 0.08);
}
.yt-modal-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.yt-modal-item-thumb {
  width: 52px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.yt-modal-item-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.yt-modal-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--yt-text-primary);
  max-width: 175px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yt-modal-item-sub {
  font-size: 11.5px;
  color: var(--yt-text-secondary);
}
.yt-modal-item-delete {
  background: transparent;
  border: none;
  color: var(--yt-text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.yt-modal-item-delete:hover {
  color: #ff4444;
  background: rgba(255, 68, 68, 0.1);
}
.yt-modal-empty {
  text-align: center;
  padding: 36px 20px;
  color: var(--yt-text-secondary);
  font-size: 13.5px;
}

/* Modal Sheet Popup Cài đặt Ambilight (Neo góc trên bên trái) */
.yt-ambilight-sheet {
  left: 14px;
  right: auto;
  width: 330px;
}

.yt-settings-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
}

.yt-settings-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 440px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.yt-setting-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.yt-setting-item:has(.yt-toggle-switch) {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.yt-setting-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.yt-setting-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--yt-text-primary);
}

.yt-setting-hint {
  font-size: 11px;
  color: var(--yt-text-secondary);
  display: block;
}

.yt-setting-val {
  font-size: 12px;
  font-weight: 600;
  color: #ffd700;
  font-family: monospace;
}

/* Thanh trượt điều chỉnh thông số (Slider) */
.yt-slider-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  outline: none;
  transition: background 0.2s;
  cursor: pointer;
}
.yt-slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffd700;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
  transition: transform 0.15s ease;
}
.yt-slider-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
.yt-slider-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffd700;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* Nút công tắc chuyển đổi (Toggle Switch) */
.yt-toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}
.yt-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.yt-toggle-slider {
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 22px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.yt-toggle-slider::before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.yt-toggle-switch input:checked + .yt-toggle-slider {
  background-color: #ffd700;
}
.yt-toggle-switch input:checked + .yt-toggle-slider::before {
  transform: translateX(20px);
  background-color: #0f0f0f;
}

/* Hộp chọn chế độ hòa trộn (Select) */
.yt-select-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--yt-text-primary);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.yt-select-input:focus {
  border-color: #ffd700;
}
.yt-select-input option {
  background: #212121;
  color: #fff;
}

/* Khối thao tác (Khôi phục mặc định) */
.yt-setting-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.yt-btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--yt-text-secondary);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.yt-btn-reset:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* NẤC 1: MÀN HÌNH CHÍNH (Cao 100vh, Video trung tâm, Description gần chạm đáy) */
.stage-main-view {
  width: 100%;
  max-width: 980px;
  height: 100vh;
  min-height: 100vh;
  position: relative;
  flex-shrink: 0;
}

/* Video Player Wrapper 16:9 - KHÓA TẠI CHÍNH TÂM TRỤC X VÀ Y (KÍCH THƯỚC LỚN HƠN) */
.player-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 980px;
  border-radius: 12px;
  overflow: visible; /* Cho phép quầng sáng Ambilight tràn ra xung quanh */
  background: transparent;
  z-index: 2;
}

/* Lớp Ambilight tỏa sáng tràn viền (Ambient Light Projector) */
.yt-ambilight-projector {
  --ambi-brightness: 1;
  --ambi-saturation: 1.35;
  --ambi-blur: 70px;
  --ambi-spread: 22%;
  --ambi-opacity: 0.85;
  --ambi-blend-mode: screen;

  position: absolute;
  top: calc(-1 * var(--ambi-spread));
  bottom: calc(-1 * var(--ambi-spread));
  left: calc(-1 * var(--ambi-spread));
  right: calc(-1 * var(--ambi-spread));
  pointer-events: none;
  z-index: 1;
  overflow: visible;
  filter: blur(var(--ambi-blur)) brightness(var(--ambi-brightness)) saturate(var(--ambi-saturation));
  opacity: var(--ambi-opacity);
  mix-blend-mode: var(--ambi-blend-mode);
  transition: filter 0.3s ease, opacity 0.3s ease;
  will-change: transform, filter, opacity;
}

.ambilight-glow-quadrant {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transition: background 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ambi-top {
  top: 0;
  left: 8%;
  right: 8%;
  height: 48%;
  filter: blur(20px);
}

.ambi-bottom {
  bottom: 0;
  left: 8%;
  right: 8%;
  height: 48%;
  filter: blur(20px);
}

.ambi-left {
  top: 8%;
  bottom: 8%;
  left: 0;
  width: 48%;
  filter: blur(20px);
}

.ambi-right {
  top: 8%;
  bottom: 8%;
  right: 0;
  width: 48%;
  filter: blur(20px);
}

.ambi-center {
  top: 15%;
  bottom: 15%;
  left: 15%;
  right: 15%;
  border-radius: 50%;
  filter: blur(30px);
}

.player-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95);
  background: #000;
  z-index: 2;
}

.player-container iframe,
.player-container #youtube-player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ==========================================================================
   THÔNG SỐ CHUẨN YOUTUBE WATCH PAGE:
   - Trên cùng: Thông tin kênh YouTube & nút Like/Share/Loop/Autoplay
   - Ngay trên video: Tiêu đề Video (Title)
   - Chính giữa: Video Player (trục X và Y)
   - Phía dưới video: Description (Hộp mô tả) & Bình luận
   ========================================================================== */

/* PHẦN TRÊN VIDEO: THÔNG TIN KÊNH + TIÊU ĐỀ */
.yt-top-meta {
  position: absolute;
  bottom: calc(50% + 288px);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}

/* 1. Hàng tiêu đề video & cụm nút Vòng lặp / Tự động phát sát bên phải */
.yt-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.yt-video-title {
  font-family: var(--font-primary);
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  color: var(--yt-text-primary);
  letter-spacing: -0.2px;
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Cụm điều khiển Vòng lặp & Tự động phát sát lề phải */
.yt-playback-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* 2. Hàng kênh & thao tác chuẩn YouTube (Trên cùng) */
.yt-details-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;
  width: 100%;
}

/* PHẦN DƯỚI VIDEO: DESCRIPTION (GẦN CHẠM ĐÁY MÀN HÌNH CHUẨN XÁC) */
.yt-bottom-meta {
  position: absolute;
  bottom: 14px; /* GẦN CHẠM ĐÁY MÀN HÌNH */
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 980px;
  z-index: 2;
}

.yt-desc-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.yt-scroll-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--yt-text-secondary);
  opacity: 0.8;
  cursor: pointer;
  transition: opacity 0.2s ease, color 0.2s ease;
}
.yt-scroll-hint:hover {
  opacity: 1;
  color: #ffffff;
}
.yt-scroll-hint i {
  font-size: 16px;
  animation: bounceHint 1.8s infinite ease-in-out;
}
@keyframes bounceHint {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* Nhóm thông tin kênh */
.yt-channel-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.yt-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
}

.yt-channel-meta {
  display: flex;
  flex-direction: column;
}

.yt-channel-name-line {
  display: flex;
  align-items: center;
  gap: 4px;
}

.yt-channel-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--yt-text-primary);
  cursor: pointer;
}

.yt-badge-check {
  color: var(--yt-text-secondary);
  font-size: 14px;
}

.yt-subs-count {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

.yt-btn-subscribe {
  background: #f1f1f1;
  color: #0f0f0f;
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  cursor: pointer;
  margin-left: 12px;
  transition: background 0.2s ease;
}
.yt-btn-subscribe:hover {
  background: #d9d9d9;
}
.yt-btn-subscribe.subscribed {
  background: var(--yt-pill-bg);
  color: var(--yt-text-primary);
}

/* Nhóm nút thao tác bên phải chuẩn YouTube */
.yt-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.yt-pill {
  background: var(--yt-pill-bg);
  border: none;
  outline: none;
  color: var(--yt-text-primary);
  height: 36px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.yt-pill-btn {
  padding: 0 14px;
  gap: 6px;
}
.yt-pill:hover,
.yt-pill-btn:hover {
  background: var(--yt-pill-hover);
}

/* Nút Like / Dislike dính liền khối */
.yt-like-dislike-pill {
  padding: 0;
  overflow: hidden;
}

.yt-like-btn, .yt-dislike-btn {
  background: transparent;
  border: none;
  color: var(--yt-text-primary);
  height: 100%;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}
.yt-like-btn:hover, .yt-dislike-btn:hover {
  background: var(--yt-pill-hover);
}

.yt-pill-separator {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
}

/* Nút Vòng lặp chuẩn YouTube (Loop) */
.yt-loop-btn {
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  user-select: none;
}
.yt-loop-btn.active {
  background: #ffffff !important;
  color: #0f0f0f !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.25);
}
.yt-loop-btn.active i {
  color: #0f0f0f !important;
  font-weight: 700;
}

/* Nút Toggle Tự động phát chuẩn YouTube (Autoplay) */
.yt-autoplay-pill {
  background: var(--yt-pill-bg);
  height: 36px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}
.yt-autoplay-pill:hover {
  background: var(--yt-pill-hover);
}
.yt-autoplay-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--yt-text-primary);
  white-space: nowrap;
}

/* YouTube Signature Slider Track */
.yt-switch-track {
  position: relative;
  width: 32px;
  height: 18px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  transition: background 0.25s ease;
}
.yt-autoplay-pill.active .yt-switch-track {
  background: #ffffff;
}

/* Slider Thumb with Play / Pause Icon */
.yt-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1), background 0.25s ease;
}
.yt-switch-thumb .icon-play {
  font-size: 8px;
  color: #0f0f0f;
  display: none;
}
.yt-switch-thumb .icon-pause {
  font-size: 8px;
  color: #0f0f0f;
  display: block;
}

.yt-autoplay-pill.active .yt-switch-thumb {
  transform: translateX(14px);
  background: #0f0f0f;
}
.yt-autoplay-pill.active .yt-switch-thumb .icon-play {
  display: block;
  color: #ffffff;
}
.yt-autoplay-pill.active .yt-switch-thumb .icon-pause {
  display: none;
}

/* YouTube Toast Notification (Floating badge góc dưới) */
.yt-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: rgba(33, 33, 33, 0.95);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.2, 0, 0, 1);
}
.yt-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Nút tròn 36px (More) */
.yt-pill-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--yt-pill-bg);
  border: none;
  color: var(--yt-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.yt-pill-circle:hover {
  background: var(--yt-pill-hover);
}

/* 3. Hộp mô tả video chuẩn YouTube */
.yt-description-card {
  background: var(--yt-card-bg);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.yt-description-card:hover {
  background: var(--yt-card-hover);
}

.yt-desc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  flex-wrap: wrap;
}

.yt-views-bold,
.yt-date-bold {
  font-weight: 600;
  color: var(--yt-text-primary);
}

.yt-hashtags {
  display: flex;
  gap: 6px;
}

.yt-tag {
  color: var(--yt-link);
  font-weight: 500;
}

.yt-desc-body {
  font-size: 14px;
  color: var(--yt-text-primary);
  line-height: 20px;
  white-space: pre-line;
  max-height: 60px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.yt-desc-body.expanded {
  max-height: 1000px;
}

.yt-desc-more-btn {
  background: transparent;
  border: none;
  color: var(--yt-text-primary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  align-self: flex-start;
  margin-top: 4px;
}

/* 4. Khu vực bình luận chuẩn YouTube */
.yt-comments-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 12px;
}

.yt-comments-header {
  display: flex;
  align-items: center;
  gap: 28px;
}

.yt-comments-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--yt-text-primary);
}

.yt-comments-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--yt-text-primary);
  cursor: pointer;
}

.yt-add-comment-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.yt-comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.yt-comment-input-box {
  flex: 1;
}

.yt-comment-input-box input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--yt-text-primary);
  font-size: 14px;
  padding: 6px 0;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s ease;
}
.yt-comment-input-box input:focus {
  border-bottom-color: var(--yt-text-primary);
}
.yt-comment-input-box input::placeholder {
  color: var(--yt-text-secondary);
}

/* ==========================================================================
   NẤC 2: KHU VỰC BÌNH LUẬN & CHI TIẾT ĐẦY ĐỦ (CUỘN CẢ TRANG XUỐNG ĐÂY)
   ========================================================================== */

.yt-comments-stage-wrapper {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: var(--bg-app);
  padding: 30px 24px 80px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.yt-comments-stage {
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
}

/* Nút quay lại video */
.yt-back-to-video-bar {
  background: var(--yt-pill-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--yt-text-primary);
  height: 38px;
  padding: 0 20px;
  border-radius: 19px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  align-self: center;
  transition: all 0.2s ease;
  user-select: none;
}
.yt-back-to-video-bar:hover {
  background: var(--yt-pill-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}
.yt-back-to-video-bar i {
  font-size: 18px;
}

.yt-desc-full {
  cursor: default;
}
.yt-desc-full:hover {
  background: var(--yt-card-bg);
}

/* Danh sách bình luận */
.yt-comments-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 10px;
}

.yt-comment-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.yt-comment-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.yt-comment-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--yt-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.yt-comment-time {
  font-size: 12px;
  font-weight: 400;
  color: var(--yt-text-secondary);
}

.yt-comment-text {
  font-size: 14px;
  line-height: 20px;
  color: var(--yt-text-primary);
}

.yt-comment-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
}

.yt-comment-btn {
  background: transparent;
  border: none;
  color: var(--yt-text-secondary);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}
.yt-comment-btn:hover {
  color: var(--yt-text-primary);
}
.yt-comment-btn i {
  font-size: 15px;
}

/* ==========================================================================
   CỘT PHẢI: LIST VIDEO (KHÔNG KHÓA STICKY, CUỘN TỰ DO CÙNG TOÀN TRANG)
   ========================================================================== */

.sidebar-recommendations {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center; /* CANH CHÍNH GIỮA TRỤC Y */
  padding-right: 0;        /* Sát tuyệt đối lề ngoài bên phải */
  position: relative;      /* KHÔNG KHÓA - SẼ CUỘN ĐI KHI XUỐNG BÌNH LUẬN */
}

.recommendations-list {
  height: 720px;
  max-height: 78vh;
  margin: auto 0;          /* KHÓA CHÍNH GIỮA THEO CHIỀU DỌC TRỤC Y */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 50px 14px 50px 0;
  /* 1. Bỏ thanh scrollbar */
  scrollbar-width: none;  /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  /* 2. Fade out đối xứng CẢ Ở TRÊN LẪN Ở DƯỚI */
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.15) 10%,
    rgba(0, 0, 0, 0.8) 22%,
    black 30%,
    black 70%,
    rgba(0, 0, 0, 0.8) 78%,
    rgba(0, 0, 0, 0.15) 90%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.15) 10%,
    rgba(0, 0, 0, 0.8) 22%,
    black 30%,
    black 70%,
    rgba(0, 0, 0, 0.8) 78%,
    rgba(0, 0, 0, 0.15) 90%,
    transparent 100%
  );
}

.recommendations-list::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Brave */
}

.rec-video-card {
  display: flex;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: none !important;
  transition: background 0.2s ease;
}

.rec-video-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.rec-video-card.active-card {
  background: rgba(255, 255, 255, 0.12);
}

.thumb-container {
  position: relative;
  width: 138px;
  height: 78px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #181820;
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration-pill {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 11px;
  font-family: monospace;
  font-weight: 500;
  padding: 1px 4px;
  border-radius: 4px;
}

.rec-card-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 3px;
}

.rec-video-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--yt-text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-channel-name {
  font-size: 12px;
  color: var(--yt-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-metadata-row {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 1300px) {
  .studio-layout {
    grid-template-columns: 280px 1fr 320px;
    gap: 18px;
    padding: 16px;
  }
  .thumb-container {
    width: 120px;
    height: 68px;
  }
}

@media (max-width: 1024px) {
  .studio-layout {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    padding: 14px;
    gap: 20px;
  }

  .sidebar-karaoke,
  .sidebar-recommendations {
    position: static;
    height: 400px;
    width: 100%;
  }

  .floating-url-bar {
    position: static;
    margin-bottom: 10px;
    opacity: 1;
  }
  .floating-input-wrap input {
    width: 100%;
  }
}
