/* ============================================================
   AGREEMENT PAGE — assets/css/agreement.css
   For: agreement.html
   Handles: form, pricing panel, PDF preview, digital signature,
            add-ons, bulk toggle, toast, loading
   ============================================================ */

/* ---------- LAYOUT ---------- */
.agreement-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 32px;
  align-items: start;
}
@media (max-width: 1024px) { .agreement-grid { grid-template-columns: 1fr; } }

.how-it-works {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 40px;
  max-width: 900px;
  margin-inline: auto;
}
@media (max-width: 700px) { .how-it-works { grid-template-columns: 1fr; } }
.how-step {
  display: flex; gap: 14px; padding: 18px 20px;
  background: var(--navy-2); border: 1px solid var(--line);
  border-radius: var(--r-md); align-items: flex-start;
}
.how-step__num {
  flex-shrink: 0; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--grad); color: #04121A;
  font-weight: 800; font-size: 14px;
}
.how-step__text { font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.how-step__text strong { display: block; color: var(--white); font-size: 14px; font-weight: 700; margin-bottom: 4px; }

/* ---------- FORM WRAP ---------- */
.agreement-form-wrap {
  padding: 32px; background: var(--navy-2);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  position: sticky; top: 100px;
  max-height: calc(100vh - 120px); overflow-y: auto;
}
@media (max-width: 1024px) { .agreement-form-wrap { position: static; max-height: none; } }
.agreement-form-wrap h2 {
  font-size: 20px; font-weight: 700; letter-spacing: -.02em;
  margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.agreement-form-wrap h3 {
  font-size: 13px; font-family: var(--fm); letter-spacing: .14em;
  text-transform: uppercase; color: var(--cyan);
  margin: 28px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.agreement-form-wrap h3:first-of-type { margin-top: 0; }

/* ---------- FORM ---------- */
.agreement-form { display: flex; flex-direction: column; gap: 18px; }
.agreement-form label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--muted); margin-bottom: 6px; letter-spacing: .02em;
}
.agreement-form .req { color: var(--cyan); }
.agreement-form input[type="text"],
.agreement-form input[type="email"],
.agreement-form input[type="tel"],
.agreement-form input[type="number"],
.agreement-form input[type="date"],
.agreement-form select,
.agreement-form textarea {
  width: 100%; padding: 11px 14px;
  font-family: var(--ff); font-size: 14px;
  color: var(--white); background: var(--navy);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: var(--t); -webkit-appearance: none; appearance: none;
}
.agreement-form input:focus,
.agreement-form select:focus,
.agreement-form textarea:focus {
  outline: none; border-color: var(--cyan);
  background: var(--navy-3); box-shadow: 0 0 0 3px rgba(62,224,208,.12);
}
.agreement-form textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.agreement-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A0AEC0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  background-size: 16px; padding-right: 42px; cursor: pointer;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row--phone { grid-template-columns: 110px 1fr; }
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .form-row--phone { grid-template-columns: 90px 1fr; }
}

/* ---------- ADD-ONS ---------- */
.addons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.addon {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--navy);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer; transition: var(--t);
  font-size: 13.5px; color: var(--muted);
}
.addon:hover { border-color: rgba(62,224,208,.35); }
.addon input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: #3EE0D0; cursor: pointer; flex-shrink: 0;
}
.addon.is-checked {
  background: linear-gradient(160deg, rgba(62,224,208,.08), rgba(139,92,246,.04));
  border-color: rgba(62,224,208,.4);
  color: var(--white);
}
.addon__price {
  margin-left: auto;
  font-family: var(--fm); font-size: 12px;
  color: var(--cyan); font-weight: 600;
}

/* ---------- CONTENT PAGES INPUT ---------- */
.inline-input {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
}
.inline-input input { max-width: 100px; text-align: center; }

/* ---------- DIGITAL SIGNATURE ---------- */
.signature-wrap {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; margin-top: 24px; padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}
@media (max-width: 800px) { .signature-wrap { grid-template-columns: 1fr; } }

