/* ── Morandi Font Faces ───────────────────────────────────────────────────── */
@font-face { font-family: 'Morandi'; src: url('/static/Morandi_Black.otf'); font-weight: 900; font-style: normal; }
@font-face { font-family: 'Morandi'; src: url('/static/Morandi_Black_Italic.otf'); font-weight: 900; font-style: italic; }
@font-face { font-family: 'Morandi'; src: url('/static/Morandi_Regular.otf'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Morandi'; src: url('/static/Morandi_Thin.otf'); font-weight: 100; font-style: normal; }
@font-face { font-family: 'Morandi Condensed'; src: url('/static/Morandi_Cond_Bold.otf'); font-weight: 700; }
@font-face { font-family: 'Morandi Condensed'; src: url('/static/Morandi_Cond_SemiBold.otf'); font-weight: 600; }
@font-face { font-family: 'Morandi Condensed'; src: url('/static/Morandi_Cond_Medium.otf'); font-weight: 500; }
@font-face { font-family: 'Morandi Condensed'; src: url('/static/Morandi_Cond.otf'); font-weight: 400; }
@font-face { font-family: 'Morandi Condensed'; src: url('/static/Morandi_Cond_Light.otf'); font-weight: 300; }
@font-face { font-family: 'Morandi Condensed'; src: url('/static/Morandi_Cond_Thin.otf'); font-weight: 100; }
@font-face { font-family: 'Morandi Extended'; src: url('/static/Morandi_Ext_Thin.otf'); font-weight: 100; }
@font-face { font-family: 'Morandi Extended'; src: url('/static/Morandi_Ext_UltraLight.otf'); font-weight: 200; }

/* ── Brand Tokens ─────────────────────────────────────────────────────────── */
:root {
  --gb-yellow:  #FFCD00;
  --gb-black:   #000000;
  --gb-white:   #FFFFFF;
  --gb-cream:   #FFFAE0;
  --gb-muted:   #6b6b6b;
  --gb-border:  #E0E0E0;
  --gb-surface: #FAFAFA;

  --f-title: 'Morandi', 'Helvetica Neue', sans-serif;
  --f-body:  'Morandi', 'Helvetica Neue', sans-serif;
  --f-cond:  'Morandi Condensed', 'Arial Narrow', sans-serif;

  --radius: 2px;
  --transition: 150ms ease;
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ─────────────────────────────────────────────────────────────────── */
body {
  font-family: var(--f-body);
  font-weight: 400;
  background: #F2F2F2;
  color: var(--gb-black);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Page Header ──────────────────────────────────────────────────────────── */
.page-header {
  background: var(--gb-yellow);
  color: var(--gb-black);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 40px;
  border-bottom: 3px solid var(--gb-black);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo { height: 44px; width: auto; flex-shrink: 0; }

.header-text { display: flex; flex-direction: column; gap: 2px; }

.header-title {
  font-family: var(--f-title);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1;
}

.header-tagline {
  font-family: var(--f-cond);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  opacity: 0.75;
}

/* ── Main Container ───────────────────────────────────────────────────────── */
.container {
  max-width: 960px;
  width: 100%;
  margin: 36px auto;
  background: var(--gb-white);
  border: 2px solid var(--gb-black);
  padding: 40px 44px;
  flex: 1;
}

/* ── Wizard ───────────────────────────────────────────────────────────────── */
.wizard {
  display: flex;
  align-items: center;
  margin-bottom: 44px;
}

.wizard-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.wizard-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--gb-border);
  background: var(--gb-white);
  color: var(--gb-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-cond);
  font-weight: 700;
  font-size: 0.9rem;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.wizard-label {
  font-family: var(--f-cond);
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--gb-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color var(--transition);
}

.wizard-track {
  flex: 1;
  height: 2px;
  background: var(--gb-border);
  margin: 0 8px;
  margin-bottom: 24px; /* offset for label */
  transition: background var(--transition);
}

.wizard-item.active .wizard-circle {
  background: var(--gb-yellow);
  border-color: var(--gb-black);
  color: var(--gb-black);
}

.wizard-item.active .wizard-label { color: var(--gb-black); font-weight: 700; }

.wizard-item.done .wizard-circle {
  background: var(--gb-black);
  border-color: var(--gb-black);
  color: var(--gb-yellow);
}

.wizard-item.done ~ .wizard-track { background: var(--gb-black); }
.wizard-item.done .wizard-label { color: var(--gb-black); }

/* ── Step Content ─────────────────────────────────────────────────────────── */
.step-content { display: none; }
.step-content.active { display: block; }
.hidden { display: none !important; }

/* ── Section Labels ───────────────────────────────────────────────────────── */
.section-block { margin-bottom: 28px; }

.section-label {
  font-family: var(--f-cond);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gb-muted);
  margin-bottom: 10px;
  display: block;
}

/* ── Drop Zone ────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--gb-border);
  background: var(--gb-surface);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--gb-black);
  background: var(--gb-cream);
}

.drop-zone.has-file {
  border-style: solid;
  border-color: var(--gb-black);
  background: var(--gb-cream);
}

.drop-icon {
  width: 48px;
  height: 48px;
  color: var(--gb-black);
  margin: 0 auto 14px;
  display: block;
}

.drop-primary {
  font-family: var(--f-cond);
  font-weight: 600;
  font-size: 1rem;
  color: var(--gb-black);
  margin-bottom: 4px;
}

.drop-secondary {
  font-family: var(--f-cond);
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--gb-muted);
}

.drop-link {
  color: var(--gb-black);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--gb-yellow);
  text-underline-offset: 2px;
}

.drop-file-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  background: var(--gb-yellow);
  border: 1.5px solid var(--gb-black);
  padding: 4px 12px;
  font-family: var(--f-cond);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gb-black);
  border-radius: var(--radius);
}

/* ── CSV Table ────────────────────────────────────────────────────────────── */
#csv-table-wrapper {
  max-height: 280px;
  overflow-y: auto;
  overflow-x: auto;
  border: 2px solid var(--gb-black);
  border-radius: var(--radius);
}

#csv-table { width: 100%; border-collapse: collapse; }

#csv-table th {
  background: var(--gb-black);
  color: var(--gb-yellow);
  font-family: var(--f-cond);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}

#csv-table td {
  padding: 9px 14px;
  font-family: var(--f-cond);
  font-weight: 400;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--gb-border);
  transition: background var(--transition);
}

