/* PDF 이미지 변환기 화면의 레이아웃과 반응형 테마를 정의한다 */
:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-strong: #f7fafc;
  --text: #172033;
  --muted: #637083;
  --line: #d8e1ea;
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --accent: #d97706;
  --danger: #dc2626;
  --ok: #15803d;
  --shadow: 0 20px 58px rgba(15, 23, 42, 0.12);
}

body.dark {
  color-scheme: dark;
  --bg: #111827;
  --surface: #182235;
  --surface-strong: #202b40;
  --text: #eef4ff;
  --muted: #a8b3c7;
  --line: #334158;
  --brand: #2dd4bf;
  --brand-strong: #5eead4;
  --accent: #fbbf24;
  --danger: #f87171;
  --ok: #86efac;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, var(--bg), var(--surface-strong));
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.workspace {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 3rem);
}

h2 {
  font-size: 1.15rem;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  cursor: pointer;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
}

.tab-button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tab-button.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
}

.upload-panel {
  min-width: 0;
  padding: 24px;
  border-right: 1px solid var(--line);
}

.control-panel {
  padding: 24px;
  background: color-mix(in srgb, var(--surface-strong) 76%, var(--surface));
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 24px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, var(--surface-strong));
  transform: translateY(-1px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-size: 1.55rem;
  font-weight: 700;
}

.drop-zone strong {
  font-size: 1.05rem;
}

.drop-zone small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.thumb-grid,
.preview-stack {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.thumb-card,
.page-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.thumb-card {
  cursor: grab;
}

.thumb-card.is-dragging {
  opacity: 0.5;
}

.thumb-frame,
.page-frame {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--line) 35%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--line) 35%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--line) 35%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--line) 35%, transparent) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.thumb-frame img,
.page-frame img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.thumb-meta,
.page-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 46px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.thumb-meta strong,
.page-meta strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--danger);
  cursor: pointer;
  font-weight: 900;
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

#imageStatusBadge,
#pdfStatusBadge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.field-group {
  margin-bottom: 16px;
}

.field-group label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.field-group select,
.field-group input[type="range"] {
  width: 100%;
}

.field-group select {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 4px 0 18px;
  color: var(--text);
  font-weight: 700;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.range-row,
.summary-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.range-row {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.range-row strong {
  color: var(--text);
  text-align: center;
}

.range-row span:last-child {
  text-align: right;
}

.summary-strip {
  grid-template-columns: 1fr 1fr;
  margin: 22px 0;
}

.summary-strip div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary-strip span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.summary-strip strong {
  display: block;
  overflow-wrap: anywhere;
}

.progress-shell {
  overflow: hidden;
  height: 10px;
  margin: 0 0 18px;
  border-radius: 999px;
  background: var(--line);
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.primary-action:hover:not(:disabled) {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.helper-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

@media (max-width: 920px) {
  .split-layout {
    grid-template-columns: 1fr;
  }

  .upload-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .app-header,
  .upload-panel,
  .control-panel {
    padding: 18px;
  }

  .mode-tabs {
    padding: 12px 18px;
  }

  .tab-button {
    flex: 1;
    padding-inline: 8px;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }
}
