/* ==============================================================================
   Casa Brasil Cidadania - Ficha de Adesão Oficial
   Estilos específicos para Ficha em Alpine.js (Complementa style.css)
   ============================================================================== */

@import url('./style.css');

/* Container da Ficha */
.ficha-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 6rem;
}

/* Hero / Header da Ficha */
.ficha-hero {
  background: linear-gradient(135deg, var(--brand-navy-950) 0%, var(--brand-navy-900) 50%, var(--brand-navy-800) 100%);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2.25rem;
  color: #ffffff;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.ficha-hero::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.ficha-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.ficha-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ficha-hero h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.ficha-hero p {
  color: #cbd5e1;
  font-size: 0.9375rem;
  max-width: 820px;
  line-height: 1.6;
}

/* Barra de Destaque / Draft Autosave */
.draft-alert-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
  color: #166534;
}

/* Seções da Ficha */
.ficha-section {
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ficha-section:focus-within {
  border-color: #cbd5e1;
}

.ficha-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.5rem;
}

.ficha-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.ficha-section-number {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--brand-navy-900);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(11, 27, 61, 0.25);
  flex-shrink: 0;
}

.ficha-section-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--brand-navy-950);
  letter-spacing: -0.01em;
}

.ficha-section-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}

/* Voice Guide Button */
.btn-voice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: var(--brand-navy-800);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-voice:hover {
  background: #e2e8f0;
  color: var(--brand-navy-950);
}

.btn-voice.is-speaking {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

/* Indicador de Validação do Campo */
.field-validation-msg {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.field-validation-msg.error {
  color: #dc2626;
}

.field-validation-msg.valid {
  color: #16a34a;
}

.field-validation-msg.info {
  color: #0284c7;
}

/* Grid de Planos / Pacotes */
.planos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.35rem;
  margin-bottom: 1.75rem;
}

.plano-card {
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.65rem 1.35rem;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.plano-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #94a3b8;
}

.plano-card.is-selected {
  border-width: 2px;
  box-shadow: 0 8px 24px -4px rgba(11, 27, 61, 0.15);
}

/* Cores de Tema por Plano */
.plano-card.plano-branco.is-selected {
  border-color: #003366;
  background: #f8fafc;
}

.plano-card.plano-azul.is-selected {
  border-color: #0284c7;
  background: #f0f9ff;
}

.plano-card.plano-amarelo.is-selected {
  border-color: #d97706;
  background: #fffbeb;
}

.plano-card.plano-verde.is-selected {
  border-color: #059669;
  background: #f0fdf4;
}

.plano-card.is-blocked {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.5);
  background: #f8fafc;
}

.plano-badge {
  position: absolute;
  top: -12px;
  right: 14px;
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
}

.badge-amarelo {
  background: #f59e0b;
  color: #ffffff;
}

.badge-azul {
  background: #0284c7;
  color: #ffffff;
}

.badge-verde {
  background: #059669;
  color: #ffffff;
}

.plano-header {
  margin-bottom: 1rem;
}

.plano-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-navy-950);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.plano-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.4;
  min-height: 2.8rem;
}

.plano-pricing {
  margin: 1rem 0;
  padding: 0.75rem 0;
  border-top: 1px dashed var(--border-light);
  border-bottom: 1px dashed var(--border-light);
  min-height: 4.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.plano-price-val {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--brand-navy-950);
  font-family: 'JetBrains Mono', monospace;
}

