/* ==========================================================================
   newsshow.css — TV broadcast layout, fully CSS-recreated.

   The only image asset used is the show logo at
   resources/newsshow/logo.png (the "E트렌드 따라잡기" 3D type) — its
   bevel/emboss is impractical to do in pure CSS, so we use a real PNG
   cut from the reference screenshot. Until that file exists, a CSS
   gradient-text fallback shows in its place.

   All measurements are in a 1920×1080 design canvas. The canvas is
   scaled at runtime to fit the viewport (see newsshow-canvas.js).
   ========================================================================== */

.view-newsshow {
  display: flex;
  height: 100%;
  background: linear-gradient(180deg, #111a29 0%, #09111f 100%);
}

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

.view-newsshow .newsshow-sidebar {
  flex: 0 0 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 18px 18px;
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  color: rgba(255, 255, 255, 0.92);
}

.view-newsshow .newsshow-sidebar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.view-newsshow .newsshow-sidebar .desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.6);
}

.view-newsshow .section-title {
  margin: 8px 0 -2px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.view-newsshow .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.view-newsshow .field label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
}

.view-newsshow .field input[type="text"],
.view-newsshow .field textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  outline: none;
  transition: 0.15s ease;
}

.view-newsshow .field textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.45;
}

.view-newsshow .field input[type="text"]:focus,
.view-newsshow .field textarea:focus {
  border-color: rgba(138, 180, 255, 0.7);
  background: rgba(0, 0, 0, 0.35);
}

.view-newsshow .upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.view-newsshow .upload-row input[type="file"] {
  display: none;
}

.view-newsshow .ns-upload-btn,
.view-newsshow .ns-clear-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: 0.15s ease;
}

.view-newsshow .ns-upload-btn:hover,
.view-newsshow .ns-clear-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(138, 180, 255, 0.6);
}

.view-newsshow .ns-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.view-newsshow .ns-hint {
  font-size: 11px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
}

/* -------- bg mode segmented control + image upload area -------- */

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

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

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

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

.view-newsshow .bg-mode-options input[type="radio"]:checked + label {
  background: rgba(138, 180, 255, 0.85);
  color: #0a1220;
  box-shadow: 0 4px 12px rgba(138, 180, 255, 0.25);
}

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

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

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

.view-newsshow .bg-upload-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  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-newsshow .bg-upload-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(138, 180, 255, 0.7);
}

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

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

/* logo line editor — text input on top, 5 mini controls in a 2-col grid */
.view-newsshow .ns-logo-block + .ns-logo-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.10);
}

.view-newsshow .ns-logo-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.view-newsshow .ns-logo-controls > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.view-newsshow .ns-logo-controls label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.68);
}

.view-newsshow .ns-logo-controls select,
.view-newsshow .ns-logo-controls input[type="number"] {
  font-family: inherit;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  outline: none;
  min-width: 0;
}

.view-newsshow .ns-logo-controls input[type="color"] {
  width: 100%;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.view-newsshow .ns-style-btns {
  display: flex;
  gap: 4px;
}

.view-newsshow .ns-style-btn {
  flex: 1;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.7);
  font-family: serif;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.15s ease;
}

.view-newsshow .ns-style-btn.ns-style-italic {
  font-style: italic;
}

.view-newsshow .ns-style-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}


.view-newsshow .media-type-row {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
}

.view-newsshow .media-type-row input[type="radio"] {
  display: none;
}

.view-newsshow .media-type-row label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.15s ease;
}

.view-newsshow .media-type-row input[type="radio"]:checked + label {
  background: var(--accent);
  color: #fff;
}

/* bottom-bar */

.view-newsshow .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);
  margin-top: auto;
}

.view-newsshow .btn-primary {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: 0.15s ease;
  box-shadow: 0 6px 18px rgba(123, 31, 31, 0.35);
}

.view-newsshow .btn-primary:hover {
  background: #921f1f;
}

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

.view-newsshow .hint {
  margin: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
}

/* -------- canvas wrap (scales the 1920×1080 design to fit) -------- */

.view-newsshow .canvas-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 24px;
}

.view-newsshow .canvas-stage {
  position: relative;
}

/* ========================================================================
   THE CANVAS — restored to the original v1 design (saved in samples/).
   ======================================================================== */

#newsshow-canvas {
  width: 1920px;
  height: 1080px;
  position: relative;
  overflow: hidden;
  transform-origin: top left;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Nanum Square", "Inter", sans-serif;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  background: #131438;
}

/* user-uploaded canvas background — same explicit-box positioning as
   .ns-content. Spans from the left edge of the canvas to the start of
   the right panel (panel is 480px wide, anchored to the right). Stays
   visible behind .ns-content (which has its own opaque #ebebeb bg).
   No `display: block` here: it would override the `hidden` attribute's
   default `display: none`, leaving a broken-image placeholder visible. */
