/* ── Design System — Roney Papel ──────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Inter:wght@400;500;600;700&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
  --gold:        #C8922A;
  --gold-dark:   #9E6F18;
  --gold-light:  #E8B84B;
  --gold-muted:  #F0D080;
  --gold-tint:   #FDF5E4;

  --white:       #FFFFFF;
  --bg:          #F7F7F8;
  --surface:     #FFFFFF;
  --border:      #E8E8EC;
  --border-focus:#C8922A;

  --text-primary:   #111111;
  --text-secondary: #6B6B7B;
  --text-disabled:  #ADADBB;

  --red:         #D32F2F;
  --red-tint:    #FFF1F1;
  --green:       #2E7D32;
  --green-tint:  #F1FAF1;

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   18px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-gold: 0 4px 14px rgba(200,146,42,0.35);

  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
}

/* ── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.page { display: flex; flex-direction: column; min-height: 100vh; }

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
}

.main-content {
  flex: 1;
  padding: 20px 0 48px;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.header-logo {
  font-family: var(--font-display);
  font-size: 1.1875rem;
  color: var(--gold-dark);
  letter-spacing: 0.01em;
  flex: 1;
  text-align: center;
}

.header-side {
  width: 40px;
  display: flex;
  align-items: center;
}
.header-side.right { justify-content: flex-end; }

.header-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.header-icon-btn:hover { background: var(--bg); color: var(--text-primary); }

/* ── Progress Bar ────────────────────────────────────────────────────── */
.progress-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
}

.progress-steps {
  display: flex;
  align-items: center;
  max-width: 440px;
  margin: 0 auto;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.progress-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-disabled);
  transition: all 0.2s;
}
.progress-step.active .progress-step-dot {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--white);
}
.progress-step.done .progress-step-dot {
  border-color: var(--gold-dark);
  background: var(--gold-dark);
  color: var(--white);
}

.progress-step-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-disabled);
  letter-spacing: 0.02em;
}
.progress-step.active .progress-step-label { color: var(--gold-dark); font-weight: 600; }
.progress-step.done  .progress-step-label  { color: var(--gold-dark); }

.progress-connector {
  height: 2px;
  flex: 1;
  background: var(--border);
  margin-bottom: 18px;
  transition: background 0.2s;
}
.progress-connector.done { background: var(--gold-dark); }

/* ── Typography ──────────────────────────────────────────────────────── */
.page-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 52px;
  padding: 0 22px;
  border-radius: var(--radius-lg);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.14s ease;
  text-decoration: none;
  width: 100%;
  letter-spacing: 0.005em;
}
.btn:active { transform: scale(0.975); }
.btn i { font-size: 1.125rem; }

.btn-primary {
  background: var(--gold);
  color: var(--white);
  box-shadow: var(--shadow-gold);
}
.btn-primary:hover { background: var(--gold-dark); box-shadow: none; }

.btn-secondary {
  background: var(--white);
  color: var(--gold-dark);
  border: 1.5px solid var(--gold-light);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--gold-tint); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

.btn-danger {
  background: var(--white);
  color: var(--red);
  border: 1.5px solid #FFCDD2;
}
.btn-danger:hover { background: var(--red-tint); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
}

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card + .card { margin-top: 12px; }

/* ── Upload Card ─────────────────────────────────────────────────────── */
.upload-card {
  background: var(--white);
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}

.upload-card:hover { border-color: var(--gold); background: var(--gold-tint); }

/* Estado vazio: padding generoso */
.upload-card:not(.has-image) { padding: 36px 20px; }

/* Estado com imagem: sem padding, imagem ocupa todo o card */
.upload-card.has-image {
  border-style: solid;
  border-color: var(--border);
  background: #111;
}

.upload-card input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
  z-index: 2;
}

.upload-card-icon {
  width: 60px; height: 60px;
  background: var(--gold-tint);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 1.625rem;
  color: var(--gold);
}

.upload-card-label {
  font-size: 0.9375rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 4px;
}

.upload-card-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Preview: mostra imagem inteira, sem corte, proporcoes originais */
.upload-card-preview {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  display: block;
  background: #111;
}

.upload-card-change {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 3;
  background: rgba(0,0,0,0.60);
  backdrop-filter: blur(6px);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  padding: 7px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
  font-family: var(--font);
}
.upload-card-change:hover { background: rgba(0,0,0,0.80); }

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 7px;
}

.form-input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,146,42,0.15);
}
.form-input.error { border-color: var(--red); }
.form-input.error:focus { box-shadow: 0 0 0 3px rgba(211,47,47,0.12); }

