/* ============================================================
   ID Photo Studio — styles
   Brand-neutral, accessible palette. No external fonts/assets.
   ============================================================ */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --border: #dfe2e8;
  --text: #1c2027;
  --text-muted: #5b6270;
  --primary: #2a5cdb;
  --primary-hover: #1f47b0;
  --primary-contrast: #ffffff;
  --accent: #0f9d6b;
  --danger: #d13b3b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 32, 0.06), 0 4px 16px rgba(20, 24, 32, 0.06);
  font-size: 16px;
}

* { box-sizing: border-box; }

/* Author styles like `.step-panel { display:flex }` would otherwise beat
   the UA stylesheet's `[hidden]{display:none}` — force it explicitly so
   step panels actually hide instead of stacking. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; }
.brand-mark { font-size: 1.4rem; }

.steps {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: var(--surface-2);
}

.steps li.active { color: var(--primary-contrast); background: var(--primary); font-weight: 600; }
.steps li.done { color: var(--accent); background: #e5f6ef; }

.step-num {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  font-size: 0.75rem;
}
.steps li.active .step-num { background: rgba(255,255,255,0.25); }

.privacy-badge {
  font-size: 0.78rem;
  color: var(--accent);
  background: #e5f6ef;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Layout ---------- */
.app-main { flex: 1; display: flex; }
.step-panel { flex: 1; display: flex; }
.panel-inner { flex: 1; max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; width: 100%; }

.upload-inner { max-width: 720px; text-align: center; }
.upload-inner h1 { font-size: 1.6rem; margin-bottom: 8px; }
.subtitle { color: var(--text-muted); margin-bottom: 28px; }

.editor-layout, .export-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  align-items: start;
  text-align: left;
}

@media (max-width: 860px) {
  .editor-layout, .export-layout { grid-template-columns: 1fr; }
}

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.dragover {
  border-color: var(--primary);
  background: #eef2fd;
}
.dropzone-icon { font-size: 2.6rem; }
.dropzone-text strong { display: block; font-size: 1.05rem; }
.dropzone-text span { color: var(--text-muted); font-size: 0.9rem; }

.upload-tips {
  margin-top: 28px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.upload-tips h3 { margin: 0 0 8px; font-size: 0.95rem; }
.upload-tips ul { margin: 0; padding-left: 20px; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; }

/* ---------- Side controls ---------- */
.side-controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 84px;
}
.side-controls h2 { font-size: 0.95rem; margin: 12px 0 2px; }
.side-controls h2:first-child { margin-top: 0; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--text-muted); }
.field select, .field input[type="number"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--surface);
  color: var(--text);
}
.field input[type="range"] { width: 100%; }
.field input[type="color"] { width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.field-row { display: flex; gap: 8px; }
.field-row .field { flex: 1; }

.preset-notes { font-size: 0.8rem; color: var(--text-muted); background: var(--surface-2); padding: 8px 10px; border-radius: 8px; margin: 0; }
.hint { font-size: 0.82rem; color: var(--text-muted); margin: 0; line-height: 1.4; }
.hint.small { font-size: 0.75rem; }
.hint.disclaimer { background: #fff6e5; border: 1px solid #f0dca3; padding: 8px 10px; border-radius: 8px; }
.hint.auto-note { background: #e5f6ef; border: 1px solid #b9e6d1; padding: 8px 10px; border-radius: 8px; color: #0f6b48; }
.hint.ml-status { font-size: 0.78rem; }
.hint.ml-loading { color: var(--text-muted); }
.hint.ml-active { color: var(--accent); font-weight: 600; }
.hint.ml-unavailable { color: var(--text-muted); }
.hint.plan-upsell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
}
.hint.plan-upsell a {
  background: var(--primary);
  color: var(--primary-contrast);
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}
.hint.plan-upsell a:hover { background: var(--primary-hover); }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
}
.swatch.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(42,92,219,0.25); }

.tool-tabs { display: flex; gap: 6px; }
.tool-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.85rem;
}
.tool-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.tool-group { display: flex; flex-direction: column; gap: 10px; }
.brush-mode-row { display: flex; gap: 8px; }
.brush-mode-row .btn { flex: 1; }

.button-row { display: flex; gap: 8px; }
.button-row .btn { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--surface-2); }
.btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.btn-primary { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: var(--surface); }

.btn-text { background: transparent; border: none; color: var(--primary); text-decoration: underline; padding: 4px 0; text-align: left; }
.btn-text:hover { background: transparent; color: var(--primary-hover); }

/* ---------- Canvas areas ---------- */
.canvas-area { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.canvas-stage {
  position: relative;
  background: repeating-conic-gradient(#e9ebef 0% 25%, #fff 0% 50%) 0 0 / 20px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
  max-width: 100%;
}
.canvas-stage canvas { display: block; max-width: 100%; height: auto; }

.guide-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.guide-oval {
  position: absolute;
  border: 2px dashed rgba(255,255,255,0.9);
  border-radius: 50%;
  box-shadow: 0 0 0 2000px rgba(0,0,0,0.28);
  left: var(--oval-left, 25%);
  top: var(--oval-top, 15%);
  width: var(--oval-w, 50%);
  height: var(--oval-h, 55%);
}
.guide-eyeline {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px dashed rgba(255,80,80,0.85);
  top: var(--eyeline-top, 42%);
}

.stage-actions { display: flex; gap: 10px; }

.preview-stage { background: var(--surface); }
.export-preview-area { width: 100%; }
.export-preview-area h3 { font-size: 0.9rem; margin: 4px 0; color: var(--text-muted); }
.sheet-stage { max-height: 70vh; overflow: auto; }

/* ---------- Footer ---------- */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

@media (max-width: 600px) {
  .app-header { gap: 10px; padding: 10px 14px; }
  .brand-name { display: none; }
  .step-label { display: none; }
  .panel-inner { padding: 18px 14px 40px; }
}
