/* ===== Converter Page Styles ===== */

body {
  margin: 0;
  padding: 40px 24px 48px;
  font-family: var(--sans);
  background:
    radial-gradient(ellipse 80% 60% at 30% 5%, rgba(0,0,0,0.015), transparent),
    radial-gradient(ellipse 60% 80% at 70% 95%, rgba(0,0,0,0.01), transparent),
    var(--gray-50);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  color: var(--gray-900);
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

.container { max-width: 880px; width: 100%; }

/* Entrance */
.container { animation: fadeIn 0.5s var(--ease-out); }

/* Cards */
.card {
  animation: slideUp 0.55s var(--ease-out) both;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px 32px;
  margin-bottom: 16px;
  transition: box-shadow var(--duration-normal) var(--ease-out),
              border-color var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}
.card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-md);
}
.card:nth-child(2) { animation-delay: 0.06s; }
.card:nth-child(3) { animation-delay: 0.12s; }
.card:nth-child(4) { animation-delay: 0.18s; }
.card:nth-child(5) { animation-delay: 0.24s; }

/* Header */
h1 {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--gray-500);
  margin: 0 0 4px 0;
  font-feature-settings: 'cv11' on;
}
.subtitle {
  text-align: center;
  font-size: 30px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 36px 0;
  letter-spacing: -0.6px;
  line-height: 1.25;
}

/* Warning Banner */
.upload-banner {
  font-size: 12px; color: var(--blue);
  background: var(--blue-light);
  border-bottom: 1px solid #dbeafe;
  padding: 10px 16px;
  margin: -28px -32px 16px -32px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.upload-banner u { font-weight: 600; }
:root[data-theme="dark"] .upload-banner { border-bottom-color: #1e3a5f; }

/* Mode Selector */
.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
}
.mode-opt {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 20px 22px;
  cursor: pointer;
  background: var(--white);
  transition: all var(--duration-normal) var(--ease-out);
  border: none;
  position: relative;
}
.mode-opt:first-child { border-right: 1px solid var(--gray-200); }
.mode-opt:hover { background: var(--gray-50); }
.mode-opt input { display: none; }
.mode-opt:has(input:checked) {
  background: var(--gray-900);
  color: var(--white);
  box-shadow: inset 0 0 0 1px var(--gray-900);
}
.mode-opt:has(input:checked) b { color: var(--white); }
.mode-opt:has(input:checked) small { color: rgba(255,255,255,0.65); }
.mode-opt b {
  font-size: 14px; font-weight: 600;
  color: var(--gray-900);
  transition: color var(--duration-normal) var(--ease-out);
  display: inline-flex; align-items: center; gap: 6px;
  vertical-align: middle;
}
.mode-opt b i.lucide { margin-right: 0; }
.mode-opt small {
  font-size: 12px; color: var(--gray-500);
  display: block; margin-top: 2px;
  line-height: 1.4;
}
.mode-opt .tag {
  display: inline-block;
  font-size: 9px; padding: 3px 8px;
  margin-left: 8px;
  vertical-align: middle;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: var(--radius-full);
  background: var(--gray-200);
  color: var(--gray-700);
}
.mode-opt:has(input:checked) .tag {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
}
.config-section {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s var(--ease-out), opacity 0.3s var(--ease-out), margin 0.3s var(--ease-out);
  margin-top: 0;
}
.config-section.visible {
  max-height: 200px;
  opacity: 1;
  margin-top: 18px;
}

/* API Config */
.api-row {
  display: flex; gap: 10px;
  align-items: center; flex-wrap: wrap;
  margin-bottom: 10px;
}
.api-row:last-child { margin-bottom: 0; }
.api-row label {
  font-size: 12px; font-weight: 500;
  color: var(--gray-700); white-space: nowrap;
  min-width: 72px; text-transform: uppercase;
  letter-spacing: 0.8px;
}
.api-row input {
  flex: 1; min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--mono);
  background: var(--white);
}
.api-row input:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
.btn-save {
  background: var(--black); color: var(--white);
  border: none; padding: 10px 20px;
  cursor: pointer;
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.3px;
  border-radius: var(--radius-sm);
  transition: opacity var(--duration-fast) var(--ease-out);
}
.btn-save:hover { opacity: 0.85; }
.api-hint { font-size: 12px; color: var(--gray-500); margin-top: 8px; }
.api-hint a { color: var(--blue); text-decoration: underline; }

/* Dropzone */
.dropzone-area {
  border: 1.5px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  background: var(--gray-50);
}
.dropzone-area:hover {
  border-color: var(--gray-900);
  border-style: solid;
  background: var(--white);
  transform: scale(1.005);
  box-shadow: 0 0 0 6px rgba(0,0,0,0.03);
}
.dropzone-area.active {
  border-color: var(--black);
  border-style: solid;
  background: var(--white);
  transform: scale(1.008);
  box-shadow: 0 0 0 8px rgba(0,0,0,0.05);
}
.dropzone-area .icon { font-size: 40px; margin-bottom: 12px; line-height: 1; }
.dropzone-area .title { font-size: 16px; font-weight: 600; color: var(--gray-900); margin-bottom: 6px; }
.dropzone-area .desc { font-size: 13px; color: var(--gray-500); }
.dropzone-area input[type=file] { display: none; }

