/* === Form Application Styles === */

.form-app { max-width: 880px; margin: 0 auto; padding: 2rem 1rem 4rem; }

.form-app__header { text-align: center; margin-bottom: 2rem; }
.form-app__title { font-size: 2rem; color: #0a1f44; font-weight: 700; margin-bottom: 0.5rem; }
.form-app__subtitle { color: #6b7280; font-size: 1rem; }

/* === Preselect banner (when arriving from product page) === */
.form-app__preselect {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  color: #1e3a8a;
  font-size: 0.95rem;
}
.form-app__preselect-product {
  color: #0a1f44;
  font-weight: 700;
  font-size: 1.05rem;
}

/* Highlighted row when preselected */
.form-step table tbody tr.preselected {
  background: #fef9c3;
}
.form-step table tbody tr.preselected td {
  border-color: #facc15;
}

/* === Progress Bar === */
.form-progress { margin-bottom: 2.5rem; }
.form-progress__bar { height: 6px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin-bottom: 1rem; }
.form-progress__fill { height: 100%; background: linear-gradient(90deg, #1d4ed8, #3b82f6); border-radius: 999px; transition: width 0.3s ease; }
.form-progress__steps { display: flex; justify-content: space-between; list-style: none; padding: 0; margin: 0; }
.form-progress__step { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; color: #9ca3af; transition: color 0.3s; }
.form-progress__step.is-active { color: #1d4ed8; }
.form-progress__step.is-complete { color: #10b981; }
.form-progress__num { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2px solid #e5e7eb; font-weight: 700; margin-bottom: 0.5rem; transition: all 0.3s; }
.form-progress__step.is-active .form-progress__num { border-color: #1d4ed8; background: #eff6ff; }
.form-progress__step.is-complete .form-progress__num { background: #10b981; border-color: #10b981; color: #fff; }
.form-progress__label { font-size: 0.875rem; font-weight: 500; text-align: center; }

/* === Form Steps === */
.form-step { border: none; padding: 0; margin: 0; }
.form-step__legend { font-size: 1.1rem; font-weight: 700; color: #0a1f44; margin: 1.5rem 0 1rem; padding-top: 1.25rem; border-top: 1px solid #e5e7eb; }
.form-step__legend:first-of-type { border-top: none; padding-top: 0; }

.form-step__nav { display: flex; justify-content: space-between; align-items: center; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid #e5e7eb; gap: 1rem; }

/* === Card Radio (Application Type) === */
.form-row--cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
@media (max-width: 600px) { .form-row--cards { grid-template-columns: 1fr; } }
.form-card-radio { display: flex; align-items: flex-start; gap: 0.75rem; padding: 1rem 1.25rem; border: 2px solid #e5e7eb; border-radius: 12px; cursor: pointer; transition: all 0.2s; position: relative; }
.form-card-radio:hover { border-color: #93c5fd; background: #f0f9ff; }
.form-card-radio input[type="radio"] { margin-top: 0.25rem; accent-color: #1d4ed8; width: 18px; height: 18px; flex-shrink: 0; }
.form-card-radio input[type="radio"]:checked ~ .form-card-radio__body .form-card-radio__title { color: #1d4ed8; }
.form-card-radio:has(input:checked) { border-color: #1d4ed8; background: #eff6ff; }
.form-card-radio__title { font-weight: 700; color: #0a1f44; margin-bottom: 0.25rem; }
.form-card-radio__desc { font-size: 0.875rem; color: #6b7280; line-height: 1.4; }

/* === Form Grid (Applicant fields) === */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; }
.form-group--full { grid-column: 1 / -1; }
.form-group label { font-size: 0.875rem; font-weight: 600; color: #374151; margin-bottom: 0.4rem; }
.form-group input, .form-group select, .form-group textarea {
  padding: 0.65rem 0.85rem; border: 1.5px solid #d1d5db; border-radius: 8px; font-size: 0.95rem;
  font-family: inherit; background: #fff; transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}
.form-group input[type="checkbox"], .form-group input[type="radio"] { padding: 0; width: auto; height: auto; }
.form-group textarea { resize: vertical; min-height: 60px; }
.form-help { font-size: 0.8rem; color: #9ca3af; margin-top: 0.3rem; }
.form-group.has-error input, .form-group.has-error select, .form-group.has-error textarea { border-color: #dc2626; }
.form-group.has-error .form-help { color: #dc2626; }

/* === Product Table === */
.form-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: 0.92rem; }
.form-table th { background: #f9fafb; padding: 0.65rem 0.75rem; text-align: left; font-weight: 700; color: #374151; border-bottom: 2px solid #e5e7eb; }
.form-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.form-table tr.is-selected td { background: #eff6ff; }
.form-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: #1d4ed8; cursor: pointer; }
.form-table .text-center { text-align: center; }
.form-table .text-right { text-align: right; }
.prod-serial { width: 100%; padding: 0.4rem 0.6rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.85rem; }
.prod-serial:disabled { background: #f9fafb; cursor: not-allowed; }

/* === Payment Detail === */
.payment-detail { margin: 1rem 0; padding: 1rem; background: #f9fafb; border-radius: 8px; }
.form-radio-inline { display: inline-flex; align-items: center; gap: 0.4rem; margin-right: 1.25rem; font-size: 0.95rem; cursor: pointer; }
.form-radio-inline input[type="radio"] { width: 16px; height: 16px; accent-color: #1d4ed8; }
.form-row--group { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row--group { grid-template-columns: 1fr; } }
.form-checkbox-inline { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; color: #4b5563; }

/* === Totals Box === */
.totals-box { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 1.25rem; margin: 1.5rem 0; }
.totals-box__row { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; font-size: 0.95rem; }
.totals-box__row--grand { border-top: 2px solid #1d4ed8; margin-top: 0.5rem; padding-top: 0.75rem; font-size: 1.15rem; color: #1d4ed8; font-weight: 700; }
.totals-input { width: 110px; padding: 0.4rem 0.6rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; text-align: right; }

/* === Agreement === */
.agreement-text { background: #fffbeb; border-left: 4px solid #f59e0b; padding: 1rem 1.25rem; border-radius: 6px; font-size: 0.9rem; line-height: 1.65; color: #78350f; margin: 1rem 0 1.5rem; }
.ack-list { display: flex; flex-direction: column; gap: 0.75rem; margin: 1rem 0; }
.ack-item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.ack-item:hover { background: #fee2e2; }
.ack-item input[type="checkbox"] { width: 18px; height: 18px; margin-top: 0.15rem; flex-shrink: 0; accent-color: #dc2626; cursor: pointer; }
.ack-item input[type="checkbox"]:checked ~ span { color: #14532d; }
.ack-item:has(input:checked) { background: #d1fae5; border-color: #6ee7b7; }
.ack-item span { font-size: 0.875rem; line-height: 1.5; color: #374151; }
.ack-num { font-weight: 700; color: #0a1f44; margin-right: 0.25rem; }

/* === Signature Pad === */
.signature-block { margin: 1.5rem 0; }
.signature-block__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.signature-block__header label { font-size: 0.95rem; font-weight: 700; color: #0a1f44; }
.signature-pad { display: block; width: 100%; max-width: 100%; height: 160px; border: 2px dashed #d1d5db; border-radius: 8px; background: #fff; cursor: crosshair; touch-action: none; }
.signature-pad.has-content { border-style: solid; border-color: #10b981; }

/* === Buttons === */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.5rem; border-radius: 8px; font-weight: 600; font-size: 0.95rem; cursor: pointer; border: 2px solid transparent; transition: all 0.2s; text-decoration: none; font-family: inherit; }
.btn-primary { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.btn-primary:hover { background: #1e40af; border-color: #1e40af; }
.btn-primary:disabled { background: #9ca3af; border-color: #9ca3af; cursor: not-allowed; }
.btn-outline { background: transparent; color: #1d4ed8; border-color: #1d4ed8; }
.btn-outline:hover { background: #eff6ff; }
.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn-link { background: transparent; color: #1d4ed8; border-color: transparent; padding: 0.25rem 0.5rem; }
.btn-link:hover { text-decoration: underline; background: transparent; }

/* === Toast / Alert === */
.toast { position: fixed; top: 20px; right: 20px; padding: 1rem 1.5rem; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); z-index: 9999; animation: slideIn 0.3s ease; max-width: 360px; }
.toast--info { background: #dbeafe; color: #1e40af; border-left: 4px solid #1d4ed8; }
.toast--success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.toast--error { background: #fee2e2; color: #991b1b; border-left: 4px solid #dc2626; }
@keyframes slideIn { from { transform: translateX(120%); } to { transform: translateX(0); } }

/* === Responsive === */
@media (max-width: 600px) {
  .form-app { padding: 1rem 0.75rem 3rem; }
  .form-app__title { font-size: 1.5rem; }
  .form-progress__label { font-size: 0.7rem; }
  .form-step__nav { flex-direction: column-reverse; }
  .form-step__nav .btn { width: 100%; justify-content: center; }
  .totals-box__row { font-size: 0.85rem; }
  .totals-box__row--grand { font-size: 1rem; }
}