/* ==========================================================================
   igcomment.css — Instagram comment maker.
   Light + dark theme via .ig-dark on the canvas. Comment styling targets
   Instagram's current post-comments look: 32px circular avatar (with
   optional gradient story ring), bold username + verified ✓, body on its
   own line, small meta row (time · 좋아요 · 답글 달기), outlined heart on
   the right. Sidebar mirrors ytcomment's editor pattern with igc-* classes.
   All rules scoped under .view-igcomment.
   ========================================================================== */

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

/* -------- sidebar (minimal placeholder for Phase 1) -------- */

.view-igcomment .igcomment-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-igcomment .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-igcomment .igcomment-sidebar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.4px;
  flex-shrink: 0;
}

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

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

.view-igcomment .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-igcomment .size-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.94);
  flex-shrink: 0;
}

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

.view-igcomment .size-row select,
.view-igcomment 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-igcomment 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-igcomment select option {
  background: #0f1827;
  color: #fff;
}

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

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

/* -------- canvas-options checkboxes -------- */

.view-igcomment .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-igcomment .canvas-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

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

/* -------- bg mode + theme: pill segments -------- */

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

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

.view-igcomment .bg-mode-options,
.view-igcomment .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-igcomment .bg-mode-options input[type="radio"],
.view-igcomment .theme-options input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.view-igcomment .bg-mode-options label,
.view-igcomment .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-igcomment .bg-mode-options label:hover,
.view-igcomment .theme-options label:hover {
  color: #fff;
}

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

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

/* -------- bg image upload + thumbnail -------- */

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

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

.view-igcomment .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-igcomment .bg-upload-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(138, 180, 255, 0.7);
}

.view-igcomment .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-igcomment .bg-thumb-img {
  display: block;
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.view-igcomment .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-igcomment .bg-thumb-clear:hover {
  background: rgba(196, 55, 55, 0.85);
}

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

.view-igcomment 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-igcomment .btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px rgba(123, 31, 31, 0.35);
}

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

.view-igcomment .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-igcomment .card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.view-igcomment .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-igcomment .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-igcomment .list-header {
  display: flex;
  gap: 6px;
  align-items: center;
}

.view-igcomment .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-igcomment .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-igcomment .list-delete:hover {
  background: rgba(196, 55, 55, 0.28);
  color: #fff;
}

/* -------- per-card editor inputs -------- */

.view-igcomment .igc-input,
.view-igcomment textarea.igc-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-igcomment textarea.igc-input {
  resize: vertical;
  min-height: 60px;
}

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

.view-igcomment .igc-row-2 {
  display: flex;
  gap: 6px;
}

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

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

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

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

/* -------- translate (번역) per-card 3-state select -------- */

.view-igcomment .igc-trans-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.view-igcomment .igc-trans {
  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-igcomment .igc-trans:focus {
  border-color: rgba(138, 180, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

/* -------- per-card avatar editor -------- */

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

.view-igcomment .igc-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-igcomment .igc-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.view-igcomment .igc-avatar-actions {
  display: flex;
  gap: 4px;
  flex: 1;
}

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

.view-igcomment .igc-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-igcomment .igc-avatar-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

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

.view-igcomment .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);
}

/* -------- canvas area (shared pattern with ytcomment) -------- */

.view-igcomment .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-igcomment .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-igcomment #igcomment-canvas {
  position: relative;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 6px;
  overflow: hidden;
}

.view-igcomment #igcomment-canvas.ig-dark {
  background: linear-gradient(180deg, #2a2a2a 0%, #1f1f1f 100%);
}

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

/* ============================================================
   The Instagram-style comment card on the canvas.
   Light theme is default; .ig-dark on the canvas flips tokens.
   Real IG comment layout:
     [Avatar]  username ✓ body text...
               2일  좋아요 X개  답글 달기      [♡]
   ============================================================ */

.view-igcomment .ig-comment {
  position: absolute;
  top: 0;
  left: 0;
  cursor: move;
  user-select: none;
  transform-origin: 50% 50%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Pretendard', 'Apple SD Gothic Neo', sans-serif;
  touch-action: none;
  /* light-mode tokens */
  --ig-text: #262626;
  --ig-muted: #737373;
  --ig-action: #262626;
  color: var(--ig-text);
}

.view-igcomment #igcomment-canvas.ig-dark .ig-comment {
  background: #000000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.40);
  --ig-text: #f5f5f5;
  --ig-muted: #a8a8a8;
  --ig-action: #f5f5f5;
}

.view-igcomment #igcomment-canvas.no-card-shadow .ig-comment {
  box-shadow: none;
}

/* -------- avatar with optional story ring -------- */

.view-igcomment .ig-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* small upward optical alignment with the first text baseline */
  margin-top: 1px;
}

/* story ring grows the wrap slightly so the colored ring + tiny white gap
   surround the avatar at IG-like proportions */
.view-igcomment .ig-avatar-wrap.has-ring {
  width: 38px;
  height: 38px;
}

/* the inline ring SVG (replaces the previous CSS background-image approach
   so html2canvas can capture it during PNG export) */
.view-igcomment .ig-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.view-igcomment .ig-ring svg {
  display: block;
  width: 100%;
  height: 100%;
}

.view-igcomment .ig-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: #c7c7c7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

/* when ringed, leave a 1px white halo between the colored ring and the
   avatar image — matches the IG ring spacing */
.view-igcomment .ig-avatar-wrap.has-ring .ig-avatar {
  width: 28px;
  height: 28px;
  box-shadow: 0 0 0 1.5px #ffffff;
}

.view-igcomment #igcomment-canvas.ig-dark .ig-avatar-wrap.has-ring .ig-avatar {
  box-shadow: 0 0 0 1.5px #000000;
}

.view-igcomment .ig-avatar img,
.view-igcomment .ig-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* -------- content column (username + body inline, meta row below) -------- */

.view-igcomment .ig-content {
  flex: 1;
  min-width: 0;
}

/* username row: bold name + inline verified mark, on its own line */
.view-igcomment .ig-user-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ig-text);
}

.view-igcomment .ig-author {
  font-weight: 600;
  color: var(--ig-text);
}

.view-igcomment .ig-verified {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.view-igcomment .ig-verified svg {
  width: 12px;
  height: 12px;
  display: block;
}

/* body on its own line below the username */
.view-igcomment .ig-body {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 400;
  color: var(--ig-text);
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 2px;
}

/* #hashtags and @handles within the comment body — Instagram-link blue */
.view-igcomment .ig-body .ig-link {
  color: rgb(65, 80, 247);
}

/* -------- meta row -------- */

.view-igcomment .ig-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ig-muted);
  line-height: 1.4;
}

.view-igcomment .ig-time {
  font-weight: 400;
}

.view-igcomment .ig-likes,
.view-igcomment .ig-reply {
  font-weight: 600;
  color: var(--ig-muted);
}

/* -------- heart icon (right side) -------- */

.view-igcomment .ig-heart {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ig-action);
  /* aligns with the username line */
  margin-top: 2px;
}

.view-igcomment .ig-heart svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* -------- responsive (mobile) -------- */

@media (max-width: 768px) {
  .view-igcomment {
    flex-direction: column;
  }
  .view-igcomment .igcomment-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-igcomment .igcomment-sidebar h1,
  .view-igcomment .igcomment-sidebar .desc {
    display: none;
  }
  .view-igcomment .canvas-wrap {
    order: 1;
    flex: 1;
    height: 55%;
    padding: 12px;
  }
}
