/* ===== Design tokens ===== */
:root {
  --ink: #1B1B1F;
  --paper: #FFFFFF;
  --accent: #4F46E5;
  --accent-dim: #E8E6FB;
  --subtle: #F4F4F6;
  --success: #0CA678;
  --error: #C92A2A;
  --border: #DCDCE3;
  --radius: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; }

a { color: var(--accent); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.hidden { display: none !important; }

/* ===== App shell ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.form-col {
  width: 52%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 32px 48px;
  overflow-y: auto;
}

.preview-col {
  width: 48%;
  min-height: 100vh;
  background: var(--subtle);
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}

/* ===== Progress ===== */
.progress-wrap { margin-bottom: 24px; }
.progress-bar {
  height: 6px;
  background: var(--subtle);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
.progress-label {
  font-size: 13px;
  color: #6b6b76;
  margin-top: 8px;
}

.draft-indicator {
  font-size: 13px;
  color: var(--success);
  height: 18px;
  margin-bottom: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.draft-indicator.visible { opacity: 1; }

/* ===== Screens ===== */
.form-main { flex: 1; }

.screen { max-width: 640px; }

.screen-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 12px;
  line-height: 1.2;
}

.screen-lead {
  font-size: 16px;
  color: #4a4a52;
  margin: 0 0 28px;
  line-height: 1.5;
}

.section-note {
  background: var(--accent-dim);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 24px;
  color: #35317a;
}

/* ===== Mode cards (welcome) ===== */
.mode-cards {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.mode-card {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 24px 20px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 48px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.mode-card:hover { border-color: var(--accent); }
.mode-card--selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.mode-card-emoji { font-size: 28px; }
.mode-card-title { font-size: 18px; font-weight: 600; }
.mode-card-meta { font-size: 13px; color: #55555f; }

/* ===== Buttons ===== */
.btn {
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #4038c7; }

.btn-secondary {
  background: var(--paper);
  border-color: var(--border);
  color: var(--ink);
}
.btn-secondary:hover { border-color: var(--accent); }

.btn-text {
  background: transparent;
  color: var(--accent);
  min-height: auto;
  padding: 8px 0;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-size: inherit;
}

.btn-large { width: 100%; margin-top: 8px; }

.screen-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}
.screen-actions .btn-primary { flex: 1; }

/* ===== Form fields ===== */
.field {
  margin-bottom: 24px;
}

.field-label {
  display: block;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field-required {
  color: var(--error);
  margin-left: 4px;
}

.field-helper {
  font-size: 13px;
  color: #6b6b76;
  margin: 0 0 8px;
  line-height: 1.4;
}

.field-error {
  font-size: 13px;
  color: var(--error);
  margin-top: 6px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="date"],
textarea,
select {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

textarea { min-height: 88px; resize: vertical; line-height: 1.4; }

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

input.field-invalid, textarea.field-invalid, select.field-invalid {
  border-color: var(--error);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  margin-top: 8px;
}
.checkbox-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  flex-shrink: 0;
}

/* ===== Radio cards ===== */
.radio-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.radio-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  min-height: 48px;
  background: var(--paper);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
}
.radio-card:hover { border-color: var(--accent); }
.radio-card--selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

/* ===== Rank / repeat rows ===== */
.rank-row, .repeat-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.rank-row-num {
  min-height: 48px;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--accent);
  width: 24px;
  flex-shrink: 0;
}
.repeat-row-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.row-remove-btn {
  min-height: 48px;
  width: 48px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--paper);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 18px;
  color: #6b6b76;
}
.row-remove-btn:hover { border-color: var(--error); color: var(--error); }
.row-add-btn {
  border: 2px dashed var(--border);
  background: transparent;
  border-radius: var(--radius);
  min-height: 44px;
  width: 100%;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}
.row-add-btn:hover { border-color: var(--accent); background: var(--accent-dim); }

/* ===== Details (skip-tier collapse) ===== */
details.more-detail {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 16px;
}
details.more-detail summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
}
details.more-detail[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 12px; }

/* ===== Uploader ===== */
.uploader-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  color: #6b6b76;
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.uploader-zone:hover, .uploader-zone--dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.uploader-fallback {
  margin-top: 10px;
}
.logo-local-sub {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}
.logo-local-sub-label {
  font-size: 13px;
  font-weight: 600;
  color: #4a4a52;
  margin: 0 0 8px;
}
.logo-local-sub .field-helper { margin-top: 6px; }
.uploader-fallback-label {
  font-size: 13px;
  color: #6b6b76;
  margin-bottom: 4px;
  display: block;
}
.upload-progress-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upload-progress-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 10px;
  background: var(--subtle);
  border-radius: 6px;
}
.upload-progress-item .retry-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}