#csv-table tbody tr { cursor: pointer; }
#csv-table tbody tr:last-child td { border-bottom: none; }
#csv-table tbody tr:hover td { background: var(--gb-cream); }
#csv-table tbody tr.selected td { background: var(--gb-yellow); }

/* ── Actions Row ──────────────────────────────────────────────────────────── */
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  border: 2px solid var(--gb-black);
  background: var(--gb-yellow);
  color: var(--gb-black);
  font-family: var(--f-cond);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition), transform var(--transition);
  white-space: nowrap;
}

button:hover:not(:disabled) {
  background: var(--gb-black);
  color: var(--gb-yellow);
  transform: translateY(-1px);
}

button:active:not(:disabled) { transform: translateY(0); }

button:disabled {
  background: #E8E8E8;
  border-color: #C8C8C8;
  color: #AAAAAA;
  cursor: not-allowed;
  transform: none;
}

button.btn-ghost {
  background: transparent;
  border-color: var(--gb-border);
  color: var(--gb-muted);
}

button.btn-ghost:hover:not(:disabled) {
  background: var(--gb-black);
  border-color: var(--gb-black);
  color: var(--gb-white);
}

button.btn-active {
  background: var(--gb-black);
  border-color: var(--gb-black);
  color: var(--gb-yellow);
}

button.btn-active:hover:not(:disabled) {
  background: var(--gb-yellow);
  border-color: var(--gb-black);
  color: var(--gb-black);
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--gb-border);
  border-top-color: var(--gb-black);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ────────────────────────────────────────────────────────────────── */
.error {
  font-family: var(--f-cond);
  font-weight: 600;
  font-size: 0.88rem;
  color: #C0000A;
}

/* ── Warnings ─────────────────────────────────────────────────────────────── */
.warnings {
  background: var(--gb-cream);
  border-left: 4px solid var(--gb-yellow);
  border: 2px solid var(--gb-black);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-family: var(--f-cond);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* ── Canvas ───────────────────────────────────────────────────────────────── */
.canvas-wrapper {
  overflow: auto;
  border: 2px solid var(--gb-black);
  max-width: 100%;
  border-radius: var(--radius);
}

#preview-canvas { display: block; }

.field-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-family: var(--f-cond);
  font-weight: 300;
  font-size: 0.83rem;
  color: var(--gb-muted);
}

/* ── Export Summary ───────────────────────────────────────────────────────── */
.summary {
  background: var(--gb-cream);
  border: 2px solid var(--gb-black);
  border-left: 6px solid var(--gb-yellow);
  padding: 18px 20px;
  margin-bottom: 28px;
  font-family: var(--f-cond);
  font-size: 0.92rem;
  line-height: 1.8;
}

/* ── Format Selector ──────────────────────────────────────────────────────── */
.format-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.format-option { cursor: pointer; }
.format-option input[type="radio"] { display: none; }

.format-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 28px;
  border: 2px solid var(--gb-border);
  background: var(--gb-surface);
  font-family: var(--f-cond);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gb-muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  user-select: none;
}

.format-option input[type="radio"]:checked + .format-box {
  border-color: var(--gb-black);
  background: var(--gb-yellow);
  color: var(--gb-black);
}

.format-box:hover {
  border-color: var(--gb-black);
  background: var(--gb-cream);
  color: var(--gb-black);
}

/* ── Output Preview ───────────────────────────────────────────────────────── */
.output-preview-pages {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}

.output-preview-page {
  border: 2px solid var(--gb-black);
  border-radius: var(--radius);
  overflow: hidden;
}

.output-preview-page-label {
  background: var(--gb-black);
  color: var(--gb-yellow);
  font-family: var(--f-cond);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 5px 12px;
}

.output-preview-page img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.page-footer {
  max-width: 960px;
  width: 100%;
  margin: 0 auto 32px;
  padding: 10px 44px;
  border-top: 2px solid var(--gb-black);
  font-family: var(--f-cond);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--gb-muted);
}
