/* ==========================================================================
   ytcomment.css — YouTube comment maker.
   Light + dark theme via .yt-dark on the canvas. Comment styling targets
   YouTube's current desktop look (Roboto, 40px circular avatar,
   channel-owner pill chip, verified check, push-pin label, like count).
   All rules scoped under .view-ytcomment.
   ========================================================================== */

.view-ytcomment {
  display: flex;
  background: #0a1220;
  color: #f1f5f9;
  height: 100%;
  overflow: hidden;
}

/* -------- sidebar -------- */

.view-ytcomment .ytcomment-sidebar {
  width: 360px;
  flex-shrink: 0;
  padding: 28px 22px 22px;
  background: linear-gradient(180deg, #111a29 0%, #09111f 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  overflow-y: auto;
}

.view-ytcomment .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: rgba(255, 255, 255, 0.92);
  flex-shrink: 0;
  align-self: flex-start;
}

.view-ytcomment .ytcomment-sidebar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.4px;
  flex-shrink: 0;
}

.view-ytcomment .ytcomment-sidebar .desc {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  line-height: 1.65;
  flex-shrink: 0;
}

.view-ytcomment .section-title {
  margin: 8px 0 -2px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: rgba(255, 255, 255, 0.52);
  flex-shrink: 0;
}

.view-ytcomment .size-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.94);
  flex-shrink: 0;
}

.view-ytcomment .size-row span {
  font-weight: 700;
  flex-shrink: 0;
}

.view-ytcomment .size-row select,
.view-ytcomment select {
  flex: 1;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: 0.15s ease;
  cursor: pointer;
}

.view-ytcomment select:focus {
  border-color: rgba(138, 180, 255, 0.9);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(138, 180, 255, 0.12);
}

.view-ytcomment select option {
  background: #0f1827;
  color: #fff;
}

.view-ytcomment .add-row {
  display: flex;
  flex-shrink: 0;
}

.view-ytcomment .add-row button {
  flex: 1;
}

/* -------- canvas-options checkboxes (shared with other tools' pattern) -------- */

.view-ytcomment .canvas-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.78);
  flex-shrink: 0;
}

.view-ytcomment .canvas-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.view-ytcomment .canvas-options input[type='checkbox'] {
  cursor: pointer;
  accent-color: var(--accent);
}

/* -------- bg mode + theme: 3-way / 2-way pill segments (shared design) -------- */

.view-ytcomment .bg-row,
.view-ytcomment .theme-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.94);
  flex-shrink: 0;
}

.view-ytcomment .bg-row-label,
.view-ytcomment .theme-row-label {
  font-weight: 700;
  flex-shrink: 0;
}

.view-ytcomment .bg-mode-options,
.view-ytcomment .theme-options {
  display: flex;
  gap: 2px;
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  padding: 3px;
}

.view-ytcomment .bg-mode-options input[type="radio"],
.view-ytcomment .theme-options input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.view-ytcomment .bg-mode-options label,
.view-ytcomment .theme-options label {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  user-select: none;
  transition: 0.15s ease;
  text-align: center;
}

.view-ytcomment .bg-mode-options label:hover,
.view-ytcomment .theme-options label:hover {
  color: #fff;
}

.view-ytcomment .bg-mode-options input[type="radio"]:checked + label,
.view-ytcomment .theme-options input[type="radio"]:checked + label {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(123, 31, 31, 0.35);
}

.view-ytcomment .bg-mode-options input[type="radio"]:focus-visible + label,
.view-ytcomment .theme-options input[type="radio"]:focus-visible + label {
  outline: 2px solid rgba(138, 180, 255, 0.7);
  outline-offset: 2px;
}

/* -------- bg image upload + thumbnail (same as headline/subtitle1) -------- */

.view-ytcomment .bg-image-area {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-ytcomment .bg-image-area input[type="file"] {
  display: none;
}

.view-ytcomment .bg-upload-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px dashed rgba(255, 255, 255, 0.20);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s ease;
}

.view-ytcomment .bg-upload-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(138, 180, 255, 0.7);
}

.view-ytcomment .bg-thumb-wrap {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
}

.view-ytcomment .bg-thumb-img {
  display: block;
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.view-ytcomment .bg-thumb-clear {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: 0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.view-ytcomment .bg-thumb-clear:hover {
  background: rgba(196, 55, 55, 0.85);
}

/* -------- buttons -------- */

.view-ytcomment button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
  font-family: inherit;
}

.view-ytcomment .btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(123, 31, 31, 0.35);
}

.view-ytcomment .btn-primary:hover {
  background: #921f1f;
  box-shadow: 0 8px 22px rgba(123, 31, 31, 0.45);
}

.view-ytcomment .btn-export {
  width: 100%;
}

/* -------- card-list (sidebar) -------- */

/* sidebar itself handles vertical scroll — card-list just sizes to its
   content so the whole sidebar can scroll as one on small viewports */
.view-ytcomment .card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.view-ytcomment .list-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: 0.15s ease;
}

