/* SP Matrix Web — Stylesheet
 * Brand: SP Mortgage (deep blue + gold accents)
 */

:root {
  --primary: #1a3a52;
  --primary-dark: #0f2538;
  --primary-light: #2a5074;
  --accent: #d4a017;
  --accent-bright: #f4c430;
  --bg: #f7f9fc;
  --card: #ffffff;
  --text: #1a2533;
  --text-muted: #5a6b7c;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --shadow: 0 4px 20px rgba(15, 37, 56, 0.08);
  --shadow-lg: 0 10px 40px rgba(15, 37, 56, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Language switch */
.lang-switch {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.lang-btn {
  padding: 6px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.lang-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.lang-btn:hover:not(.active) {
  border-color: var(--primary);
}

/* App root */
.app-root {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  margin-bottom: 24px;
}

.brand {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.brand strong {
  color: var(--primary);
  font-weight: 700;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s ease;
}

.step-indicator {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Question card */
.question-card,
.results-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  flex: 1;
}

.question-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  line-height: 1.3;
}

.question-card .help {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Options */
.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.option-btn {
  width: 100%;
  padding: 16px 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  color: var(--text);
}

.option-btn:hover {
  border-color: var(--primary);
  background: rgba(26, 58, 82, 0.03);
  transform: translateY(-1px);
}

.option-btn:active {
  transform: translateY(0);
}

/* Input group */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.input-group input,
.contact-form input {
  padding: 16px 20px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  width: 100%;
  transition: border-color 0.2s;
}

.input-group input:focus,
.contact-form input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Currency input with $ prefix */
.currency-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-prefix {
  position: absolute;
  left: 20px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.currency-input {
  padding-left: 38px !important;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.primary-btn {
  padding: 16px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.primary-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.secondary-btn {
  padding: 12px 20px;
  background: transparent;
  color: var(--text-muted);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  margin-top: 4px;
}

.secondary-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  border-style: solid;
}

/* Back navigation */
.nav-back {
  margin-top: 16px;
  text-align: center;
}

.back-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

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

/* Contact form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.submit-btn {
  margin-top: 8px;
}

.skip-link {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
}

.skip-link a {
  color: var(--text-muted);
  text-decoration: none;
}

.skip-link a:hover {
  color: var(--primary);
}

/* Consent checkbox */
.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.consent-row:hover {
  background: rgba(26, 58, 82, 0.04);
}

.consent-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.required-mark {
  color: var(--error);
  font-weight: 700;
}

.contact-error {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
}

.privacy-note {
  margin-top: 20px;
  padding: 12px;
  background: rgba(26, 58, 82, 0.04);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* Results */
.results-hero {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.results-hero h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}

.results-subtitle {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.scenario-summary {
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: left;
}

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

.summary-grid .lbl {
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 4px;
}

/* Result cards */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.result-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s;
}

.result-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.result-card.top {
  border-color: var(--accent);
  background: linear-gradient(135deg, #fffbf0 0%, #ffffff 100%);
  box-shadow: var(--shadow);
}

.result-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.result-rank {
  font-size: 32px;
  flex-shrink: 0;
}

.result-title {
  flex: 1;
  min-width: 0;
}

.result-title h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2px;
}

.program-name {
  font-size: 14px;
  color: var(--text-muted);
}

.result-score {
  text-align: center;
  flex-shrink: 0;
}

.score-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.score-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-body {
  margin-top: 12px;
}

.category-badge {
  display: inline-block;
  background: rgba(26, 58, 82, 0.08);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.key-notes {
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

/* Requirements toggle (client view) */
.requirements-toggle {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.requirements-toggle summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
  padding: 8px 0;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.requirements-toggle summary::-webkit-details-marker {
  display: none;
}

.requirements-toggle summary::after {
  content: "▾";
  font-size: 16px;
  transition: transform 0.2s;
}

.requirements-toggle[open] summary::after {
  transform: rotate(180deg);
}

.requirements-toggle summary:hover {
  color: var(--primary-light);
}

.requirements-content {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.req-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}

.req-list dt {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 2px;
}

.req-list dd {
  margin: 0 0 8px 0;
  color: var(--text);
  font-size: 14px;
  padding-left: 4px;
}

.req-list dd strong {
  color: var(--primary);
  font-weight: 700;
}

.req-desc {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.req-example {
  margin-top: 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #fffbf0, #ffffff);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

/* VA eligibility highlight box */
.va-eligibility-box {
  background: linear-gradient(135deg, #f0f5ff, #ffffff);
  border: 2px solid #1a3a52;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.va-eligibility-box h4 {
  color: var(--primary);
  font-size: 16px;
  margin-bottom: 8px;
  font-weight: 700;
}

.va-eligibility-box p {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.5;
}

.va-eligibility-box ul {
  margin: 6px 0 12px 0;
  padding-left: 22px;
  font-size: 13px;
}

.va-eligibility-box li {
  margin-bottom: 5px;
  line-height: 1.5;
  color: var(--text);
}

.va-eligibility-box li strong {
  color: var(--primary);
}

.va-coe-note {
  background: rgba(212, 160, 23, 0.12);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px !important;
  margin-top: 10px;
  border-left: 3px solid var(--accent);
}

.warnings {
  background: rgba(245, 158, 11, 0.08);
  color: #92400e;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 12px;
}

/* CTAs */
.cta-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.cta-btn.whatsapp {
  background: #25d366;
  color: white;
}

.cta-btn.whatsapp:hover {
  background: #1ebe57;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.cta-btn.floify {
  background: var(--primary);
  color: white;
}

.cta-btn.floify:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.restart-link {
  text-align: center;
  font-size: 13px;
}

.restart-link a {
  color: var(--text-muted);
  text-decoration: none;
}

.restart-link a:hover {
  color: var(--primary);
}

/* Out-of-state disclaimer */
.out-of-state-disclaimer {
  background: linear-gradient(135deg, #fef9e7, #ffffff);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 24px;
}

.out-of-state-disclaimer h3 {
  color: #92400e;
  font-size: 16px;
  margin-bottom: 10px;
  font-weight: 700;
}

.out-of-state-disclaimer p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 8px;
}

.out-of-state-disclaimer p:last-child {
  margin-bottom: 0;
}

.out-of-state-disclaimer .disclaimer-note {
  background: white;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 10px;
  border-left: 3px solid var(--accent);
}

/* No-match */
.no-match {
  text-align: center;
  padding: 48px 32px;
}

.no-match h1 {
  font-size: 24px;
  margin-bottom: 16px;
}

/* Loading */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 20px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.app-footer p {
  margin-bottom: 4px;
}

.app-footer .compliance {
  font-size: 12px;
  opacity: 0.85;
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

.app-footer strong {
  color: var(--primary);
}

/* Mobile adjustments */
@media (max-width: 600px) {
  .container { padding: 12px; }
  .question-card,
  .results-card { padding: 20px; }
  .question-card h2 { font-size: 19px; }
  .results-hero h1 { font-size: 22px; }
  .result-rank { font-size: 24px; }
  .result-title h3 { font-size: 16px; }
}
