/* ─── Credenciamento Page Styles ─────────────────────────────────────────── */

.page-bg {
  position: fixed; inset: 0; z-index: -1;
  background: 
    linear-gradient(rgba(6, 11, 24, 0.85), rgba(6, 11, 24, 0.95)),
    url('https://assets.dg5.com.br/sicredi-conecta/images/sicredi-conecta-feira-de-negocios-0017.jpg');
  background-size: cover;
  background-position: center;
  filter: blur(10px);
  transform: scale(1.15);
}

.cred-main {
  min-height: 100vh;
  padding: 7rem 1.5rem 4rem;
  display: flex; align-items: flex-start; justify-content: center;
}

.cred-container {
  width: 100%; max-width: 660px;
  display: flex; flex-direction: column; gap: 0;
}

/* Header */
.cred-header { margin-bottom: 0; }

/* Progress */
.progress-bar {
  display: flex; align-items: center; justify-content: center; gap: 0;
  padding: 0 1rem;
}
.progress-step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--text-muted); font-weight: 500;
  transition: var(--transition);
}
.progress-step.active { color: var(--primary-light); }
.progress-step.done   { color: var(--success); }
.step-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700;
  transition: var(--transition);
}
.progress-step.active .step-circle {
  background: var(--primary); border-color: var(--primary);
  color: #fff; box-shadow: 0 0 16px rgba(59,130,246,0.4);
}
.progress-step.done .step-circle {
  background: var(--success); border-color: var(--success); color: #fff;
}
.progress-line {
  flex: 1; height: 2px; background: var(--border);
  max-width: 80px; min-width: 30px;
  margin-bottom: 20px;
}

/* Form Card */
.cred-card { padding: 2rem; }

/* Step visibility */
.form-step { display: none; }
.form-step.active { display: block; animation: fadeStep 0.35s ease; }
@keyframes fadeStep { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }

.step-title {
  font-family: 'Outfit', sans-serif; font-size: 1.3rem; font-weight: 700;
  margin-bottom: 1.5rem; color: var(--text-primary);
  display: flex; align-items: center; gap: 0.5rem;
}

/* CPF input with status icon */
.input-with-status { position: relative; }
.input-with-status .form-control { padding-right: 3rem; }
.lookup-status {
  position: absolute; right: 0.9rem; top: 50%; transform: translateY(-50%);
  font-size: 1.1rem; transition: var(--transition);
}

/* Lookup banner */
#lookup-banner {
  padding: 0.85rem 1rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; line-height: 1.5;
  margin-top: 0.5rem;
}
#lookup-banner.found {
  background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.25);
  color: #34d399;
}
#lookup-banner.notfound {
  background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.2);
  color: var(--primary-light);
}

/* Step actions */
.step-actions {
  display: flex; gap: 0.75rem; align-items: center;
}

/* Review box */
.review-box {
  padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem;
  background: rgba(255,255,255,0.03) !important;
}
.review-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  font-size: 0.9rem; gap: 1rem;
}
.review-row:not(:last-child) { padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.review-label { color: var(--text-muted); flex-shrink: 0; font-weight: 500; }
.review-value { color: var(--text-primary); text-align: right; font-weight: 600; }

/* Modal icon */
.modal-icon { font-size: 2rem; margin-bottom: 0.5rem; }

/* Success */
.success-animation { margin: 1rem auto; }
.success-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(16,185,129,0.15); border: 2px solid rgba(16,185,129,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; margin: 0 auto;
  animation: successPop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes successPop { from{transform:scale(0)} to{transform:scale(1)} }

.success-ticket {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1.25rem; text-align: left;
}
.success-ticket .ticket-row {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: 0.875rem; padding: 0.4rem 0;
}
.success-ticket .ticket-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.ticket-label { color: var(--text-muted); }
.ticket-value { color: var(--text-primary); font-weight: 600; }

#qrcode-container {
  display: inline-block;
  background: #fff;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  margin-top: 1.5rem;
}

#qrcode canvas {
  display: block;
  margin: 0 auto;
}

#qrcode img {
  display: none;
  margin: 0 auto;
}

#qrcode table {
  margin: 0 auto;
}


/* Responsive */
@media (max-width: 768px) {
  .cred-main { padding: 5rem 1rem 3rem; }
  .cred-container { gap: 0; }
  .cred-card { padding: 1.5rem; }
  .progress-line { max-width: 40px; }
  .progress-step span { font-size: 0.7rem; }
}

@media (max-width: 600px) {
  .progress-step span { display: none; }
  .progress-line { max-width: 60px; min-width: 20px; }
  .step-circle { width: 40px; height: 40px; font-size: 1rem; }
  
  .step-actions { flex-direction: column-reverse; gap: 0.75rem; }
  .step-actions .btn { width: 100%; }
  
  .review-row { flex-direction: column; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; }
  .review-value { text-align: left; }
  
  .success-ticket .ticket-row { flex-direction: column; gap: 2px; }
  .success-ticket .ticket-value { text-align: left; }

  #qrcode-container { width: 100%; padding: 1rem; }
  #qrcode canvas, #qrcode img { max-width: 100%; height: auto !important; }
}

@media (max-width: 400px) {
  .cred-card { padding: 1rem; }
  .section-title { font-size: 1.5rem; }
  .step-title { font-size: 1.15rem; }
}

/* Print styles - Optimized for Receipt (Cupom) and A4 */
@media print {
  @page {
    margin: 5mm;
  }

  body {
    background: white !important;
    margin: 0;
    padding: 0;
    -webkit-print-color-adjust: exact;
  }

  .navbar, .cred-header, .progress-bar, #form-card, .step-actions, .btn, .footer, .page-bg {
    display: none !important;
  }

  #success-card {
    display: block !important;
    position: static;
    width: 100%;
    max-width: 80mm; /* Standard Receipt Width */
    margin: 0 auto;
    padding: 5mm;
    border: 1px solid #eee !important;
    background: white !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    color: black !important;
    text-align: center;
  }

  #success-title {
    display: block !important;
    font-size: 14pt !important;
    margin-bottom: 5mm !important;
    color: black !important;
    border-bottom: 2px solid black;
    padding-bottom: 2mm;
  }

  #success-desc, .success-animation {
    display: none !important;
  }

  .success-ticket {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    width: 100%;
    text-align: left;
  }

  .success-ticket .ticket-row {
    border-bottom: 1px dashed #ccc !important;
    padding: 2mm 0 !important;
    font-size: 10pt !important;
    color: black !important;
    display: flex;
    justify-content: space-between;
  }

  .ticket-label {
    color: #333 !important;
    font-weight: bold;
  }

  .ticket-value {
    color: black !important;
    font-weight: 800 !important;
    text-align: right;
  }

  #qrcode-container {
    display: block !important;
    width: 40mm;
    margin: 5mm auto 0 !important;
    padding: 2mm !important;
    background: white !important;
    border: none !important;
    box-shadow: none !important;
  }

  #qrcode canvas,
  #qrcode img {
    width: 36mm !important;
    height: 36mm !important;
    margin: 0 auto;
  }



  /* Footer for the receipt */
  #success-card::after {
    content: "Sicredi Conecta 2026\nComprovante de Credenciamento";
    display: block;
    margin-top: 5mm;
    font-size: 8pt;
    color: #666;
    border-top: 1px solid #ccc;
    padding-top: 2mm;
    white-space: pre-line;
  }
}

