/* ==========================================================================
   subtitle1.css — Subtitle 1 (자막 스타일 1) card maker
   Mostly mirrors headline.css for layout/sidebar; the card itself is a single
   white block with bold black text and an optional outer color glow.
   All rules scoped under .view-subtitle1.
   ========================================================================== */

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

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

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

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

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

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

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

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

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

/* -------- canvas background mode (3-way segment) -------- */

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

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

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

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

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

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

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

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

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

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

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

.view-subtitle1 .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;
  transition: 0.15s ease;
}

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

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

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

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

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

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

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

/* -------- card list (sidebar) — shared between subtitle1 + newsshow's
   overlay subtitle card editor -------- */

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

/* newsshow sidebar is already a scrolling flex column; using flex:1 here
   collapses the list to 0 height. Let it size to its own content; the
   sidebar above handles scrolling. */
.view-newsshow #newsshow-subtitle-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.view-subtitle1 .list-item,
.view-newsshow #newsshow-subtitle-card-list .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-subtitle1 .list-item.is-selected,
.view-newsshow #newsshow-subtitle-card-list .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-subtitle1 .list-header,
.view-newsshow #newsshow-subtitle-card-list .list-header {
  display: flex;
  gap: 6px;
  align-items: center;
}

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

.view-subtitle1 .list-body,
.view-newsshow #newsshow-subtitle-card-list .list-body {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 60px;
  transition: 0.15s ease;
}

.view-subtitle1 .list-body:focus,
.view-newsshow #newsshow-subtitle-card-list .list-body:focus {
  border-color: rgba(138, 180, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

.view-subtitle1 .list-row-label,
.view-newsshow #newsshow-subtitle-card-list .list-row-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

/* -------- glow color swatches (sidebar) -------- */

.view-subtitle1 .glow-row,
.view-newsshow #newsshow-subtitle-card-list .glow-row {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
}

.view-subtitle1 .glow-swatch,
.view-newsshow #newsshow-subtitle-card-list .glow-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
  transition: 0.15s ease;
}

.view-subtitle1 .glow-swatch:hover,
.view-newsshow #newsshow-subtitle-card-list .glow-swatch:hover {
  transform: scale(1.08);
}

.view-subtitle1 .glow-swatch.is-active,
.view-newsshow #newsshow-subtitle-card-list .glow-swatch.is-active {
  border-color: rgba(138, 180, 255, 0.95);
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(138, 180, 255, 0.25);
}

.view-subtitle1 .glow-swatch.glow-off,
.view-newsshow #newsshow-subtitle-card-list .glow-swatch.glow-off {
  background: rgba(255, 255, 255, 0.04);
  position: relative;
}

.view-subtitle1 .glow-swatch.glow-off::after,
.view-newsshow #newsshow-subtitle-card-list .glow-swatch.glow-off::after {
  content: '×';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
  line-height: 1;
}

/* -------- glow size (per-card slider + number input) -------- */

.view-subtitle1 .glow-size-row,
.view-newsshow #newsshow-subtitle-card-list .glow-size-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-subtitle1 .glow-size-label,
.view-newsshow #newsshow-subtitle-card-list .glow-size-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

.view-subtitle1 .glow-size-slider,
.view-newsshow #newsshow-subtitle-card-list .glow-size-slider {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.view-subtitle1 .glow-size-number,
.view-newsshow #newsshow-subtitle-card-list .glow-size-number {
  width: 52px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
  transition: 0.15s ease;
  -moz-appearance: textfield;
}

.view-subtitle1 .glow-size-number::-webkit-outer-spin-button,
.view-subtitle1 .glow-size-number::-webkit-inner-spin-button,
.view-newsshow #newsshow-subtitle-card-list .glow-size-number::-webkit-outer-spin-button,
.view-newsshow #newsshow-subtitle-card-list .glow-size-number::-webkit-inner-spin-button {
  /* keep the native arrows — they're useful here */
  opacity: 1;
}