/* Progress */
.progress-card { display: none; }
.progress-card.visible { display: block; }
.steps { border-top: 1px solid var(--gray-200); }
.step {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}
.step-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-full);
  color: var(--gray-500);
  background: var(--white);
  transition: all 0.35s var(--ease-spring);
}
.step-icon.done {
  background: var(--green); border-color: var(--green); color: var(--white);
  transform: scale(1.1);
}
.step-icon.running {
  background: var(--black); border-color: var(--black); color: var(--white);
}
.step-icon.error { background: var(--red); border-color: var(--red); color: var(--white); }
@keyframes spin { to { transform: rotate(360deg); } }
.step-info { flex: 1; }
.step-title { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.step-detail { font-size: 12px; color: var(--gray-500); margin-top: 3px; }
.step-time { font-size: 11px; color: var(--gray-300); white-space: nowrap; font-family: var(--mono); }

/* Overall Progress */
.overall-progress { margin: 8px 0 18px; display: none; }
.overall-progress.visible { display: block; }
.overall-progress-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; }
.overall-progress-label { font-weight: 600; }
.overall-progress-pct { font-family: var(--mono); font-weight: 500; }
.overall-bar { height: 6px; background: var(--gray-200); border-radius: var(--radius-full); overflow: hidden; }
.overall-fill { height: 100%; width: 0; background: var(--black); border-radius: var(--radius-full); transition: width 0.5s var(--ease-out); }
.overall-fill.running { background: var(--black); }
.overall-sub { font-size: 11px; color: var(--gray-500); margin-top: 6px; }

/* Batch */
.batch-row { margin-top: 6px; }
.batch-bar { height: 3px; background: var(--gray-100); border-radius: var(--radius-full); overflow: hidden; margin-top: 4px; }
.batch-fill { height: 100%; width: 0; background: var(--black); border-radius: var(--radius-full); transition: width 0.4s var(--ease-out); }
.batch-fill.done { background: var(--green); }
.batch-fill.error { background: var(--red); }

/* Preview */
.preview-card { display: none; }
.preview-card.visible {
  display: block;
  animation: previewIn 0.5s var(--ease-out);
}
@keyframes previewIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.preview-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.preview-stats { display: flex; gap: 8px; font-size: 12px; color: var(--gray-500); margin-bottom: 14px; flex-wrap: wrap; }
.preview-stats span {
  padding: 4px 12px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  font-weight: 500;
}
.json-preview {
  background: var(--gray-950);
  color: #e0e0e0;
  padding: 18px;
  border-radius: var(--radius-md);
  font-family: var(--mono); font-size: 11px;
  max-height: 360px; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
  line-height: 1.6;
}

/* Buttons */
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn-primary {
  padding: 12px 26px;
  background: var(--black); color: var(--white);
  border: none; font-size: 13px; font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-out);
  letter-spacing: -0.1px;
}
.btn-primary:hover { opacity: 0.88; box-shadow: var(--shadow-md); }
.btn-primary:disabled { opacity: 0.25; cursor: not-allowed; box-shadow: none; }
.btn-secondary {
  padding: 12px 26px;
  background: var(--gray-100); color: var(--gray-700);
  border: none; font-size: 13px; font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-out);
}
.btn-secondary:hover { background: var(--gray-200); }
.btn-outline {
  padding: 12px 26px;
  background: var(--white); color: var(--black);
  border: 1px solid var(--gray-300); font-size: 13px; font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: all var(--duration-fast) var(--ease-out);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--black); }
.btn-ghost {
  padding: 12px 18px;
  background: transparent; color: var(--gray-500);
  border: none; font-size: 12px; font-weight: 400;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: color var(--duration-fast) var(--ease-out);
}
.btn-ghost:hover { color: var(--gray-900); }

/* Messages */
.warning { background: #fffbeb; border: 1px solid #fcd34d; padding: 10px 14px; font-size: 12px; color: #92400e; margin-top: 12px; border-radius: var(--radius-sm); }
:root[data-theme="dark"] .warning { background: #422006; border-color: #854d0e; color: #fde68a; }
.raw-response { background: var(--gray-100); border: 1px solid var(--gray-200); padding: 10px; font-family: var(--mono); font-size: 11px; max-height: 200px; overflow: auto; white-space: pre-wrap; margin-top: 8px; display: none; border-radius: var(--radius-sm); }
.note { font-size: 11px; color: var(--gray-500); margin-top: 4px; }

/* Quality */
.quality-row { display: flex; flex-direction: column; gap: 10px; }
.quality-label { font-weight: 600; font-size: 13px; }
.quality-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.quality-opt {
  display: flex; align-items: flex-start; gap: 8px; padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--duration-fast) var(--ease-out);
}
.quality-opt:hover { border-color: var(--black); background: var(--gray-50); }
.quality-opt input { display: none; }
.quality-opt:has(input:checked) {
  border-color: var(--black);
  background: var(--gray-100);
  box-shadow: 0 0 0 1px var(--black);
}
.quality-opt b { font-size: 13px; }
.quality-opt small { font-size: 11px; color: var(--gray-500); line-height: 1.3; display: block; margin-top: 2px; }
.quality-hint { font-size: 11px; color: var(--gray-500); padding: 8px 10px; background: var(--gray-50); border-left: 2px solid var(--black); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Footer */
.footer-text { text-align: center; color: var(--gray-300); font-size: 11px; margin-top: 36px; line-height: 1.6; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  body { padding: 24px 16px 40px; }
  .card { padding: 22px 18px; }
  .subtitle { font-size: 24px; margin-bottom: 24px; }
  .mode-selector { grid-template-columns: 1fr; }
  .mode-opt:first-child { border-right: none; border-bottom: 1px solid var(--gray-200); }
  .upload-banner { margin: -22px -18px 14px -18px; border-radius: 0; }
  .dropzone-area { padding: 36px 18px; }
  .btn-row { flex-direction: column; }
  .btn-row button { width: 100%; text-align: center; }
  .json-preview { max-height: 240px; }
}