.view-ytcomment .list-item.is-selected {
  border-color: rgba(138, 180, 255, 0.9);
  background: rgba(138, 180, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(138, 180, 255, 0.10);
}

.view-ytcomment .list-header {
  display: flex;
  gap: 6px;
  align-items: center;
}

.view-ytcomment .list-title {
  flex: 1;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.55);
}

.view-ytcomment .list-delete {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  background: rgba(196, 55, 55, 0.14);
  color: #ffd2d2;
  border: 1px solid rgba(196, 55, 55, 0.18);
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.15s ease;
  flex-shrink: 0;
}

.view-ytcomment .list-delete:hover {
  background: rgba(196, 55, 55, 0.28);
  color: #fff;
}

.view-ytcomment .ytc-input,
.view-ytcomment textarea.ytc-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.45;
  font-family: inherit;
  outline: none;
  transition: 0.15s ease;
  box-sizing: border-box;
}

.view-ytcomment textarea.ytc-input {
  resize: vertical;
  min-height: 60px;
}

.view-ytcomment .ytc-input:focus {
  border-color: rgba(138, 180, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

.view-ytcomment .ytc-row-2 {
  display: flex;
  gap: 6px;
}

.view-ytcomment .ytc-row-2 > * {
  flex: 1;
  min-width: 0;
}

.view-ytcomment .ytc-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}

.view-ytcomment .ytc-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
}

.view-ytcomment .ytc-toggles input[type='checkbox'] {
  cursor: pointer;
  accent-color: var(--accent);
}

/* per-card "고정한 사람" — shown only when 고정 토글 is on */

.view-ytcomment .ytc-pinned-by-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-ytcomment .ytc-pinned-by-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
  white-space: nowrap;
}

.view-ytcomment .ytc-pinned-by {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: 0.15s ease;
}

.view-ytcomment .ytc-pinned-by:focus {
  border-color: rgba(138, 180, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

/* per-card expand state selector (3-way: 끔 / 자세히 보기 / 간략히) */

.view-ytcomment .ytc-expand-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-ytcomment .ytc-expand-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

.view-ytcomment .ytc-expand {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: 0.15s ease;
}

.view-ytcomment .ytc-expand:focus {
  border-color: rgba(138, 180, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

/* avatar editor */

.view-ytcomment .ytc-avatar-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.view-ytcomment .ytc-avatar-preview {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-weight: 500;
  font-size: 18px;
  color: #fff;
}

.view-ytcomment .ytc-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.view-ytcomment .ytc-avatar-actions {
  display: flex;
  gap: 4px;
  flex: 1;
}

.view-ytcomment .ytc-avatar-actions input[type="file"] {
  display: none;
}

.view-ytcomment .ytc-avatar-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: 0.15s ease;
}

.view-ytcomment .ytc-avatar-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* -------- bottom bar -------- */

.view-ytcomment .bottom-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.view-ytcomment .hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
  line-height: 1.45;
}

/* -------- canvas area -------- */

.view-ytcomment .canvas-wrap {
  flex: 1;
  min-width: 0;
  height: 100%;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.025), transparent 60%),
    linear-gradient(180deg, #0d1422 0%, #060b14 100%);
  overflow: auto;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-ytcomment .canvas-stage {
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  background-color: #2c3850;
  background-image:
    linear-gradient(45deg, #1e2940 25%, transparent 25%),
    linear-gradient(-45deg, #1e2940 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1e2940 75%),
    linear-gradient(-45deg, transparent 75%, #1e2940 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.view-ytcomment #ytcomment-canvas {
  position: relative;
  /* light off-white gradient (like the headline tool) so the white comment
     cards on top have visible contrast */
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 6px;
  overflow: hidden;
}

.view-ytcomment #ytcomment-canvas.yt-dark {
  /* lifted a notch from the card's #0f0f0f so the elevated card reads with
     similar contrast to the light theme (white card on #f8 → #e2 gradient) */
  background: linear-gradient(180deg, #2a2a2a 0%, #1f1f1f 100%);
}

.view-ytcomment #ytcomment-canvas.no-background {
  background: transparent;
}

/* ============================================================
   The actual YouTube-style comment card on the canvas.
   Light theme is the default; .yt-dark on the canvas flips
   the CSS variables to dark-mode equivalents.
   ============================================================ */

.view-ytcomment .yt-comment {
  position: absolute;
  top: 0;
  left: 0;
  cursor: move;
  user-select: none;
  transform-origin: 50% 50%;
  display: flex;
  gap: 16px;
  /* card-style enclosure (matches the headline tool's pattern):
     own background + horizontal padding + subtle shadow */
  padding: 16px 24px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
  font-family: 'Roboto', -apple-system, 'Segoe UI', 'Pretendard',
    'Apple SD Gothic Neo', sans-serif;
  touch-action: none;
  /* light-mode tokens */
  --yt-text: #0f0f0f;
  --yt-muted: #606060;
  --yt-link: #065fd4;
  --yt-chip-bg: #0f0f0f;
  --yt-chip-text: #ffffff;
  --yt-action: #606060;
  color: var(--yt-text);
}

.view-ytcomment #ytcomment-canvas.yt-dark .yt-comment {
  /* dark theme card uses the same near-black as the light-theme channel-owner
     chip — together with the chip flipping to #ffffff this gives a clean
     inversion of the color pair across themes */
  background: #0f0f0f;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.40);
  --yt-text: #f1f1f1;
  --yt-muted: #aaaaaa;
  --yt-link: #3ea6ff;
  /* dark-mode owner chip is the inverse of light: white box with black text.
     The nested verified inherits the chip's text color, so its filled circle
     becomes black with the check cut out to show the white chip through. */
  --yt-chip-bg: #ffffff;
  --yt-chip-text: #0f0f0f;
  --yt-action: #aaaaaa;
}

/* card shadow can be turned off canvas-wide via the toolbar checkbox.
   Placed after the dark theme rule so it wins via source order in either
   theme. */
.view-ytcomment #ytcomment-canvas.no-card-shadow .yt-comment {
  box-shadow: none;
}

/* avatar */

.view-ytcomment .yt-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #909090;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
}

.view-ytcomment .yt-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* content column */

.view-ytcomment .yt-content {
  flex: 1;
  min-width: 0;
}

.view-ytcomment .yt-pin-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--yt-muted);
  margin-bottom: 4px;
  line-height: 1.4;
}

