/* 오픈마켓 등록 UI 참고: slate 톤, rounded-3xl 카드, 다크 사이드 헤더 */

:root {
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-900: #0f172a;
  --slate-950: #020617;
  --emerald-100: #d1fae5;
  --emerald-700: #047857;
  --amber-100: #fef3c7;
  --amber-700: #b45309;
  --rose-100: #ffe4e6;
  --rose-500: #f43f5e;
  --rose-700: #be123c;
  --blue-100: #dbeafe;
  --blue-700: #1d4ed8;
}

* {
  box-sizing: border-box;
}

.app-body {
  margin: 0;
  min-height: 100vh;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Pretendard", system-ui, sans-serif;
  background: var(--slate-100);
  color: var(--slate-900);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-root {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem;
}

@media (min-width: 1024px) {
  .app-root {
    padding: 1.5rem;
  }
}

.app-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 1280px) {
  .app-grid--split {
    grid-template-columns: 320px 1fr;
    align-items: start;
  }
}

.app-aside {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

/* Card */
.card {
  overflow: hidden;
  border-radius: 1.5rem;
  border: 1px solid var(--slate-200);
  background: #fff;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
}

.card__dark {
  background: var(--slate-950);
  color: #fff;
  padding: 1.25rem 1.5rem;
}

.card__dark-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.card__dark-sub {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--slate-300);
}

.card__body {
  padding: 1.5rem;
}

.card__body--tight-top {
  padding-top: 0.75rem;
}

.card__header-main {
  padding: 1.5rem 1.5rem 0.75rem;
}

.card__title-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 1024px) {
  .card__title-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.card__h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card__sub {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--slate-500);
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge--slate {
  background: var(--slate-100);
  color: var(--slate-700);
}

.badge--blue {
  background: var(--blue-100);
  color: var(--blue-700);
}

.badge--green {
  background: var(--emerald-100);
  color: var(--emerald-700);
}

.badge--yellow {
  background: var(--amber-100);
  color: var(--amber-700);
}

.badge--red {
  background: var(--rose-100);
  color: var(--rose-700);
}

/* Sidebar hint box */
.aside-hint {
  border-radius: 1rem;
  background: var(--slate-50);
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--slate-600);
  line-height: 1.55;
}

/* Nav pills (탭 이동 스타일) */
.nav-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-pill {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: none;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  color: var(--slate-700);
  background: var(--slate-50);
  transition: background 0.15s ease;
}

a.nav-pill:hover {
  background: var(--slate-100);
}

.nav-pill--active {
  background: var(--slate-900) !important;
  color: #fff !important;
}

.nav-pill--active:hover {
  background: var(--slate-800, #1e293b) !important;
}

/* Section title */
.section-title {
  margin-bottom: 1.25rem;
}

.section-title h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--slate-900);
}

.section-title p {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--slate-500);
}

/* Form fields */
.field {
  margin-bottom: 1rem;
}

.field label,
label.field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--slate-700);
}

/* 가격 입력란 바로 위: 공식 안내 */
label.field-label--price-rule {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--slate-800);
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.field-req {
  margin-left: 0.25rem;
  color: var(--rose-500);
}

.hint {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--slate-500);
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--slate-300);
  border-radius: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--slate-500);
  box-shadow: 0 0 0 3px var(--slate-200);
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
}