.plano-price-dep {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.plano-beneficios {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  font-size: 0.78125rem;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.plano-beneficios li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.35;
}

.plano-beneficios li svg {
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.plano-beneficio-destaque {
  font-weight: 700;
  color: var(--brand-navy-950);
  background: #f1f5f9;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

/* Caixa de Descrição com Borda Lateral Colorida */
.plano-desc-box {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  line-height: 1.5;
  margin: 0.75rem 0;
  border: 1px solid var(--border-light);
  border-left-width: 4px;
}

.plano-desc-box.plano-branco {
  background: #eff6ff;
  border-color: #bfdbfe;
  border-left-color: #003366;
  color: #1e3a8a;
}

.plano-desc-box.plano-azul {
  background: #f0f9ff;
  border-color: #bae6fd;
  border-left-color: #0284c7;
  color: #0369a1;
}

.plano-desc-box.plano-amarelo {
  background: #fffbeb;
  border-color: #fde68a;
  border-left-color: #d97706;
  color: #92400e;
}

.plano-desc-box.plano-verde {
  background: #ecfdf5;
  border-color: #a7f3d0;
  border-left-color: #059669;
  color: #065f46;
}

/* Caixa de Observação */
.plano-obs-box {
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.6875rem;
  line-height: 1.4;
  margin-top: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

.plano-obs-box svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* Indicador de Rádio no Topo do Card */
.card-radio-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #ffffff;
  transition: all var(--transition-fast);
}

.card-radio-circle.is-checked {
  border-color: var(--brand-navy-900);
  background: var(--brand-navy-900);
  color: #ffffff;
}

.card-radio-circle.is-blocked {
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #94a3b8;
}

/* Pills de Seleção (Formas de Pagamento e Vencimento) */
.pills-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.pill-option {
  padding: 0.625rem 1.125rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
}

.pill-option:hover {
  border-color: var(--brand-navy-600);
  background: var(--bg-main);
}

.pill-option.is-active {
  border-color: var(--brand-navy-900);
  background: var(--brand-navy-900);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(11, 27, 61, 0.2);
}

/* Seção de Dependentes */
.dependente-box {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.25rem;
  position: relative;
  transition: all var(--transition-fast);
}

.dependente-box:hover {
  border-color: #cbd5e1;
}

.dependente-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid #e2e8f0;
}

.dependente-box-title {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--brand-navy-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Box do Termo de Ciência e Adesão (sem barra de rolagem, altura fluida) */
.termos-box {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.65rem 1.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.5rem;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Banner de Resumo da Contribuição e Finalização */
.summary-banner {
  background: #ffffff;
  border: 2px solid var(--brand-navy-900);
  border-radius: var(--radius-xl);
  padding: 2.35rem 2.25rem;
  margin-top: 2rem;
  box-shadow: var(--shadow-lg);
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.summary-calc-card {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
}

.summary-calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.875rem;
}

.summary-calc-total {
  border-top: 2px solid #cbd5e1;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--brand-navy-950);
}

.summary-calc-total .total-amount {
  font-size: 1.5rem;
  color: var(--brand-emerald-700);
  font-family: 'JetBrains Mono', monospace;
}

/* Grade de Botões de Assinatura */
.signature-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.sig-btn-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-light);
  background: #ffffff;
  cursor: pointer;
  transition: all var(--transition-normal);
  min-height: 150px;
  position: relative;
}

.sig-btn-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.sig-btn-card.sig-autentique {
  border-color: var(--brand-emerald-500);
  background: #f0fdf4;
  color: #065f46;
}

.sig-btn-card.sig-autentique:hover {
  background: #dcfce7;
  border-color: var(--brand-emerald-600);
}

.sig-btn-card.sig-autentique.has-pending {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}

.sig-btn-card.sig-govbr {
  border-color: var(--brand-blue-500);
  background: #eff6ff;
  color: #1e40af;
}

.sig-btn-card.sig-govbr:hover {
  background: #dbeafe;
}

.sig-btn-card.sig-manual {
  border-color: #94a3b8;
  background: #f8fafc;
  color: var(--text-main);
}

.sig-btn-card.sig-manual:hover {
  background: #f1f5f9;
}

.sig-btn-title {
  font-size: 1.125rem;
  font-weight: 800;
  margin-top: 0.5rem;
}

.sig-btn-desc {
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.25rem;
  opacity: 0.85;
}

/* Modal de Pré-Visualização */
.pdf-preview-modal-dialog {
  max-width: 1120px;
  width: 96%;
  height: 90vh;
  display: flex;
  flex-direction: column;
}

.pdf-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
  border-radius: var(--radius-md);
}

/* Renderizador Universal Canvas (PDF.js) - Compatibilidade Total com Falkon e Linux */
.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  background: #2d3748;
  color: #f8fafc;
  font-size: 0.8125rem;
  border-bottom: 1px solid #4a5568;
  flex-shrink: 0;
  z-index: 10;
}

.pdf-canvas-container {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  gap: 1.5rem;
  background: #525659;
}

.pdf-page-canvas {
  max-width: 100%;
  height: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  background: #ffffff;
}

/* Pulse animation for focused pending inputs */
.field-highlight-pulse {
  animation: pulse-red 1.2s 2;
}

/* Seção 4: Valor Total da Contribuição Consolidado */
.contrib-calc-box {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
}

.contrib-active-plan {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: 1.25rem;
}

.contrib-pulse-badge {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-main);
}

.contrib-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.contrib-row-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.contrib-deps-list {
  list-style: none;
  padding: 0 0 0 0.75rem;
  margin: 0.75rem 0;
  border-left: 3px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contrib-dep-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-main);
}

.contrib-final-banner {
  background: linear-gradient(135deg, #003366 0%, #001f3f 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 51, 102, 0.25);
}

.contrib-final-banner .final-title {
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #facc15;
  display: block;
  margin-bottom: 0.2rem;
}

.contrib-final-banner .final-subtitle {
  font-size: 0.8125rem;
  color: #e2e8f0;
}

.contrib-final-banner .final-amount {
  font-size: 2rem;
  font-weight: 900;
  color: #ffffff;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.02em;
}

/* Responsividade */
@media (max-width: 768px) {
  .ficha-container {
    padding: 1rem 0.75rem 5rem;
  }
  .ficha-hero {
    padding: 1.5rem 1.25rem;
  }
  .ficha-hero h1 {
    font-size: 1.35rem;
  }
  .ficha-section {
    padding: 1.25rem 1rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-12 {
    grid-column: span 1 / span 1 !important;
  }
  .planos-grid {
    grid-template-columns: 1fr;
  }
  .summary-banner {
    padding: 1.25rem 1rem;
  }
}