.view-subtitle1 .glow-size-number:focus,
.view-newsshow #newsshow-subtitle-card-list .glow-size-number:focus {
  border-color: rgba(138, 180, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
}

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

.view-subtitle1 .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-subtitle1 .hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin: 0;
  line-height: 1.45;
}

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

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

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

/* -------- the actual subtitle1 card on canvas -------- */

.view-subtitle1 .subtitle1-card,
.view-newsshow .subtitle1-card {
  position: absolute;
  top: 0;
  left: 0;
  cursor: move;
  user-select: none;
  white-space: pre-wrap;
  word-break: keep-all;
  transform-origin: 50% 50%;
  min-height: 1em;
  touch-action: none;
  background: #ffffff;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'NanumSquare', -apple-system, 'Segoe UI', 'Pretendard',
    'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-weight: 800;
  font-size: 36px;
  line-height: 1.4;
  letter-spacing: -0.5px;
  color: #111;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

/* default shadow can be hidden via the canvas-wide toggle */
.view-subtitle1 #subtitle1-canvas.no-card-shadow .subtitle1-card {
  box-shadow: none;
}

/* glow always wins over the no-card-shadow rule. Blur radii are scaled by
   --glow-size (default 1) so the user can dial intensity per card. */
.view-subtitle1 .subtitle1-card.has-glow,
.view-newsshow .subtitle1-card.has-glow {
  box-shadow:
    0 0 calc(14px * var(--glow-size, 1)) var(--glow, #ffeb3b),
    0 0 calc(32px * var(--glow-size, 1)) var(--glow, #ffeb3b),
    0 0 calc(56px * var(--glow-size, 1)) var(--glow, #ffeb3b);
}

.view-subtitle1 #subtitle1-canvas.no-card-shadow .subtitle1-card.has-glow {
  box-shadow:
    0 0 calc(14px * var(--glow-size, 1)) var(--glow, #ffeb3b),
    0 0 calc(32px * var(--glow-size, 1)) var(--glow, #ffeb3b),
    0 0 calc(56px * var(--glow-size, 1)) var(--glow, #ffeb3b);
}

.view-subtitle1 .subtitle1-card .card-body,
.view-newsshow .subtitle1-card .card-body {
  white-space: pre-wrap;
  word-break: keep-all;
}

/* Vertical-padding drag handles — appear at the top and bottom edges of
   the selected card. Dragging adjusts card.vpad (with card.y compensated
   so the card grows/shrinks symmetrically from its center). */
.view-subtitle1 .subtitle1-card .vpad-handle,
.view-newsshow .subtitle1-card .vpad-handle {
  position: absolute;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  background: #4ea3ff;
  border: 2px solid #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(78, 163, 255, 0.4);
  cursor: ns-resize;
  display: none;
  z-index: 10;
  /* keep handles unaffected by the card's own glow/text rendering */
  pointer-events: auto;
}

.view-subtitle1 .subtitle1-card.is-selected .vpad-handle,
.view-newsshow .subtitle1-card.is-selected .vpad-handle {
  display: block;
}

.view-subtitle1 .subtitle1-card .vpad-handle.vpad-top,
.view-newsshow .subtitle1-card .vpad-handle.vpad-top {
  top: -7px;
}

.view-subtitle1 .subtitle1-card .vpad-handle.vpad-bottom,
.view-newsshow .subtitle1-card .vpad-handle.vpad-bottom {
  bottom: -7px;
}

/* -------- responsive -------- */

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

@media (max-width: 768px) and (orientation: landscape) {
  .view-subtitle1 {
    flex-direction: row;
  }
  .view-subtitle1 .subtitle1-sidebar {
    order: 0;
    width: 280px;
    height: 100%;
    border-top: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }
  .view-subtitle1 .canvas-wrap {
    height: 100%;
  }
}