/* ===== Review screen ===== */
.review-block { margin-bottom: 28px; }
.review-heading {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b6b76;
  margin: 0 0 12px;
}
.review-list { display: flex; flex-direction: column; gap: 8px; }
.review-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--subtle);
  cursor: pointer;
  font-size: 14px;
  border: none;
  text-align: left;
  width: 100%;
}
.review-row:hover { background: var(--accent-dim); }
.review-row-label { font-weight: 600; color: #4a4a52; }
.review-row-value { color: var(--ink); text-align: left; overflow-wrap: break-word; }
.review-empty { font-size: 14px; color: #6b6b76; font-style: italic; }

.confirm-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  margin: 24px 0;
  padding: 16px;
  background: var(--subtle);
  border-radius: var(--radius);
}
.confirm-row input { width: 20px; height: 20px; min-height: 0; flex-shrink: 0; margin-top: 2px; }

.upgrade-copy { font-size: 14px; }

.submit-error {
  background: #FBEBEB;
  color: var(--error);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 16px;
}
.submit-error a { color: var(--error); font-weight: 600; }

/* ===== Success screen ===== */
.next-steps { padding-left: 20px; line-height: 1.8; font-size: 15px; }

.form-footer {
  font-size: 13px;
  color: #6b6b76;
  text-align: center;
  margin-top: auto;
  padding-top: 24px;
}

/* ===== Preview ===== */
.preview-disclaimer {
  background: #FEF3C7;
  color: #78350F;
  border: 1px solid #F3D48A;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.45;
  flex-shrink: 0;
}
.preview-disclaimer strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}
.preview-disclaimer p { margin: 0; }

.browser-chrome {
  background: var(--paper);
  border-radius: 10px 10px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.browser-dots { display: flex; gap: 6px; }
.browser-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border);
}
.browser-url {
  flex: 1;
  background: var(--subtle);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: #6b6b76;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-scroll {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--paper);
}

.mock-homepage { font-size: 14px; }

.mock-slot {
  padding: 14px 20px;
  color: #9a9aa5;
  font-style: italic;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.mock-slot:hover { background: var(--subtle); }
.mock-slot--filled {
  color: var(--ink);
  font-style: normal;
}

.mock-slot--pulse {
  animation: slot-pulse 0.6s ease;
}
@media (prefers-reduced-motion: reduce) {
  .mock-slot--pulse { animation: none; }
}
@keyframes slot-pulse {
  0% { background: var(--accent-dim); }
  100% { background: transparent; }
}

.mock-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.mock-hero {
  padding: 32px 20px;
  text-align: center;
  background: var(--subtle);
}
.mock-slot--h1 { font-size: 26px; font-weight: 700; color: var(--ink); font-style: normal; }
.mock-slot--h1.mock-slot { color: #9a9aa5; font-style: italic; font-weight: 700; }
.mock-slot--sub { font-size: 15px; }
.mock-slot--cta {
  display: inline-block;
  margin-top: 12px;
  padding: 12px 24px;
  border-radius: 8px;
  background: var(--border);
  color: #6b6b76;
  font-weight: 600;
}
.mock-slot--cta.mock-slot--filled { background: var(--accent); color: #fff; font-style: normal; }
.mock-slot--micro { font-size: 12px; }
.mock-slot--media { font-size: 12px; }

.mock-stats {
  display: flex;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.mock-stat { flex: 1; text-align: center; }

.mock-pillars {
  display: flex;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.mock-pillars .mock-slot { flex: 1; background: var(--subtle); }

.mock-slot--qual, .mock-slot--about, .mock-slot--trust {
  border-bottom: 1px solid var(--border);
}

.mock-faq { padding: 8px 20px; border-bottom: 1px solid var(--border); }
.mock-faq details { margin-bottom: 8px; }
.mock-faq summary { font-weight: 600; cursor: pointer; font-size: 13px; color: var(--ink); }
.mock-faq p { font-size: 13px; color: #4a4a52; margin: 6px 0 0; }

.mock-footer { padding: 20px; }

/* ===== Mobile ===== */
.preview-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 20px;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  cursor: pointer;
}

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .form-col {
    width: 100%;
    padding: 20px;
  }
  .preview-col {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    min-height: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
    transition: height 0.3s ease;
    z-index: 40;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  }
  .preview-col.preview-col--open {
    height: 70vh;
    padding: 16px;
  }
  .preview-toggle { display: inline-flex; align-items: center; }
  .mode-cards { flex-direction: column; }
  .screen-actions { flex-direction: column; }
  .screen-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