.sig-block { display: flex; flex-direction: column; gap: 8px; }
.sig-block > label {
  font-size: 12px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--cyan); font-family: var(--fm);
}

/* Client typed name input */
.sig-name-input {
  width: 100%; padding: 11px 14px;
  font-family: var(--ff); font-size: 14px;
  color: var(--white); background: var(--navy);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: var(--t);
}
.sig-name-input:focus {
  outline: none; border-color: var(--cyan);
  background: var(--navy-3); box-shadow: 0 0 0 3px rgba(62,224,208,.12);
}

/* Preview box — shows typed name in script font */
.sig-preview {
  margin-top: 10px;
  padding: 20px 16px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sig-preview__name {
  font-family: 'Dancing Script', 'Great Vibes', cursive;
  font-size: 36px;
  font-weight: 500;
  color: #0A0E17;
  line-height: 1.1;
  text-align: center;
  word-break: break-word;
  letter-spacing: .5px;
}
.sig-preview__placeholder {
  font-family: var(--ff);
  font-size: 12px;
  color: #94A3B8;
  font-style: italic;
  text-align: center;
}

/* Consent checkbox */
.sig-consent {
  display: flex !important;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(62,224,208,.04);
  border: 1px solid rgba(62,224,208,.2);
  border-radius: var(--r-sm);
  cursor: pointer;
  margin-top: 6px;
  font-size: 12.5px !important;
  font-weight: 400 !important;
  color: var(--muted) !important;
  line-height: 1.55;
  letter-spacing: 0 !important;
  text-transform: none !important;
}
.sig-consent input[type="checkbox"] {
  width: 16px; height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: #3EE0D0;
  cursor: pointer;
}
.sig-consent.is-checked {
  background: linear-gradient(160deg, rgba(62,224,208,.08), rgba(139,92,246,.04));
  border-color: rgba(62,224,208,.45);
  color: var(--white) !important;
}

/* Rdelab static signature box */
.sig-static {
  background: #FFFFFF; border: 1px solid var(--line);
  border-radius: var(--r-sm); min-height: 130px;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.sig-static__typed {
  font-family: 'Dancing Script', 'Great Vibes', cursive;
  font-size: 28px;
  font-weight: 500;
  color: #0A0E17;
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
  padding: 4px 8px;
}
.sig-static .sig-placeholder {
  color: #94A3B8; font-size: 12px; font-style: italic;
  text-align: center; line-height: 1.5;
}

/* Note below Rdelab signature box */
.sig-static__note {
  font-size: 11px;
  color: var(--muted-2);
  font-style: italic;
  text-align: center;
  line-height: 1.5;
  margin-top: 8px;
  letter-spacing: .02em;
}

.agreement-actions {
  display: flex; gap: 14px; margin-top: 32px; flex-wrap: wrap;
}

/* ---------- PRICING PANEL ---------- */
.pricing-panel {
  display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 100px;
}
@media (max-width: 1024px) { .pricing-panel { position: static; } }

.pricing-card {
  padding: 26px 24px;
  background: var(--navy-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.pricing-card__title {
  font-family: var(--fm); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--cyan); font-weight: 600;
  margin-bottom: 18px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.pricing-line {
  display: flex; justify-content: space-between;
  align-items: center; gap: 12px;
  padding: 9px 0;
  font-size: 14px; color: var(--muted);
  border-bottom: 1px dashed var(--line-soft);
}
.pricing-line:last-child { border-bottom: 0; }
.pricing-line__label { flex: 1; }
.pricing-line__value {
  font-family: var(--fm); font-size: 13.5px;
  color: var(--white); font-weight: 600;
  white-space: nowrap;
}
.pricing-line__value--add { color: var(--cyan); }
.pricing-line__value--discount { color: #34D399; }
.pricing-line__value--rush { color: #FBBF24; }

.pricing-total {
  display: flex; justify-content: space-between;
  align-items: baseline; gap: 12px;
  margin-top: 16px; padding-top: 18px;
  border-top: 2px solid var(--line);
}
.pricing-total__label {
  font-size: 13px; color: var(--muted-2);
  font-family: var(--fm); letter-spacing: .08em;
  text-transform: uppercase;
}
.pricing-total__value {
  font-size: 26px; font-weight: 800;
  letter-spacing: -.03em;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.deposit-breakdown {
  margin-top: 20px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.deposit-line {
  display: flex; justify-content: space-between;
  align-items: center; padding: 7px 0;
  font-size: 13.5px; color: var(--muted);
}
.deposit-line strong {
  color: var(--white); font-family: var(--fm); font-size: 13px;
}
.deposit-line--featured {
  padding: 12px 14px; margin-top: 10px;
  background: linear-gradient(135deg, rgba(62,224,208,.1), rgba(139,92,246,.06));
  border: 1px solid rgba(62,224,208,.3);
  border-radius: var(--r-sm);
}
.deposit-line--featured strong {
  color: var(--cyan); font-size: 16px; font-weight: 700;
}
.pricing-note {
  margin-top: 16px; padding: 12px 14px;
  background: rgba(251,191,36,.06);
  border: 1px solid rgba(251,191,36,.2);
  border-radius: var(--r-sm);
  font-size: 12px; color: #FBBF24; line-height: 1.55;
}
.pricing-empty {
  padding: 40px 20px; text-align: center;
  color: var(--muted-2); font-size: 13.5px; line-height: 1.6;
}

/* ---------- BULK TOGGLE ---------- */
.bulk-toggle {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--navy);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer; transition: var(--t);
}
.bulk-toggle:hover { border-color: rgba(62,224,208,.35); }
.bulk-toggle.is-active {
  background: linear-gradient(160deg, rgba(139,92,246,.1), rgba(43,140,240,.05));
  border-color: rgba(139,92,246,.4);
}
.bulk-toggle input { display: none; }
.bulk-toggle__check {
  width: 20px; height: 20px; border-radius: 6px;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: transparent; font-size: 12px; transition: var(--t);
}
.bulk-toggle.is-active .bulk-toggle__check {
  background: var(--grad); border-color: transparent;
  color: #04121A; font-weight: 800;
}
.bulk-toggle__text { font-size: 13.5px; color: var(--white); font-weight: 600; }
.bulk-toggle__hint {
  display: block; font-size: 12px;
  color: var(--muted-2); font-weight: 400; margin-top: 2px;
}

/* ---------- PDF PREVIEW (hidden off-screen) ---------- */
#agreementPreview {
  position: absolute;
  left: -99999px;
  top: 0;
  width: 800px;
}

.pdf-doc {
  background: #FFFFFF; color: #1A1A1A;
  padding: 40px 40px;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px; line-height: 1.6;
  width: 750px;
}
.pdf-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-bottom: 20px; border-bottom: 2px solid #0A0E17;
  margin-bottom: 24px; gap: 20px;
}
.pdf-brand { display: flex; align-items: center; gap: 12px; }
.pdf-brand-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #3EE0D0 0%, #2B8CF0 50%, #8B5CF6 100%);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 22px; letter-spacing: -1px;
}
.pdf-brand-name { font-size: 20px; font-weight: 800; color: #0A0E17; letter-spacing: -.5px; }
.pdf-brand-tag { font-size: 10px; color: #64748B; letter-spacing: .06em; text-transform: uppercase; }
.pdf-meta { text-align: right; font-size: 10.5px; color: #64748B; line-height: 1.7; }
.pdf-meta strong { color: #0A0E17; font-weight: 700; }
.pdf-title { font-size: 24px; font-weight: 800; color: #0A0E17; letter-spacing: -1px; margin-bottom: 4px; }
.pdf-subtitle { font-size: 11.5px; color: #64748B; margin-bottom: 24px; }
.pdf-section { margin-bottom: 18px; }
.pdf-section h3 {
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #2B8CF0;
  margin-bottom: 8px; padding-bottom: 5px;
  border-bottom: 1px solid #E2E8F0;
}
.pdf-section p { font-size: 12px; color: #334155; margin-bottom: 6px; line-height: 1.6; }
.pdf-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.pdf-party { padding: 12px 14px; background: #F8FAFC; border-left: 3px solid #2B8CF0; border-radius: 6px; }
.pdf-party-label { font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #2B8CF0; margin-bottom: 5px; }
.pdf-party-name { font-size: 13px; font-weight: 700; color: #0A0E17; margin-bottom: 2px; }
.pdf-party-detail { font-size: 11px; color: #64748B; line-height: 1.5; }
.pdf-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 11.5px; }
.pdf-table th, .pdf-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #E2E8F0; }
.pdf-table th {
  background: #F8FAFC; font-weight: 700; color: #0A0E17;
  font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
}
.pdf-table td:nth-child(2) {
  text-align: right; font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: #334155;
}
.pdf-table td:last-child { text-align: right; font-weight: 600; color: #0A0E17; }
.pdf-table tr:last-child td { border-bottom: 2px solid #0A0E17; font-weight: 700; }
.pdf-total-box {
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(62,224,208,.08), rgba(139,92,246,.05));
  border: 1px solid #3EE0D0; border-radius: 8px;
  margin: 12px 0;
  display: flex; justify-content: space-between; align-items: center;
}
.pdf-total-box__label {
  font-size: 11px; color: #334155; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.pdf-total-box__value { font-size: 22px; font-weight: 800; color: #0A0E17; letter-spacing: -.5px; }
.pdf-signatures {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
  margin-top: 32px; padding-top: 20px;
  border-top: 1px solid #E2E8F0; page-break-inside: avoid;
}
.pdf-sig-block { display: flex; flex-direction: column; }
.pdf-sig-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #64748B; margin-bottom: 8px;
}
.pdf-sig-image-wrap {
  min-height: 65px; display: flex; align-items: flex-end;
  padding-bottom: 5px; margin-bottom: 5px;
  border-bottom: 1px solid #0A0E17;
}
.pdf-sig-typed {
  font-family: 'Dancing Script', 'Great Vibes', cursive;
  font-size: 26px;
  font-weight: 500;
  color: #0A0E17;
  line-height: 1.1;
  padding-bottom: 4px;
  word-break: break-word;
  letter-spacing: .5px;
}
.pdf-sig-name { font-size: 11.5px; font-weight: 700; color: #0A0E17; margin-top: 3px; }
.pdf-sig-role { font-size: 10px; color: #64748B; margin-top: 2px; }
.pdf-sig-date { font-size: 9.5px; color: #94A3B8; margin-top: 5px; }
.pdf-sig-electronic-note {
  font-size: 9px; color: #64748B; font-style: italic;
  margin-top: 4px; letter-spacing: .02em; line-height: 1.4;
}
.pdf-footer {
  margin-top: 28px; padding-top: 14px;
  border-top: 1px solid #E2E8F0;
  font-size: 9.5px; color: #94A3B8;
  text-align: center; line-height: 1.55;
}

/* ---------- LOADING + TOAST ---------- */
.agreement-loading {
  position: fixed; inset: 0;
  background: rgba(10,14,23,.85);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  z-index: 9999; color: var(--white);
  font-family: var(--fm); font-size: 14px; letter-spacing: .06em;
}
.agreement-loading.is-active { display: flex; }

.agreement-toast {
  position: fixed; top: 24px; right: 24px;
  padding: 14px 20px;
  background: var(--navy-2);
  border: 1px solid var(--cyan);
  border-radius: var(--r-md);
  color: var(--white); font-size: 14px;
  z-index: 10000;
  transform: translateX(120%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  max-width: 380px;
}
.agreement-toast.is-visible { transform: translateX(0); }
.agreement-toast--error { border-color: #F87171; }