.ns-canvas-bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 1440px;  /* 1920 canvas − 480 panel */
  height: 1080px;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.ns-canvas-bg[hidden] {
  display: none;
}

/* subtle vertical-line frame texture across the entire canvas */
#newsshow-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 14px);
  pointer-events: none;
}

/* 'none' background mode: drop both the solid color and the vertical-line
   texture so the canvas exports with transparency outside the panel/cards */
#newsshow-canvas.no-background {
  background: transparent;
}

#newsshow-canvas.no-background::before {
  display: none;
}

/* -------- LEFT content card -------- */

.ns-content {
  position: absolute;
  left: 100px;
  top: 0;
  width: 1240px;
  height: 1080px;
  background: #ebebeb;
  border-radius: 0;
  padding: 56px 60px 60px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.ns-headline-wrap {
  background: transparent;
  border: 2px solid #E1D0C4;
  border-radius: 22px;
  padding: 28px 40px;
}

.ns-headline {
  font-size: 60px;
  font-weight: 900;
  color: #d12626;
  line-height: 1.25;
  text-align: center;
  white-space: pre-wrap;
  word-break: keep-all;
}

.ns-subtitle {
  font-size: 36px;
  font-weight: 800;
  color: #2a2a2a;
  text-align: center;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: keep-all;
}

.ns-body-row {
  /* row shrinks to the body's intrinsic content height; the image
     wrap then stretches (align-items: stretch default) to match */
  display: flex;
  gap: 26px;
  align-items: stretch;
}

.ns-body {
  flex: 1;
  background: #EAEAEA;
  border-radius: 12px;
  padding: 26px 28px;
  font-size: 24px;
  line-height: 1.55;
  color: #2a2a2a;
  font-weight: 500;
  white-space: pre-wrap;
  word-break: keep-all;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ns-body-img-wrap {
  flex: 0 0 540px;
  /* relative positioning so the img can be absolutely-positioned inside
     without contributing to the wrap's intrinsic height (which would
     otherwise push the entire body-row taller than the body box) */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 12px;
  overflow: hidden;
}

.ns-body-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ns-body-img-empty {
  color: rgba(0, 0, 0, 0.35);
  font-size: 16px;
  text-align: center;
  padding: 16px;
  white-space: pre-wrap;
}

/* white strip at the bottom of the content card, separated by a thin
   gray rule. Fixed height; `margin-top: auto` shoves it to the bottom
   so the empty flex space sits between the body row and the strip
   instead of inside the strip. Negative side/bottom margins break out
   of the card's 60px padding so the strip reaches the card edges. */
.ns-bottom-fill {
  flex: none;
  height: 300px;
  margin: auto -60px -60px;
  background: #ffffff;
  border-top: 1px solid #c8c8c8;
}

/* -------- RIGHT panel -------- */

.ns-panel {
  position: absolute;
  right: 0;
  top: 0;
  width: 480px;
  height: 100%;
  padding: 56px 40px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  color: #fff;
  background: linear-gradient(180deg, #2a1455 0%, #1c0a3a 100%);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

/* show logo — two block lines, each independently styled. The shared
   filter gives the broadcast 3D depth (works regardless of line color). */
.ns-show-logo {
  width: 100%;
  line-height: 1.05;
  filter: drop-shadow(0 4px 0 rgba(80, 30, 10, 0.4))
          drop-shadow(0 8px 14px rgba(0, 0, 0, 0.4));
}

.ns-show-logo-line {
  /* font / size / color / text-align / font-weight / font-style /
     letter-spacing are all set inline by canvas.js from state */
  line-height: 1.05;
  white-space: pre-wrap;
  word-break: keep-all;
}

.ns-show-logo-bottom {
  margin-top: 4px;
}

.ns-live {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 28px;
  font-weight: 900;
  color: #ff3a3a;
  letter-spacing: 1.5px;
}

.ns-live-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ff3a3a;
  box-shadow: 0 0 0 4px rgba(255, 58, 58, 0.25);
}

.ns-schedule {
  font-size: 30px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1.5px;
  text-align: center;
}

/* The host (announcer) media slot is always transparent — the PNG export
   produces real transparency here. In the editor we paint a subtle
   checker pattern + dashed border so the empty area is visible while
   designing. newsshow-export.js disables both during capture. */
.ns-media {
  width: 100%;
  aspect-ratio: 7 / 8;
  background-color: transparent;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.10) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.10) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.10) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.10) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px dashed rgba(255, 255, 255, 0.20);
}

.ns-name {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
  text-align: center;
  padding: 4px 0 8px;
}

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

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

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