/* 금액 비고: 금액 숫자 입력란과 동일 높이 (padding·글자 크기 동일 기준) */
textarea.textarea--input-height {
  min-height: 0;
  height: calc(1.5 * 0.875rem + 1rem + 2px);
  resize: vertical;
  line-height: 1.5;
  box-sizing: border-box;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .form-grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1280px) {
  .form-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 금액 4칸: 한 줄(넓은 화면), 좁으면 2×2 */
.form-grid--4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 960px) {
  .form-grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.form-vertical {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.span-full {
  grid-column: 1 / -1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn--primary {
  background: var(--slate-900);
  color: #fff;
}

.btn--primary:hover {
  background: #1e293b;
}

.btn--secondary {
  background: var(--slate-100);
  color: var(--slate-900);
}

.btn--secondary:hover {
  background: var(--slate-200);
}

.btn--outline {
  background: #fff;
  color: var(--slate-900);
  border: 1px solid var(--slate-300);
}

.btn--outline:hover {
  background: var(--slate-50);
}

.btn--ghost {
  background: transparent;
  color: var(--slate-700);
}

.btn--ghost:hover {
  background: var(--slate-100);
}

.btn--danger {
  background: #dc2626;
  color: #fff;
}

.btn--danger:hover {
  background: #b91c1c;
}

.btn--sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Alerts */
.alert {
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert--success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.alert--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--slate-200);
  padding: 0.65rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: none;
}

.data-table tbody tr:hover {
  background: var(--slate-50);
}

.data-table--prices {
  font-size: 0.8125rem;
}

.data-table--prices th,
.data-table--prices td {
  padding: 0.5rem 0.35rem;
}

.option-table input[type="text"] {
  min-width: 0;
}

.option-table .option-row-index {
  text-align: center;
  color: var(--slate-500);
}

.option-auto-box {
  border: 1px dashed var(--slate-300);
  border-radius: 0.75rem;
  background: var(--slate-50);
  padding: 0.75rem;
  margin-bottom: 0.65rem;
}

.option-rows-wrap[hidden] {
  display: none !important;
}

.option-bottom-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
}

.option-bottom-row__buttons {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.option-pair-row {
  display: grid;
  grid-template-columns: 72px 180px 60px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.option-pair-row__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--slate-700);
}

/* 썸네일·상세 이미지 업로드 */
.thumb-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 960px) {
  .thumb-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.thumb-slot {
  border: 1px dashed var(--slate-300);
  border-radius: 0.75rem;
  padding: 0.65rem;
  background: var(--slate-50);
}

.thumb-preview {
  border-radius: 0.5rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--slate-200);
  margin-bottom: 0.5rem;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-preview img,
.thumb-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-preview--empty,
.thumb-preview-placeholder {
  font-size: 0.75rem;
  color: var(--slate-400);
}

.thumb-slot--mirrored .thumb-file-input:disabled {
  opacity: 0.45;
}

.same-as-1-label {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--slate-600);
  cursor: pointer;
}

.same-as-1-label input {
  margin-right: 0.35rem;
  vertical-align: middle;
}

.detail-preview-trigger {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  color: inherit;
  font: inherit;
  text-align: center;
}

.detail-preview-trigger:focus-visible {
  outline: 2px solid var(--slate-400);
  outline-offset: 2px;
  border-radius: 0.5rem;
}

.detail-preview-wrap {
  margin-bottom: 0.5rem;
}

.detail-preview-wrap .detail-preview-cell {
  width: 120px;
  height: 120px;
  margin: 0 auto;
}

.detail-preview-wrap .detail-preview-trigger {
  width: 120px;
  height: 120px;
  margin-left: auto;
  margin-right: auto;
}

body.image-modal-open {
  overflow: hidden;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.image-modal[hidden] {
  display: none !important;
}

.image-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  cursor: pointer;
}

.image-modal__panel {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.image-modal__close {
  flex-shrink: 0;
}

.image-modal__body {
  max-height: calc(92vh - 3rem);
  overflow: auto;
  border-radius: 0.5rem;
  background: var(--slate-900);
  padding: 0.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
}

.image-modal__img {
  display: block;
  max-width: 100%;
  height: auto;
}

.detail-preview-grid--local {
  margin-top: 0.5rem;
}

.detail-preview-grid--local:not([hidden])::before {
  content: "선택한 파일 미리보기";
  display: block;
  font-size: 0.75rem;
  color: var(--slate-500);
  margin-bottom: 0.35rem;
}

.thumb-file {
  width: 100%;
  font-size: 0.75rem;
}

.thumb-clear {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--slate-600);
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.detail-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.detail-preview-cell {
  display: block;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--slate-200);
  background: var(--slate-100);
}

.detail-preview-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Export bar */
.export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.export-bar select {
  width: auto;
  min-width: 220px;
}

.inline-form {
  display: inline;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.list-toolbar h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.empty-hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--slate-500);
}

.vstack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
