/* =========================================================
   Shorts Shopping Tool — Design tokens
   Palette: 무대(舞臺) 다크 + 라이브 커머스 코랄 액센트
   ========================================================= */
:root {
  --bg: #0b0d12;
  --bg-elevated: #12151c;
  --bg-card: #171b24;
  --line: #262b36;
  --text: #eef0f4;
  --text-muted: #8b93a3;
  --accent: #ff3d6e;      /* 상품/구매 액션 */
  --accent-dim: #7a1f36;
  --mint: #00e5a0;        /* 성공/발행 상태 */
  --amber: #ffb020;       /* 초안/경고 */
  --radius: 14px;
  --font-display: -apple-system, "Pretendard", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  --font-body: -apple-system, "Pretendard", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; margin: 0 0 8px; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }

/* ---------- Auth ---------- */
.auth-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,61,110,0.12), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(0,229,160,0.08), transparent 45%),
    var(--bg);
}
.auth-card {
  width: 360px; padding: 32px;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.auth-card h1 { font-size: 22px; }
.auth-card form { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.auth-card label { font-size: 12px; color: var(--text-muted); margin-top: 10px; }
input[type=text], input[type=password], input[type=number], input[type=url],
input[type=email], input[type=file], select, textarea {
  background: var(--bg-elevated); border: 1px solid var(--line); color: var(--text);
  padding: 10px 12px; border-radius: 10px; font-size: 14px; width: 100%;
  font-family: var(--font-body);
}
textarea { resize: vertical; min-height: 70px; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-elevated); color: var(--text);
  cursor: pointer; font-size: 14px; font-weight: 600; text-align: center;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; margin-top: 18px; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.alert { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 8px; }
.alert.error { background: rgba(255,61,110,0.12); color: #ff8aa8; border: 1px solid var(--accent-dim); }
.alert.success { background: rgba(0,229,160,0.1); color: var(--mint); border: 1px solid #0a5c42; }

/* ---------- Admin shell ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--bg-elevated); border-right: 1px solid var(--line);
  padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { font-family: var(--font-display); font-weight: 800; font-size: 17px; margin-bottom: 24px; padding: 0 8px; }
.sidebar .brand span { color: var(--accent); }
.sidebar nav a {
  display: block; padding: 10px 10px; border-radius: 10px; color: var(--text-muted);
  font-size: 14px; margin-bottom: 2px;
}
.sidebar nav a:hover, .sidebar nav a.active { background: var(--bg-card); color: var(--text); }
.sidebar .logout { margin-top: 20px; padding: 0 8px; }
.main { flex: 1; padding: 28px 32px; max-width: 1200px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }

.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) {
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr 1fr; }
}

.stat-card, .card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px;
}
.stat-card .num { font-family: var(--font-display); font-size: 28px; font-weight: 800; }
.stat-card .label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.published { background: rgba(0,229,160,0.12); color: var(--mint); }
.badge.draft { background: rgba(255,176,32,0.12); color: var(--amber); }
.badge.platform { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--line); }
.thumb-sm { width: 44px; height: 78px; object-fit: cover; border-radius: 6px; background: #000; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Editor ---------- */
.editor-layout { display: grid; grid-template-columns: 320px 1fr; gap: 22px; }
@media (max-width: 900px) { .editor-layout { grid-template-columns: 1fr; } }
.preview-stage {
  position: relative; width: 100%; max-width: 380px; aspect-ratio: 9/16;
  background: #000; border-radius: 18px; overflow: hidden; border: 1px solid var(--line);
  margin: 0 auto;
}
.preview-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.crop-guide {
  position: absolute; inset: 0; pointer-events: none;
  border: 2px dashed rgba(255,255,255,0.25);
}
.safe-zone-guide {
  position: absolute; pointer-events: none;
  top: 13%; bottom: 20%; left: 8%; right: 8%;
  border: 1.5px dashed var(--mint);
  border-radius: 8px;
}
.safe-zone-label {
  position: absolute; top: -20px; left: 0;
  font-size: 10px; color: var(--mint); white-space: nowrap;
  background: rgba(0,0,0,0.5); padding: 2px 6px; border-radius: 4px;
}
.overlay-box {
  position: absolute; border: 2px solid var(--accent); border-radius: 10px;
  background: rgba(255,61,110,0.15); cursor: move;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; text-align: center;
  backdrop-filter: blur(2px);
}
.overlay-box .resize-handle {
  position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px;
  background: var(--accent); border-radius: 50%; cursor: nwse-resize; border: 2px solid #fff;
}
.qr-drag-box {
  position: absolute; cursor: move;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px; border: 2px solid transparent; border-radius: 10px;
}
.qr-drag-box:hover, .qr-drag-box.dragging {
  border-color: var(--mint); background: rgba(0,229,160,0.08);
}
.timeline { margin-top: 14px; }
.timeline input[type=range] { width: 100%; }
.timeline-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); }

/* ---------- QR preview (admin editor) ---------- */
.qr-preview-stage {
  background: #000; border-radius: 12px; padding: 20px; display: flex;
  justify-content: flex-end; align-items: flex-start; min-height: 100px;
}

/* ---------- Public feed ---------- */
.feed-body { margin: 0; background: #000; }
.feed {
  height: 100vh; overflow-y: scroll; scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.slide {
  height: 100vh; scroll-snap-align: start; position: relative;
  display: flex; align-items: center; justify-content: center; background: #000;
}
.slide video { width: 100%; height: 100%; object-fit: cover; }
.slide-info {
  position: absolute; left: 16px; right: 90px; bottom: 30px; color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}
.slide-info h3 { font-size: 16px; margin-bottom: 4px; }
.slide-info p { font-size: 13px; color: rgba(255,255,255,0.8); margin: 0; }
.product-tag {
  position: absolute; border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 2px solid #fff; box-shadow: 0 4px 18px rgba(0,0,0,0.45);
  transition: transform .15s ease; background: #111;
}
.product-tag:active { transform: scale(0.94); }
.product-tag img, .product-tag video { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-tag .price-pill {
  position: absolute; left: 3px; bottom: 3px; right: 3px;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 4px; border-radius: 5px; text-align: center;
}
.product-tag .cart-badge {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  background: var(--accent); border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 12px; border: 2px solid #fff;
}
.empty-state { color: var(--text-muted); text-align: center; padding: 60px 20px; }

/* ---------- Profile-link CTA banner ---------- */
.cta-banner {
  position: absolute; left: 50%; bottom: 20%; transform: translateX(-50%);
  z-index: 6; max-width: 88%;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 14px; font-weight: 700;
  padding: 10px 16px; border-radius: 10px; text-align: center; cursor: pointer;
  backdrop-filter: blur(2px);
}
.cta-banner:active { transform: translateX(-50%) scale(0.96); }

/* ---------- Toast notifications (non-blocking save feedback) ---------- */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast-item {
  padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap;
}
.toast-item.show { opacity: 1; transform: translateY(0); }
.toast-item.toast-success { background: var(--mint); color: #04342c; }
.toast-item.toast-error { background: var(--accent); color: #fff; }

/* ---------- QR tag (top-right of video) ---------- */
.qr-tag {
  position: absolute; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.qr-box {
  width: 76px; height: 76px; background: #fff; border-radius: 10px;
  padding: 2px; box-shadow: 0 4px 16px rgba(0,0,0,0.45); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.qr-box img, .qr-box canvas, .qr-box table { width: 100% !important; height: 100% !important; }
.qr-caption {
  font-size: 10px; color: #fff; text-align: center; max-width: 90px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7); line-height: 1.3;
  background: rgba(0,0,0,0.4); padding: 2px 6px; border-radius: 6px;
}

/* ---------- Product tag blink effects ---------- */
@keyframes blinkBoxPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.96); }
}
@keyframes blinkBorderPulse {
  0%, 100% { border-color: var(--accent); box-shadow: 0 0 0 0 rgba(255,61,110,0.6); }
  50% { border-color: #fff; box-shadow: 0 0 0 6px rgba(255,61,110,0); }
}
.product-tag.blink-box.blink-slow { animation: blinkBoxPulse 2.4s ease-in-out infinite; }
.product-tag.blink-box.blink-normal { animation: blinkBoxPulse 1.4s ease-in-out infinite; }
.product-tag.blink-box.blink-fast { animation: blinkBoxPulse 0.7s ease-in-out infinite; }
.product-tag.blink-border.blink-slow { animation: blinkBorderPulse 2.4s ease-in-out infinite; }
.product-tag.blink-border.blink-normal { animation: blinkBorderPulse 1.4s ease-in-out infinite; }
.product-tag.blink-border.blink-fast { animation: blinkBorderPulse 0.7s ease-in-out infinite; }

/* ---------- Admin access icon (public feed) ---------- */
.admin-fab {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 50;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(23,27,36,0.85); border: 1px solid var(--line);
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  font-size: 18px; text-decoration: none;
  backdrop-filter: blur(6px);
  transition: color .15s ease, border-color .15s ease;
}
.admin-fab:hover { color: var(--text); border-color: var(--accent); }