.view-ytcomment .yt-pin-label svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  /* pin icon stays high-contrast against either theme — 핀 아이콘만 진하게,
     옆의 "...님이 고정함" 라벨은 muted 톤 그대로 */
  color: #0f0f0f;
}

.view-ytcomment #ytcomment-canvas.yt-dark .yt-pin-label svg {
  color: #ffffff;
}

.view-ytcomment .yt-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.view-ytcomment .yt-author {
  font-size: 13px;
  font-weight: 500;
  color: var(--yt-text);
  line-height: 1.4;
}

/* Channel-owner chip: rounded rectangle (4px), not a full pill. Uses
   inline-flex so a verified mark nested inside aligns next to the handle. */
.view-ytcomment .yt-author--owner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--yt-chip-bg);
  color: var(--yt-chip-text);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.4;
}

.view-ytcomment .yt-verified {
  display: inline-flex;
  align-items: center;
  /* primary text color for stand-alone (non-owner) verified — near-black
     in light mode, near-white in dark mode */
  color: var(--yt-text);
  flex-shrink: 0;
}

/* When verified sits inside the channel-owner chip, it inherits the chip
   foreground (white) instead of the page text color */
.view-ytcomment .yt-author--owner .yt-verified {
  color: inherit;
}

.view-ytcomment .yt-verified svg {
  width: 12px;
  height: 12px;
  display: block;
}

.view-ytcomment .yt-time {
  font-size: 12px;
  color: var(--yt-muted);
  line-height: 1.4;
}

.view-ytcomment .yt-body {
  font-size: 14px;
  line-height: 1.4;
  color: var(--yt-text);
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 4px;
}

/* http(s) URLs and timestamp tokens within comment body — picks up the
   theme's link blue (--yt-link, defined on .yt-comment). */
.view-ytcomment .yt-body .yt-link {
  color: var(--yt-link);
}

/* line-clamped (truncated) variant — 4 lines like real YouTube
   (--ytd-expander-max-lines: 4). Combine with the "자세히 보기" link below. */
.view-ytcomment .yt-body--collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* "자세히 보기" / "간략히" link (visual only) — appears between body and
   action row when the card's expand state isn't "none" */
.view-ytcomment .yt-show-more {
  font-size: 14px;
  font-weight: 500;
  color: var(--yt-muted);
  margin-top: 8px;
  line-height: 1.4;
  cursor: pointer;
}

/* action row matches YouTube: round icon-only buttons for thumbs, like count
   as a separate text span between them, and a text pill button for "답글" */

.view-ytcomment .yt-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  color: var(--yt-action);
}

.view-ytcomment .yt-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--yt-text);
  flex-shrink: 0;
}

.view-ytcomment .yt-action-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.view-ytcomment .yt-likes {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--yt-action);
  margin-right: 8px;
}

.view-ytcomment .yt-action-text {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--yt-text);
  border-radius: 999px;
  margin-left: 4px;
}

/* responsive (mobile) */

@media (max-width: 768px) {
  .view-ytcomment {
    flex-direction: column;
  }
  .view-ytcomment .ytcomment-sidebar {
    order: 2;
    width: 100%;
    height: 45%;
    flex-shrink: 0;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px;
    gap: 10px;
  }
  .view-ytcomment .ytcomment-sidebar h1,
  .view-ytcomment .ytcomment-sidebar .desc {
    display: none;
  }
  .view-ytcomment .canvas-wrap {
    order: 1;
    flex: 1;
    height: 55%;
    padding: 12px;
  }
}
