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

:root {
  --bg-primary: #0a0a0f;
  --bg-card: #16161f;
  --border-default: #2a2a3a;
  --border-selected: #00d4ff;
  --text-primary: #f0f0f5;
  --text-secondary: #9898a8;
  --accent-cyan: #00d4ff;
  --accent-blue: #0066ff;
  --gradient-accent: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  --gradient-cta: linear-gradient(135deg, #16a34a, #14532d);
  --glow-selected: 0 0 24px rgba(0, 212, 255, 0.25);
  --glow-hover: 0 0 16px rgba(0, 212, 255, 0.12);
  --radius: 16px;
  --transition: 0.25s ease;
  --page-width: 600px;
  --summary-bg: #ffffff;
  --summary-border: rgba(0, 102, 255, 0.15);
  --summary-label: #0066ff;
  --summary-text: #0a0a0f;
}

html {
  font-size: 16px;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0, 212, 255, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0, 102, 255, 0.06), transparent);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

.init-error {
  max-width: 600px;
  margin: 1rem auto;
  padding: 1rem 1.25rem;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.5);
  border-radius: 12px;
  color: #fecaca;
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header */

.header {
  text-align: center;
}

.logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.logo-img {
  width: 140px;
  height: auto;
  display: block;
}

@media (min-width: 768px) {
  .logo-img {
    width: 160px;
  }
}

.title {
  font-size: clamp(1.375rem, 5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* Plans — sempre em blocos empilhados */

.plans-section {
  width: 100%;
}

.plans-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.plan-card {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--border-default);
  border-radius: var(--radius);
  padding: 1rem 3rem 1rem 1rem;
  cursor: pointer;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  text-align: left;
  outline: none;
}

.plan-card:hover {
  border-color: rgba(0, 212, 255, 0.4);
  box-shadow: var(--glow-hover);
}

.plan-card:focus-visible {
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-selected);
}

.plan-card.selected {
  border-color: var(--border-selected);
  box-shadow: var(--glow-selected);
}

.plan-badge {
  display: inline-block;
  width: fit-content;
  margin-bottom: 0.625rem;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  white-space: nowrap;
}

.plan-badge--best {
  background: linear-gradient(135deg, #7c3aed, #0066ff);
}

.plan-check {
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.plan-card.selected .plan-check {
  background: var(--gradient-accent);
  border-color: transparent;
  color: #fff;
}

.plan-card-inner {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

/* Linha: info + preço lado a lado */
.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.plan-info {
  min-width: 0;
  flex: 1;
}

.plan-name {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
}

.plan-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.plan-price {
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.plan-price .currency {
  font-size: 0.8125rem;
  font-weight: 600;
}

/* Bloco: descrição em linha completa abaixo */
.plan-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Telas um pouco maiores: mais respiro, preço maior */
@media (min-width: 400px) {
  .page {
    padding: 2rem 1.25rem 3rem;
    gap: 1.75rem;
  }

  .plan-card {
    padding: 1.125rem 3.25rem 1.125rem 1.25rem;
  }

  .plan-name {
    font-size: 1rem;
  }

  .plan-price {
    font-size: 1.5rem;
  }

  .plans-grid {
    gap: 0.875rem;
  }
}

/* Checkout actions (resumo + CTA) */

.checkout-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.checkout-actions[hidden] {
  display: none;
}

/* Summary */

.summary-section {
  width: 100%;
  background: var(--summary-bg);
  border: 1px solid var(--summary-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

@media (min-width: 400px) {
  .summary-section {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.125rem 1.25rem;
  }
}

.summary-label {
  font-size: 0.75rem;
  color: var(--summary-label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.summary-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--summary-text);
}

@media (min-width: 400px) {
  .summary-value {
    font-size: 1.0625rem;
    text-align: right;
  }
}

/* CTA */

.cta-button-wrap {
  position: relative;
  width: 100%;
  border-radius: 999px;
  padding: 2px;
  overflow: hidden;
  isolation: isolate;
}

.checkout-actions:not([hidden]) .cta-button-wrap::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220%;
  height: 220%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 250deg,
    rgba(134, 239, 172, 0.35) 275deg,
    rgba(255, 255, 255, 0.95) 295deg,
    rgba(74, 222, 128, 1) 310deg,
    rgba(134, 239, 172, 0.35) 330deg,
    transparent 360deg
  );
  transform: translate(-50%, -50%);
  animation: cta-border-shine 2.8s linear infinite;
}

.checkout-actions:not([hidden]) .cta-button-wrap:hover::before {
  animation-play-state: paused;
}

@keyframes cta-border-shine {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.cta-button {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  min-height: 56px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--gradient-cta);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition:
    opacity var(--transition),
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    color var(--transition);
  box-shadow: 0 4px 20px rgba(21, 128, 61, 0.45);
}

.cta-button:hover:not(:disabled):not(.is-loading) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(21, 128, 61, 0.55);
}

.cta-button:active:not(:disabled):not(.is-loading) {
  transform: translateY(0);
}

.cta-button:focus-visible:not(.is-loading) {
  outline: 2px solid #4ade80;
  outline-offset: 3px;
}

.checkout-actions:not([hidden]) .cta-button.is-loading,
.checkout-actions:not([hidden]) .cta-button.is-loading:disabled {
  cursor: wait;
  pointer-events: none;
  padding-left: 2.75rem;
  background: linear-gradient(135deg, #52525b, #3f3f46) !important;
  color: #f4f4f5 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
  opacity: 1 !important;
  filter: none !important;
  animation: none !important;
  transform: none !important;
}

.checkout-actions:not([hidden]) .cta-button.is-loading::after {
  content: '';
  position: absolute;
  left: 1.25rem;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border: 2px solid rgba(244, 244, 245, 0.35);
  border-top-color: #f4f4f5;
  border-radius: 50%;
  animation: cta-spin 0.8s linear infinite;
}

.checkout-actions:not([hidden]) .cta-button-wrap.is-loading::before {
  opacity: 0 !important;
  animation: none !important;
  visibility: hidden;
}

@keyframes cta-spin {
  to {
    transform: rotate(360deg);
  }
}

.checkout-actions:not([hidden]) .cta-button {
  animation: cta-pulse 2.2s ease-in-out infinite;
}

.checkout-actions:not([hidden]) .cta-button-wrap:hover .cta-button {
  animation: none;
}

@keyframes cta-pulse {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(21, 128, 61, 0.45);
    filter: brightness(1);
  }

  50% {
    box-shadow: 0 4px 36px rgba(34, 197, 94, 0.55);
    filter: brightness(1.06);
  }
}

/* Footer */

.footer {
  text-align: center;
}

.footer p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