.form-input-wrap { position: relative; }
.form-input-wrap .form-input { padding-right: 50px; }

.form-input-action {
  position: absolute;
  right: 0; top: 0; bottom: 0; width: 50px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-disabled); font-size: 1.25rem;
  transition: color 0.15s;
}
.form-input-action:hover { color: var(--gold); }

.form-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 5px;
}

.form-error {
  font-size: 0.8125rem;
  color: var(--red);
  margin-top: 5px;
  display: none;
  align-items: center;
  gap: 4px;
}
.form-error.visible { display: flex; }

/* ── Input com unidade ───────────────────────────────────────────────── */
.input-unit-wrap {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--white);
  min-height: 50px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-unit-wrap:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,146,42,0.15);
}
.input-unit-wrap input {
  flex: 1; border: none; outline: none;
  padding: 0 14px;
  font-size: 0.9375rem;
  font-family: var(--font);
  color: var(--text-primary);
  background: transparent;
  min-width: 0;
}
.input-unit {
  padding: 0 14px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  border-left: 1.5px solid var(--border);
  display: flex; align-items: center;
}

/* ── Angle Selector ──────────────────────────────────────────────────── */
.angle-selector { display: flex; gap: 8px; }

.angle-option {
  flex: 1;
  min-height: 72px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 10px 6px;
  transition: all 0.14s;
  box-shadow: var(--shadow-xs);
}
.angle-option:hover { border-color: var(--gold-light); background: var(--gold-tint); }
.angle-option.selected {
  border-color: var(--gold);
  background: var(--gold-tint);
  box-shadow: 0 0 0 3px rgba(200,146,42,0.15);
}
.angle-option svg { width: 34px; height: 26px; }
.angle-option-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.angle-option.selected .angle-option-label { color: var(--gold-dark); }

/* ── Info Card ───────────────────────────────────────────────────────── */
.info-card {
  background: #FFFBF0;
  border: 1px solid #F0D080;
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.55;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.info-card i { color: var(--gold); font-size: 1rem; margin-top: 2px; flex-shrink: 0; }

/* ── Home ────────────────────────────────────────────────────────────── */
.home-action-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.14s ease;
}
.home-action-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gold-muted);
  transform: translateY(-1px);
}
.home-action-card:active { transform: scale(0.98); }

.home-action-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem;
  flex-shrink: 0;
}
.home-action-icon.primary { background: var(--gold); color: var(--white); box-shadow: var(--shadow-gold); }
.home-action-icon.secondary { background: var(--bg); color: var(--text-secondary); }

.home-action-text h3 { font-size: 0.9375rem; font-weight: 600; margin-bottom: 2px; }
.home-action-text p  { font-size: 0.8125rem; color: var(--text-secondary); }
.home-caret { color: var(--border); font-size: 1.25rem; margin-left: auto; flex-shrink: 0; }

/* ── Loading ─────────────────────────────────────────────────────────── */
.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 40px 20px;
  text-align: center;
  gap: 20px;
}

.spinner-ring {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-label    { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.loading-sublabel { font-size: 0.875rem; color: var(--text-secondary); margin-top: 4px; }

/* ── Result ──────────────────────────────────────────────────────────── */
.result-image-wrap {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
  background: #111;
}
.result-image { width: 100%; height: auto; display: block; }

.result-description {
  background: #FFFBF0;
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--gold);
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 6px;
}

/* ── Login ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #1A1107 0%, #3D2B00 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand-name {
  font-family: var(--font-display);
  font-size: 2.25rem;
  color: var(--gold-light);
  letter-spacing: 0.01em;
}
.login-brand-tag {
  font-size: 0.875rem;
  color: rgba(232,184,75,0.55);
  margin-top: 6px;
  font-weight: 400;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 28px 24px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
}

.login-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* ── Config ──────────────────────────────────────────────────────────── */
.config-section { margin-bottom: 24px; }

.config-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.config-section-title i { font-size: 0.9375rem; color: var(--gold); }

/* ── Toast ───────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 440px;
}

.toast {
  background: var(--text-primary);
  color: var(--white);
  padding: 13px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toast-in 0.2s cubic-bezier(.34,1.56,.64,1);
}
.toast i { font-size: 1.125rem; flex-shrink: 0; }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Utilities ───────────────────────────────────────────────────────── */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-secondary); font-size: 0.875rem; }
.hidden       { display: none !important; }
.divider      { height: 1px; background: var(--border); margin: 18px 0; }
