/* ==========================================================
   LoanSpace.ai — Dashboard Styles
   Matches the existing navy + blue fintech design language.
   ========================================================== */

/* ---------- Page Layout ---------- */
.dashboard-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  overflow-x: hidden;
  box-sizing: border-box;
}

.dashboard-page .page-header {
  margin-bottom: 8px;
}
.dashboard-page .page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dashboard-page .page-header h1 i {
  color: #3b82f6;
}
.dashboard-page .subtitle {
  color: #64748b;
  font-size: 15px;
  margin-top: 4px;
}

/* ---------- CTA Banner (anonymous) ---------- */
.cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.cta-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #1e3a5f;
}
.cta-content i { font-size: 20px; color: #3b82f6; }
.cta-content strong { display: block; font-size: 15px; }
.cta-content span { font-size: 13px; color: #475569; }
.btn-cta {
  padding: 10px 24px;
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.35); }

/* ---------- Tab Navigation ---------- */
.dashboard-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 28px;
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}
.tab-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn:hover { color: #1e293b; background: rgba(255,255,255,0.5); }
.tab-btn.active {
  background: #fff;
  color: #1e3a5f;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.tab-btn i { font-size: 16px; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Panel Card (shared) ---------- */
.panel-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.panel-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.panel-card h2 i { color: #3b82f6; }
.panel-subtitle { color: #64748b; font-size: 14px; margin-bottom: 20px; }

/* ====================================================
   TAB 1 — READINESS SCORE
   ==================================================== */

.readiness-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 28px;
  align-items: start;
}

/* Form Panel */
.readiness-form-panel .form-group { margin-bottom: 16px; }
.readiness-form-panel label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}
.readiness-form-panel input[type="number"],
.readiness-form-panel select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #f8fafc;
  color: #1e293b;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.readiness-form-panel input:focus,
.readiness-form-panel select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.input-prefix {
  position: relative;
  display: flex;
  align-items: center;
}
.input-prefix span {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  z-index: 1;
}
.input-prefix input {
  padding-left: 28px !important;
}
.help-text { font-size: 12px; color: #94a3b8; margin-top: 4px; display: block; }

.checkbox-group { margin-top: 4px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #334155;
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(59,130,246,0.35); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: #fff;
  color: #3b82f6;
  border: 1.5px solid #3b82f6;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { background: #eff6ff; }

.btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover { background: #fee2e2; color: #ef4444; }

.btn-save { margin-top: 12px; }

/* Score Gauge */
.score-card {
  text-align: center;
  padding: 32px;
}
.score-gauge-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 20px;
}
.score-gauge {
  width: 200px;
  height: 200px;
  transform: rotate(-90deg);
}
.gauge-bg {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 12;
}
.gauge-fill {
  fill: none;
  stroke: #3b82f6;
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s ease-out, stroke 0.5s;
}
.score-value-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.score-number {
  display: block;
  font-size: 52px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}
.score-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  margin-top: 4px;
}
.score-message {
  font-size: 15px;
  color: #475569;
  margin-top: 8px;
  line-height: 1.5;
}

/* Score colors */
.gauge-excellent { stroke: #10b981; }
.gauge-good { stroke: #3b82f6; }
.gauge-fair { stroke: #f59e0b; }
.gauge-needs-work { stroke: #ef4444; }

/* Breakdown Grid */
.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.breakdown-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  transition: box-shadow 0.15s;
}
.breakdown-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.breakdown-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.breakdown-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}
.breakdown-card-score {
  font-size: 16px;
  font-weight: 700;
}
.breakdown-card-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.breakdown-card-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease-out;
}
.breakdown-card-detail {
  font-size: 12px;
  color: #94a3b8;
}
.breakdown-card-label {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

/* Color classes for breakdown cards */
.score-color-green { color: #10b981; }
.bar-green { background: #10b981; }
.score-color-blue { color: #3b82f6; }
.bar-blue { background: #3b82f6; }
.score-color-yellow { color: #f59e0b; }
.bar-yellow { background: #f59e0b; }
.score-color-red { color: #ef4444; }
.bar-red { background: #ef4444; }

/* Recommendations */
.recommendations-card {
  margin-top: 20px;
}
.recommendations-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.recommendations-card h3 i { color: #f59e0b; }
.recommendations-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.recommendations-card li {
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 14px;
  color: #78350f;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.recommendations-card li::before {
  content: '\f0eb';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 14px;
  color: #f59e0b;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Score History */
.history-card { margin-top: 20px; }
.history-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.history-card h3 i { color: #3b82f6; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 14px;
}
.history-item-score { font-weight: 700; font-size: 18px; }
.history-item-date { color: #94a3b8; font-size: 13px; }

/* ====================================================
   TAB 2 — JOURNEY TRACKER
   ==================================================== */

.journey-header {
  text-align: center;
  margin-bottom: 32px;
}
.journey-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.journey-header h2 i { color: #3b82f6; }

.journey-progress-bar-container {
  width: 100%;
  max-width: 500px;
  height: 10px;
  background: #e2e8f0;
  border-radius: 5px;
  margin: 16px auto 8px;
  overflow: hidden;
}
.journey-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 5px;
  transition: width 0.8s ease;
}
.journey-progress-text {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

/* Timeline */
.journey-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}
.journey-step {
  display: flex;
  gap: 20px;
  position: relative;
  padding-bottom: 8px;
}

/* Vertical connector line */
.journey-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 23px;
  top: 48px;
  bottom: 0;
  width: 3px;
  background: #e2e8f0;
  z-index: 0;
}
.journey-step.step-completed:not(:last-child)::after {
  background: #10b981;
}

/* Step circle */
.step-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  z-index: 1;
  transition: all 0.3s;
}
.step-upcoming .step-icon {
  background: #f1f5f9;
  color: #94a3b8;
  border: 2px solid #e2e8f0;
}
.step-current .step-icon {
  background: #eff6ff;
  color: #3b82f6;
  border: 2px solid #3b82f6;
  animation: pulse 2s infinite;
}
.step-completed .step-icon {
  background: #10b981;
  color: #fff;
  border: 2px solid #10b981;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.3); }
  50% { box-shadow: 0 0 0 10px rgba(59,130,246,0); }
}

/* Step content */
.step-content {
  flex: 1;
  padding: 4px 0 24px;
}
.step-content h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 4px;
}
.step-completed .step-content h3 { color: #10b981; }
.step-content p {
  font-size: 14px;
  color: #64748b;
  line-height: 1.5;
  margin-bottom: 8px;
}
.step-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #3b82f6;
  text-decoration: none;
  transition: color 0.15s;
}
.step-link:hover { color: #2563eb; text-decoration: underline; }
.step-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.btn-step-toggle {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-step-toggle:hover { border-color: #3b82f6; color: #3b82f6; }
.btn-step-toggle.completed-toggle {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}

/* ====================================================
   TAB 3 — WHAT-IF SCENARIOS
   ==================================================== */

.scenarios-header {
  margin-bottom: 24px;
}
.scenarios-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 10px;
}
.scenarios-header h2 i { color: #3b82f6; }

/* Scenario Input Cards */
.scenario-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.scenario-input-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px;
  transition: border-color 0.2s;
}
.scenario-input-card:hover { border-color: #cbd5e1; }

.scenario-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.scenario-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.scenario-name-input {
  flex: 1;
  border: none;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  background: transparent;
  padding: 4px 0;
}
.scenario-name-input:focus {
  outline: none;
  border-bottom: 2px solid #3b82f6;
}

.scenario-fields .form-group { margin-bottom: 12px; }
.scenario-fields label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}
.scenario-fields input,
.scenario-fields select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  background: #f8fafc;
  color: #1e293b;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.scenario-fields input:focus,
.scenario-fields select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}
.scenario-fields .input-prefix span { font-size: 13px; }
.scenario-fields .input-prefix input { padding-left: 24px !important; }

/* Location lookup row */
.location-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 6px;
}
.location-row .form-group { margin-bottom: 0; }
.location-city { flex: 2; }
.location-state { flex: 1; }
.btn-lookup {
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  margin-bottom: 1px;
}
.btn-lookup:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(59,130,246,0.3); }
.btn-lookup:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-lookup .loading-spinner { width: 14px; height: 14px; border-width: 2px; }

.location-status {
  font-size: 11px;
  min-height: 16px;
  margin-bottom: 8px;
  padding: 0 2px;
  line-height: 1.4;
}
.location-status.success {
  color: #10b981;
}
.location-status.error {
  color: #ef4444;
}

/* Auto-filled tag */
.auto-filled-tag {
  font-size: 10px;
  font-weight: 600;
  color: #10b981;
  background: #ecfdf5;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Actions bar */
.scenario-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

/* Result Cards */
.scenario-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.scenario-result-card {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  position: relative;
  transition: border-color 0.2s;
}
.scenario-result-card.winner {
  border-color: #10b981;
}
.winner-badge {
  position: absolute;
  top: -12px;
  right: 16px;
  background: #10b981;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.result-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.result-card-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}
.result-monthly-total {
  font-size: 32px;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 4px;
}
.result-monthly-label {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
}
.result-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid #f1f5f9;
}
.result-breakdown-row:last-child { border-bottom: none; }
.result-breakdown-label { color: #64748b; }
.result-breakdown-value { font-weight: 600; color: #1e293b; }
.result-total-cost {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.result-total-cost-label { font-weight: 600; color: #475569; }
.result-total-cost-value { font-weight: 800; color: #1e293b; font-size: 18px; }

/* Charts */
.chart-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.chart-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  overflow: hidden;
  min-width: 0;
}
.chart-card canvas {
  max-width: 100%;
}
.chart-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 16px;
}

/* Last score note */
.last-score-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #64748b;
  background: #f1f5f9;
  padding: 6px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.last-score-note i { color: #94a3b8; }

/* ====================================================
   LOADING STATE
   ==================================================== */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ====================================================
   RESPONSIVE
   ==================================================== */
@media (max-width: 968px) {
  .readiness-layout {
    grid-template-columns: 1fr;
  }
  .chart-section {
    grid-template-columns: 1fr;
  }
  .scenario-inputs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dashboard-page {
    padding: 16px 14px 48px;
    width: 100%;
    max-width: 100vw;
  }
  .dashboard-page .page-header h1 {
    font-size: 22px;
  }
  .dashboard-tabs {
    border-radius: 10px;
  }
  .tab-btn {
    flex-direction: column;
    padding: 10px 6px;
    font-size: 12px;
    gap: 4px;
    text-align: center;
  }
  .tab-btn i { font-size: 16px; }
  .tab-btn span { font-size: 11px; line-height: 1.2; }
  .panel-card { padding: 18px; }
  .score-gauge-container { width: 160px; height: 160px; }
  .score-gauge { width: 160px; height: 160px; }
  .score-number { font-size: 40px; }
  .breakdown-grid {
    grid-template-columns: 1fr 1fr;
  }
  .cta-banner { flex-direction: column; text-align: center; }
  .cta-content { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
  .scenario-actions { flex-direction: column; }
  .scenario-actions .btn-primary,
  .scenario-actions .btn-secondary { width: 100%; }
  .result-monthly-total { font-size: 26px; }
}

@media (max-width: 480px) {
  .tab-btn {
    padding: 8px 4px;
    gap: 3px;
  }
  .tab-btn span { font-size: 10px; }
  .breakdown-grid {
    grid-template-columns: 1fr;
  }
}
