/* firma.css — Página pública de firma electrónica (firma.arbitrar.pe) */

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

:root {
  --gold:      #FEC002;
  --gold-dim:  rgba(254,192,2,0.12);
  --bg:        #07101f;
  --bg2:       #0b1628;
  --surface:   #111e38;
  --border:    rgba(254,192,2,0.15);
  --border2:   rgba(255,255,255,0.07);
  --text:      #e8edf6;
  --text-sec:  #a8b4cc;
  --muted:     #6b7a96;
  --danger:    #e05252;
  --success:   #34c98a;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; display: flex; flex-direction: column; align-items: center; }

/* ── Header ─────────────────────────────────────────────────────── */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
}

.brand-logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.5px;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
  display: none;
}

@media (min-width: 540px) { .brand-sub { display: block; } }

.header-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--gold-dim);
  border: 1px solid var(--border);
  color: var(--gold);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border2);
  padding: 16px 24px;
  flex-shrink: 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--muted);
}

.footer-inner strong { color: var(--gold); }
.footer-inner a { color: var(--muted); transition: color .15s; }
.footer-inner a:hover { color: var(--gold); }
.footer-sep { opacity: 0.35; }

/* ── Spinner ─────────────────────────────────────────────────────── */
.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}

.spinner--sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════
   PANTALLA 0 — BIENVENIDA (sin token)
══════════════════════════════════════════════════════ */
#screen-welcome { width: 100%; }

.welcome-hero {
  background: linear-gradient(160deg, #0b1628 0%, #07101f 100%);
  border-bottom: 1px solid var(--border);
  padding: 64px 24px 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.welcome-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 0%, rgba(254,192,2,0.07) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  background: var(--gold-dim);
  border: 1px solid var(--border);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 24px;
}

.welcome-title {
  font-size: clamp(1.7rem, 5vw, 2.8rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.18;
  margin-bottom: 20px;
  letter-spacing: -0.025em;
}

.welcome-lead {
  font-size: 1rem;
  color: var(--text-sec);
  max-width: 520px;
  margin: 0 auto 28px;
  line-height: 1.7;
}

.welcome-tip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(254,192,2,0.07);
  border: 1px solid rgba(254,192,2,0.18);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.82rem;
  color: var(--text-sec);
  max-width: 420px;
}

.welcome-tip svg { color: var(--gold); flex-shrink: 0; }
.welcome-tip strong { color: var(--gold); }

/* Steps */
.welcome-steps {
  padding: 56px 24px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 36px;
  letter-spacing: -0.02em;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 26px 20px;
  transition: border-color .2s;
}

.step-card:hover { border-color: var(--border); }

.step-num {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 12px;
}

.step-icon {
  width: 42px; height: 42px;
  background: var(--gold-dim);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--gold);
}

.step-card h3 { font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.step-card p  { font-size: 0.78rem; color: var(--text-sec); line-height: 1.65; }
.step-card p em { color: var(--gold); font-style: normal; font-weight: 600; }

/* Why */
.welcome-why {
  background: var(--bg2);
  border-top: 1px solid var(--border2);
  border-bottom: 1px solid var(--border2);
  padding: 56px 24px;
  width: 100%;
}

.why-inner {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: center;
}

@media (min-width: 768px) {
  .why-inner { grid-template-columns: 1fr 1fr; }
}

.why-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 12px;
}

.why-text h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.why-text p { font-size: 0.83rem; color: var(--text-sec); line-height: 1.7; margin-bottom: 20px; }

.why-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }
.why-list li { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-sec); }
.why-list li svg { color: var(--gold); flex-shrink: 0; }

.why-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid rgba(254,192,2,0.3);
  padding-bottom: 2px;
  transition: border-color .15s;
}

.why-cta:hover { border-color: var(--gold); }

