/* ==========================================================================
   ci4-billing — billing-checkout.css
   Estilo NEUTRO do checkout comum. Cada site aplica a própria cara só com
   variáveis (no :root, no body ou no contêiner), sem reescrever seletor:

     --billing-accent            cor dos botões principais e do foco
     --billing-accent-contrast   texto sobre o accent
     --billing-text              texto (padrão: herda do site)
     --billing-muted             texto secundário
     --billing-surface           fundo dos cartões (padrão: transparente)
     --billing-border            bordas
     --billing-radius            raio de canto
     --billing-danger / --billing-success / --billing-warning
     --billing-font              fonte (padrão: herda)
     --billing-gap               espaçamento base

   Tema escuro: o padrão herda cor de texto e usa bordas translúcidas, então
   funciona no claro e no escuro sem nada; o site redefine as variáveis no
   seletor do tema dele (ex.: [data-theme="dark"] .bc { ... }).
   O QR fica SEMPRE sobre branco: leitor de QR falha com fundo escuro.
   ========================================================================== */

.bc {
  font-family: var(--billing-font, inherit);
  color: var(--billing-text, inherit);
  display: flex;
  flex-direction: column;
  gap: var(--billing-gap, 16px);
  line-height: 1.5;
  min-width: 0;
}

/* o componente usa o atributo hidden; CSS do site com display:flex/grid nos
   mesmos elementos não pode "desesconder" nada */
.bc [hidden],
.bc[hidden] {
  display: none !important;
}

.bc *,
.bc *::before,
.bc *::after {
  box-sizing: border-box;
}

.bc-status:empty {
  display: none;
}

.bc-status {
  margin: 0;
  font-size: 14px;
  color: var(--billing-muted, inherit);
  opacity: .9;
}

/* ---------------------------------------------------------------- avisos -- */

.bc-alert,
.bc-result {
  border: 1px solid var(--billing-border, rgba(127, 127, 127, .35));
  border-radius: var(--billing-radius, 12px);
  padding: 14px 16px;
  background: var(--billing-surface, transparent);
}

