/* ========================================
   Refinance Calculator - LoanSpace.ai
   ======================================== */

:root {
  --primary: #1e3a5f;
  --primary-light: #2d4a6f;
  --accent: #2b7cc4;
  --accent-light: #4A9FE8;
  --accent-soft: #e8f4fc;
  --orange: #f39c12;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --bg-main: #f8f9fb;
  --bg-card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
}

/* Page Layout */
.refinance-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

/* Page Header */
.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.page-header .subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
}

/* Calculator Container */
.calculator-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Calculator Grid */
.calculator-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

@media (max-width: 768px) {
  .calculator-grid {
    grid-template-columns: 1fr;
  }
}

/* Calculator Card */
.calculator-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

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

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.card-icon.accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  color: white;
}

.card-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Form Groups */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-with-prefix,
.input-with-suffix {
  position: relative;
}

.input-with-prefix input,
.input-with-suffix input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-dark);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  background: white;
}

.input-with-prefix input {
  padding-left: 32px;
}

.input-with-suffix input {
  padding-right: 48px;
}

.input-with-prefix input:focus,
.input-with-suffix input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.prefix,
.suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

.prefix {
  left: 14px;
}

.suffix {
  right: 14px;
}

/* Result Box */
.result-box {
  margin-top: 20px;
  padding: 16px;
  border-radius: 12px;
  background: var(--accent-soft);
}

.result-box.accent {
  background: linear-gradient(135deg, var(--accent-soft) 0%, #dbeafe 100%);
}

.result-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.result-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

/* Savings Banner */
.savings-banner {
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  color: white;
}

.savings-banner.positive {
  background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
}

.savings-banner.negative {
  background: linear-gradient(135deg, var(--warning) 0%, #b45309 100%);
}

.savings-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.savings-amount {
  font-size: 40px;
  font-weight: 700;
}

.savings-period {
  font-size: 14px;
  opacity: 0.9;
  margin-top: 4px;
}

/* Slider Section */
.slider-section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--border);
}

.slider-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.slider-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 24px 0;
}

/* Slider */
.slider-container {
  margin-bottom: 32px;
}

.stay-slider {
  width: 100%;
  height: 12px;
  border-radius: 6px;
  appearance: none;
  cursor: pointer;
  background: var(--border);
  margin-bottom: 8px;
}

.stay-slider::-webkit-slider-thumb {
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(43, 124, 196, 0.4);
  transition: transform 0.2s;
}

.stay-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.stay-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(43, 124, 196, 0.4);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* Timeline */
.timeline {
  position: relative;
  height: 60px;
  margin-bottom: 24px;
}

.timeline-track {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
}

.timeline-marker {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  text-align: center;
}

.marker-line {
  width: 2px;
  height: 56px;
  background: var(--warning);
  margin: 0 auto;
}

.marker-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--warning);
  white-space: nowrap;
  margin-top: 4px;
}

.timeline-pin {
  position: absolute;
  top: 14px;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s;
}

.timeline-pin.positive {
  background: var(--success);
}

.timeline-pin.negative {
  background: var(--warning);
}

/* Verdict Box */
.verdict-box {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid;
}

.verdict-box.positive {
  background: var(--success-light);
  border-color: #a7f3d0;
}

.verdict-box.negative {
  background: var(--warning-light);
  border-color: #fde68a;
}

.verdict-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.verdict-box.positive .verdict-icon {
  color: var(--success);
}

.verdict-box.negative .verdict-icon {
  color: var(--warning);
}

.verdict-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.verdict-box.positive .verdict-title {
  color: #065f46;
}

.verdict-box.negative .verdict-title {
  color: #92400e;
}

.verdict-text {
  font-size: 14px;
}

.verdict-box.positive .verdict-text {
  color: #047857;
}

.verdict-box.negative .verdict-text {
  color: #b45309;
}

/* CTA Section */
.cta-section {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
}

.cta-content h3 {
  font-size: 22px;
  font-weight: 700;
  color: white;
  margin: 0 0 8px 0;
}

.cta-content p {
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 20px 0;
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--orange);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(243, 156, 18, 0.4);
}

.btn-cta:hover {
  transform: scale(1.05);
}

.cta-disclaimer {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 12px;
}

/* Contact Form */
.contact-form-container {
  max-width: 400px;
  margin: 0 auto;
}

.contact-form-container h3 {
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin: 0 0 20px 0;
}

.contact-form input {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.95);
  outline: none;
}

.contact-form input:focus {
  box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.4);
}

.form-buttons {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.form-buttons button {
  flex: 1;
  padding: 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s;
}

.form-buttons .btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.form-buttons .btn-primary {
  background: var(--orange);
  color: white;
}

.form-buttons button:hover {
  transform: scale(1.02);
}

.form-disclaimer {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 12px;
  text-align: center;
}

/* Success Message */
.success-message {
  background: var(--success-light);
  border: 1px solid #a7f3d0;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
}

.success-icon {
  font-size: 48px;
  color: var(--success);
  margin-bottom: 16px;
}

.success-message h3 {
  font-size: 20px;
  font-weight: 700;
  color: #065f46;
  margin: 0 0 8px 0;
}

.success-message p {
  color: #047857;
  margin: 0;
}

/* Analysis Section */
.analysis-section {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--border);
}

.analysis-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  padding: 16px;
  border-radius: 12px;
  background: var(--accent-soft);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.stat-value.positive {
  color: var(--success);
}

.stat-value.negative {
  color: var(--danger);
}

.stat-value.accent {
  color: var(--accent);
}

.stat-footnote {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Tips Box */
.tips-box {
  padding: 20px;
  border-radius: 12px;
  background: var(--accent-soft);
}

.tips-box h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 12px 0;
}

.tips-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.tips-box li {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
}

.tips-box li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

/* Info Section */
.info-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.info-section h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 600px) {
  .info-grid {
    grid-template-columns: 1fr;
  }
}

.info-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.info-card h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.info-card h4 i {
  color: var(--accent);
}

.info-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Page Footer */
.page-footer {
  text-align: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .refinance-page {
    padding: 16px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .savings-amount {
    font-size: 32px;
  }

  .calculator-card,
  .slider-section,
  .cta-section,
  .analysis-section {
    padding: 20px;
  }
}