.why-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.stat-num {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-label { font-size: 0.7rem; color: var(--muted); line-height: 1.4; }

/* Contact */
.welcome-contact {
  padding: 56px 24px;
  text-align: center;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.welcome-contact h2 { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.welcome-contact p  { font-size: 0.83rem; color: var(--text-sec); margin-bottom: 26px; }

.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity .15s, transform .15s;
}

.contact-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.contact-btn--wa    { background: rgba(37,211,102,0.1); border: 1px solid rgba(37,211,102,0.25); color: #4ade80; }
.contact-btn--email { background: var(--gold-dim); border: 1px solid var(--border); color: var(--gold); }

/* ══════════════════════════════════════════════════
   PANTALLA 1 — LOADING
══════════════════════════════════════════════════ */
#screen-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  flex: 1;
}

.loading-text { color: var(--muted); font-size: 0.85rem; }

/* ══════════════════════════════════════════════════
   PANTALLA 2 — ERROR
══════════════════════════════════════════════════ */
#screen-error {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  padding: 64px 24px;
  margin: 0 auto;
}

.error-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(224,82,82,0.1);
  border: 1px solid rgba(224,82,82,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
}

.error-title  { font-size: 1.1rem; font-weight: 700; color: var(--danger); }
.error-msg    { color: var(--text-sec); font-size: 0.85rem; line-height: 1.7; }

.error-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 8px;
  background: rgba(37,211,102,0.1);
  border: 1px solid rgba(37,211,102,0.25);
  color: #4ade80;
  text-decoration: none;
  transition: opacity .15s;
}

.error-cta:hover { opacity: 0.82; }

/* ══════════════════════════════════════════════════
   PANTALLA 3 — INFO + PDF
══════════════════════════════════════════════════ */
#screen-info {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 860px;
  padding: 32px 16px 48px;
  margin: 0 auto;
}

.firmante-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--gold-dim);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 20px;
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 22px 26px;
  width: 100%;
  margin-bottom: 24px;
}

.doc-card-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }

.doc-icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  background: var(--gold-dim);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--gold);
}

.doc-title { font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.doc-meta  { font-size: 0.72rem; color: var(--muted); margin-top: 3px; }

.doc-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border2);
}

.doc-field label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 3px;
}

.doc-field span { font-size: 0.85rem; color: var(--text); font-weight: 600; }

.pdf-section { width: 100%; margin-bottom: 24px; }

.pdf-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.pdf-loading-msg {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 20px 0;
}

#pdf-frame {
  display: none;
  width: 100%;
  height: 520px;
  border: 1px solid var(--border2);
  border-radius: 10px;
  background: #fff;
}

#pdf-frame.loaded { display: block; }

@media (max-width: 600px) { #pdf-frame { height: 360px; } }

.btn-firmar {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--gold);
  color: #07101f;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 14px 36px;
  cursor: pointer;
  transition: opacity .15s, transform .15s, box-shadow .15s;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.btn-firmar:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(254,192,2,0.22);
}

.btn-firmar:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.aviso-legal {
  font-size: 0.69rem;
  color: var(--muted);
  text-align: center;
  max-width: 500px;
  line-height: 1.6;
}

.aviso-legal strong { color: var(--text-sec); }

/* ══════════════════════════════════════════════════
   PANTALLA 4 — FIRMA (DocuSeal)
══════════════════════════════════════════════════ */
#screen-firma {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 860px;
  gap: 16px;
  padding: 24px 16px 48px;
  margin: 0 auto;
}

.firma-header { width: 100%; display: flex; align-items: center; gap: 12px; }
.firma-header-title { font-size: 0.88rem; font-weight: 600; color: var(--text); }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  border-radius: 7px;
  padding: 6px 13px;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.btn-back:hover { border-color: var(--border); color: var(--gold); }

docuseal-form {
  display: block;
  width: 100%;
  min-height: 680px;
  border: 1px solid var(--border2);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════
   PANTALLA 5 — DONE
══════════════════════════════════════════════════ */
#screen-done {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 72px 24px;
  max-width: 440px;
  margin: 0 auto;
}

.done-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(52,201,138,0.1);
  border: 2px solid var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
}

.done-title { font-size: 1.4rem; font-weight: 700; color: var(--success); letter-spacing: -0.02em; }
.done-msg   { color: var(--text-sec); font-size: 0.85rem; line-height: 1.7; }

.done-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid rgba(254,192,2,0.3);
  padding-bottom: 2px;
  transition: border-color .15s;
}

.done-cta:hover { border-color: var(--gold); }

.hidden { display: none !important; }