.bc-alert {
  border-color: var(--billing-danger, #c0392b);
}

.bc-alert-text,
.bc-result-text {
  margin: 0;
}

.bc-result[data-tone="ok"] {
  border-color: var(--billing-success, #1e8e5a);
}

.bc-result[data-tone="warn"] {
  border-color: var(--billing-warning, #b7791f);
}

.bc-result[data-tone="err"] {
  border-color: var(--billing-danger, #c0392b);
}

.bc-alert-actions,
.bc-result-actions,
.bc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.bc-actions:first-child {
  margin-top: 0;
}

/* ---------------------------------------------------------------- resumo -- */

.bc-summary,
.bc-pix,
.bc-payer {
  border: 1px solid var(--billing-border, rgba(127, 127, 127, .35));
  border-radius: var(--billing-radius, 12px);
  padding: 16px;
  background: var(--billing-surface, transparent);
}

.bc-summary-title,
.bc-pix-title,
.bc-acc-plan {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
}

.bc-rows {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bc-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.bc-row dt {
  color: var(--billing-muted, inherit);
}

.bc-row dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bc-row-total {
  border-top: 1px solid var(--billing-border, rgba(127, 127, 127, .35));
  padding-top: 8px;
  margin-top: 4px;
  font-weight: 600;
  font-size: 15px;
}

.bc-row-credit dd {
  color: var(--billing-success, #1e8e5a);
}

.bc-notes {
  margin-top: 10px;
}

.bc-note {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--billing-muted, inherit);
}

.bc-note-charge[data-tone="err"] {
  color: var(--billing-danger, #c0392b);
}

/* ------------------------------------------------------------- pagador -- */

.bc-field + .bc-field {
  margin-top: 12px;
}

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

.bc-input,
.bc-pix-code {
  width: 100%;
  font: inherit;
  font-size: 16px; /* abaixo de 16px o Safari do iOS dá zoom no foco */
  color: inherit;
  background: transparent;
  border: 1px solid var(--billing-border, rgba(127, 127, 127, .5));
  border-radius: calc(var(--billing-radius, 12px) - 4px);
  padding: 10px 12px;
}

.bc-input[aria-invalid="true"] {
  border-color: var(--billing-danger, #c0392b);
}

.bc-help {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--billing-muted, inherit);
}

.bc-error {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--billing-danger, #c0392b);
}

.bc-error:empty {
  display: none;
}

/* -------------------------------------------------------------- botões -- */

.bc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px; /* alvo de toque */
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  border-radius: calc(var(--billing-radius, 12px) - 2px);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.bc-btn-block {
  width: 100%;
}

.bc-btn-primary {
  background: var(--billing-accent, #2d5bd7);
  color: var(--billing-accent-contrast, #fff);
}

.bc-btn-ghost {
  background: transparent;
  color: inherit;
  border-color: var(--billing-border, rgba(127, 127, 127, .5));
}

.bc-btn-danger {
  background: transparent;
  color: var(--billing-danger, #c0392b);
  border-color: var(--billing-danger, #c0392b);
}

.bc-btn[disabled],
.bc-btn[aria-busy="true"] {
  opacity: .6;
  cursor: default;
}

.bc-btn:focus-visible,
.bc-input:focus-visible,
.bc-pix-code:focus-visible,
.bc-link:focus-visible,
.bc-pix-title:focus-visible,
.bc-result-text:focus-visible {
  outline: 3px solid var(--billing-accent, #2d5bd7);
  outline-offset: 2px;
}

.bc-link {
  color: var(--billing-accent, #2d5bd7);
  text-decoration: underline;
}

/* ------------------------------------------------------------ embutido -- */

.bc-embedded {
  min-height: 320px;
  border-radius: var(--billing-radius, 12px);
}

.bc-embedded[aria-busy="true"] {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--billing-border, rgba(127, 127, 127, .35));
}

.bc-embedded-loading {
  margin: 0;
  color: var(--billing-muted, inherit);
}

/* ----------------------------------------------------------------- PIX -- */

.bc-pix {
  text-align: center;
}

.bc-pix-qr {
  display: inline-block;
  background: #fff;
  padding: 10px;
  border-radius: 10px;
  line-height: 0;
}

.bc-pix-img {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.bc-pix-amount {
  margin: 10px 0 0;
  font-size: 18px;
  font-weight: 600;
}

.bc-pix-hint {
  margin: 8px auto 14px;
  max-width: 34em;
  font-size: 13px;
  color: var(--billing-muted, inherit);
}

.bc-pix .bc-label {
  text-align: left;
}

.bc-pix-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* 16px: o recuo do "copiar" põe o foco aqui, e abaixo disso o Safari do iOS dá zoom */
  font-size: 16px;
  resize: none;
  word-break: break-all;
}

.bc-pix-copy {
  width: 100%;
  margin-top: 10px;
}

.bc-pix-expires,
.bc-pix-alt {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--billing-muted, inherit);
}

.bc-pix-wait {
  margin: 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
}

.bc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--billing-warning, #b7791f);
  animation: bc-pulse 1.4s ease-in-out infinite;
  flex: none;
}

.bc-pix-wait[data-tone="ok"] .bc-dot {
  background: var(--billing-success, #1e8e5a);
  animation: none;
}

.bc-pix-wait[data-tone="warn"] .bc-dot {
  animation: none;
}

@keyframes bc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

@media (prefers-reduced-motion: reduce) {
  .bc-dot {
    animation: none;
  }
}

/* --------------------------------------------------------------- conta -- */

.bc-acc-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.bc-acc-head .bc-acc-plan {
  margin: 0;
}

.bc-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
}

.bc-pill[data-status="active"],
.bc-pill[data-status="trialing"] {
  color: var(--billing-success, #1e8e5a);
}

.bc-pill[data-status="pending_payment"],
.bc-pill[data-status="cancelled"] {
  color: var(--billing-warning, #b7791f);
}

.bc-pill[data-status="overdue"],
.bc-pill[data-status="unpaid"] {
  color: var(--billing-danger, #c0392b);
}

.bc-pill[data-status="expired"] {
  color: var(--billing-muted, inherit);
}

.bc-confirm {
  border: 1px solid var(--billing-danger, #c0392b);
  border-radius: var(--billing-radius, 12px);
  padding: 14px 16px;
}

.bc-confirm-text {
  margin: 0;
}

@media (max-width: 480px) {
  .bc-actions .bc-btn {
    flex: 1 1 100%;
  }
}
