/* ================================================================
   Checkout Doações - Design baseado nas telas fornecidas
   Paleta verde, cards arredondados, mobile-first
   ================================================================ */

:root {
  --green-primary: #0d7c3f;      /* verde escuro dos textos de valor */
  --green-accent: #b8e986;       /* verde claro do card "recomendado" */
  --green-accent-2: #a5d972;     /* variação */
  --green-dark: #0a5d2f;
  --green-badge: #16a34a;        /* badge "recomendado" */
  --bg: #f5f6f7;                 /* fundo geral levemente cinza */
  --card: #ffffff;
  --card-muted: #f7f8f9;
  --text: #111827;
  --text-muted: #6b7280;
  --text-soft: #4b5563;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --radius: 14px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Container mobile ---------- */
.app {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header .back-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 6px;
  color: var(--text);
}
.header h1 {
  font-size: 17px;
  font-weight: 700;
}

/* ---------- Screens ---------- */
.screen {
  display: none;
  padding: 20px;
  flex: 1;
}
.screen.active { display: block; }

/* ---------- Screen 1: seleção de valor ---------- */
.heart-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.heart-badge svg { width: 22px; height: 22px; stroke: var(--green-dark); fill: none; stroke-width: 2; }

.screen-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

/* Card de progresso da meta */
.goal-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.goal-ring {
  width: 64px; height: 64px; flex-shrink: 0;
  position: relative;
}
.goal-ring svg { transform: rotate(-90deg); }
.goal-ring .pct {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--green-primary);
}
.goal-text .goal-headline {
  font-size: 14px; font-weight: 700;
}
.goal-text .goal-headline span { color: var(--green-primary); }
.goal-text .goal-sub {
  font-size: 13px; color: var(--text-muted); margin-top: 2px;
}

/* Banner IRS */
.irs-banner {
  background: linear-gradient(180deg, #c8f08f 0%, #b8e986 100%);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--green-dark);
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 18px;
}

/* Grid de valores */
.amounts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.amount-card {
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 16px 14px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
  position: relative;
  text-align: left;
  font-family: inherit;
  width: 100%;
}
.amount-card:hover { border-color: var(--green-accent-2); }
.amount-card:active { transform: scale(0.98); }
.amount-card.selected {
  border-color: var(--green-primary);
  background: #f3fbec;
}
.amount-card .value {
  font-size: 22px;
  font-weight: 800;
  color: var(--green-primary);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.amount-card .desc {
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.4;
}
.amount-card .badge {
  position: absolute;
  top: -10px; left: 12px;
  background: var(--green-badge);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ---------- Botão primário (fixo no rodapé da tela 1) ---------- */
.footer-action {
  padding: 16px 20px 24px;
  background: var(--bg);
}
.btn-primary {
  width: 100%;
  background: var(--green-primary);
  color: #fff;
  border: none;
  padding: 15px;
  border-radius: 28px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  font-family: inherit;
}
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:disabled {
  background: #b5cdb9;
  cursor: not-allowed;
}

/* ---------- Screen 2: opção de identificação ---------- */
.donation-summary {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding: 0 2px;
}
.option-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  margin-bottom: 12px;
  transition: all 0.15s;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.option-card:hover { border-color: var(--green-accent-2); }
.option-card.selected {
  border-color: var(--green-primary);
  background: #f3fbec;
}
.option-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--green-accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.option-icon svg { width: 20px; height: 20px; stroke: var(--green-dark); fill: none; stroke-width: 2; }
.option-text h3 {
  font-size: 15px; font-weight: 700;
  margin-bottom: 2px;
}
.option-text p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- Screens 3 e 4: Confirmação ---------- */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}
.form-group label .optional {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 13px;
}
.form-group input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 15px;
  background: var(--card);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus { border-color: var(--green-primary); }

.phone-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.15s;
}
.phone-input:focus-within { border-color: var(--green-primary); }
.phone-input .prefix {
  font-weight: 700; color: var(--text-muted); font-size: 15px;
}
.phone-input input {
  border: none;
  padding: 13px 0;
  flex: 1;
  background: transparent;
}

/* Método de pagamento */
.method-label {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}
.methods-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.method-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  min-height: 74px;
  transition: all 0.15s;
}
.method-card.selected {
  border-color: var(--green-primary);
  background: #eaf6dd;
}
.method-card .mbway-logo,
.method-card .mb-logo {
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.method-card .mbway-logo .mb {
  background: #ffeb3b;
  color: #000;
  padding: 4px 6px;
  border-radius: 3px;
  font-size: 16px;
}
.method-card .mb-logo .mb-box {
  background: #fff;
  color: #004a9f;
  border: 2px solid #004a9f;
  padding: 4px 6px;
  border-radius: 3px;
  font-size: 16px;
  font-weight: 900;
}
.method-card .mb-logo .sub {
  font-size: 9px;
  color: #004a9f;
  letter-spacing: 0.5px;
}

/* Resumo do valor */
.summary-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.summary-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14.5px;
}
.summary-line.total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 12px;
  font-weight: 800;
  font-size: 15px;
}

/* ---------- Screen: Aguardando pagamento ---------- */
.waiting-screen {
  text-align: center;
  padding: 40px 20px;
}
.spinner {
  width: 60px; height: 60px;
  border: 4px solid var(--border);
  border-top-color: var(--green-primary);
  border-radius: 50%;
  margin: 20px auto 24px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.waiting-screen h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}
.waiting-screen p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 300px;
  margin: 0 auto 20px;
  line-height: 1.5;
}

/* Card com dados do Multibanco */
.mb-reference-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 20px auto;
  max-width: 340px;
  text-align: left;
  box-shadow: var(--shadow-md);
}
.mb-reference-card .title {
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 14px;
  color: var(--green-primary);
}
.mb-ref-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.mb-ref-row:last-child { border-bottom: none; }
.mb-ref-row .label { color: var(--text-muted); }
.mb-ref-row .value {
  font-weight: 700;
  font-family: "SF Mono", Menlo, monospace;
  letter-spacing: 0.5px;
}

/* Screens de resultado */
.result-screen {
  text-align: center;
  padding: 60px 30px;
}
.result-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 40px;
}
.result-icon.success { background: var(--green-accent); color: var(--green-dark); }
.result-icon.failure { background: #ffe0e0; color: #c0392b; }
.result-screen h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 10px;
}
.result-screen p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Utilidades */
.hidden { display: none !important; }
