/* Design direction: editorial + refined with warm neutrals and bold accents. */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@500;600;700&family=Manrope:wght@400;500;600&display=swap');

:root {
  --font-display: 'Fraunces', serif;
  --font-body: 'Manrope', sans-serif;
  --color-ink: #0b1d2a;
  --color-muted: #5f6b76;
  --color-accent: #ff6b3d;
  --color-accent-2: #1fb6a6;
  --color-sand: #f6f1ea;
  --color-card: rgba(255, 255, 255, 0.92);
  --color-border: rgba(11, 29, 42, 0.12);
  --shadow-soft: 0 18px 40px rgba(11, 29, 42, 0.12);
  --shadow-hover: 0 24px 60px rgba(11, 29, 42, 0.18);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --duration-fast: 150ms;
  --duration-medium: 280ms;
  --duration-slow: 520ms;
  --easing: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body.app {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--color-ink);
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(255, 107, 61, 0.18), transparent 60%),
    radial-gradient(800px 520px at 90% 0%, rgba(31, 182, 166, 0.16), transparent 55%),
    var(--color-sand);
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 96px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 48px;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 16px 0;
  background: linear-gradient(180deg, rgba(246, 241, 234, 0.98) 0%, rgba(246, 241, 234, 0.92) 100%);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(11, 29, 42, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: var(--color-ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.02em;
  box-shadow: 0 12px 24px rgba(11, 29, 42, 0.18);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.02em;
}

.brand-sub {
  color: var(--color-muted);
  font-size: 13px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: transform var(--duration-medium) var(--easing),
    box-shadow var(--duration-medium) var(--easing),
    background var(--duration-medium) var(--easing),
    color var(--duration-medium) var(--easing),
    border-color var(--duration-medium) var(--easing);
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn.primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: 0 16px 32px rgba(255, 107, 61, 0.35);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(255, 107, 61, 0.45);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--color-border);
}

.btn.ghost:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn.outline {
  border-color: var(--color-ink);
  color: var(--color-ink);
  background: transparent;
}

.btn.outline:hover {
  background: rgba(11, 29, 42, 0.08);
}

.btn.active {
  background: rgba(11, 29, 42, 0.1);
  border-color: rgba(11, 29, 42, 0.25);
  color: var(--color-ink);
  box-shadow: 0 14px 26px rgba(11, 29, 42, 0.12);
  transform: translateY(-1px);
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: center;
  margin-bottom: 48px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.1;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  color: var(--color-muted);
  font-size: 18px;
  line-height: 1.7;
  margin: 0 0 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.card.tight {
  padding: 20px;
  border-radius: var(--radius-md);
}

.section {
  margin-top: 32px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 16px;
}

.meta {
  color: var(--color-muted);
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(31, 182, 166, 0.12);
  color: #0b5f58;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  margin-bottom: 16px;
}

.alert.success {
  background: rgba(31, 182, 166, 0.12);
  border-color: rgba(31, 182, 166, 0.35);
  color: #0b5f58;
}

.alert.error {
  background: rgba(255, 107, 61, 0.12);
  border-color: rgba(255, 107, 61, 0.4);
  color: #9a2d14;
}

.form-grid {
  display: grid;
  gap: 16px;
}

/* 단일 행 검색 폼 */
.form-inline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.form-inline .field.inline { display: flex; align-items: center; gap: 8px; }
.form-inline .field.inline .label { white-space: nowrap; margin-right: 6px; }
.form-inline .field.inline .input,
.form-inline .field.inline .select { width: auto; }
.form-inline .field.inline .select { min-width: 120px; }
.form-inline .field.inline.grow { flex: 1 1 320px; }
.form-inline .field.inline.grow .input { width: 100%; }

.actions-right {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.field {
  display: grid;
  gap: 8px;
}

.label {
  font-weight: 600;
  font-size: 14px;
}

.input,
.select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  font-size: 15px;
  transition: border-color var(--duration-fast) var(--easing), box-shadow var(--duration-fast) var(--easing);
}

textarea.input {
  resize: vertical;
  min-height: 96px;
}

.input:focus,
.select:focus {
  outline: none;
  border-color: rgba(255, 107, 61, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 107, 61, 0.15);
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.9);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(11, 29, 42, 0.08);
  text-align: left;
}

.table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
}

.table tr:last-child td {
  border-bottom: none;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.token-value {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  color: #0b5f58;
}

.footer-note {
  margin-top: 48px;
  color: var(--color-muted);
  font-size: 13px;
}

.reveal {
  animation: rise var(--duration-slow) var(--easing) both;
}

.reveal.delay-1 { animation-delay: 120ms; }
.reveal.delay-2 { animation-delay: 240ms; }
.reveal.delay-3 { animation-delay: 360ms; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 961px) {
  .form-inline {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: end;
    column-gap: 12px;
    row-gap: 0;
  }
  .form-inline .btn { align-self: end; }
}

/* 모달 */
.modal { position: fixed; inset: 0; display: none; z-index: 100; }
.modal[aria-hidden="false"], .modal.open { display: block; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.35); }
.modal-content {
  position: relative;
  max-width: 720px;
  margin: 8vh auto;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 16vh);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.modal-title { margin: 0; font-family: var(--font-display); font-size: 18px; }
.modal-close { border: none; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
.modal-body { padding: 20px; overflow: auto; overscroll-behavior: contain; }

.modal-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.8) 30%, rgba(255,255,255,0.95));
  border-top: 1px solid var(--color-border);
}

body.is-modal-open { overflow: hidden; }

/* 비디오 전용 그룹 토글 + 썸네일 */
.video-only-group { display: none; }
.item-form.is-video .video-only-group { display: block; }
.preview-line { margin-top: 6px; }
.thumb {
  display: none;
  width: 108px;
  height: 60px;
  object-fit: cover;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: rgba(0,0,0,0.04);
}

@media (max-width: 640px) {
  .shell {
    padding: 28px 18px 72px;
  }

  .btn {
    width: 100%;
  }

  .hero-actions {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
