/* =========================================================
   MORTGAGE CALCULATOR (inline on /calculator.php)
   Every rule is scoped under #calc-app so nothing here can
   change the rest of the site, and the site can't change this.
   ========================================================= */

#calc-app, #calc-app * {
    box-sizing: border-box;
}

#calc-app {
    font-family: Arial, sans-serif;
    color: #1e293b;
}

/* Keep headings looking like the calculator, not the rest of the site */
#calc-app h2 {
    font-family: Arial, sans-serif;
    font-weight: 700;
    letter-spacing: normal;
    line-height: 1.3;
    color: inherit;
}

#calc-app .calculator {
    max-width: 1100px;
    margin: auto;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,.08);
}

#calc-app .header {
    background: #123b5d;
    color: white;
    padding: 18px 22px;
}

#calc-app .header h2 {
    margin: 0 0 8px;
    font-size: 25px;
}

#calc-app .header p {
    margin: 0;
    color: #dbeafe;
}

#calc-app .content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    padding: 20px 22px;
}

#calc-app h2 {
    font-size: 18px;
    margin: 0 0 14px;
}

#calc-app .field {
    margin-bottom: 11px;
}

#calc-app label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

#calc-app .modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

#calc-app .modal-overlay[hidden] {
  display: none;
}

#calc-app .modal-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: white;
  padding: 28px;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
}

#calc-app .modal-card h2 {
  margin: 0 32px 10px 0;
}

#calc-app .modal-card p {
  color: #64748b;
  line-height: 1.5;
}

#calc-app .modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: auto;
  margin: 0;
  padding: 4px 10px;
  background: transparent;
  color: #123b5d;
  font-size: 28px;
}

#calc-app .modal-close:hover {
  background: #e2e8f0;
}

#calc-app .modal-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

#calc-app input,
#calc-app select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    color: #0f172a;
}

#calc-app input:focus,
#calc-app select:focus {
    outline: 2px solid #60a5fa;
    border-color: #2563eb;
}

#calc-app .results {
    background: #f8fafc;
    padding: 17px;
    border-radius: 12px;
}

#calc-app .payment-label {
    color: #475569;
    font-size: 14px;
}

#calc-app .payment {
    color: #123b5d;
    font-size: 32px;
    font-weight: bold;
    margin: 5px 0 14px;
    overflow-wrap: anywhere;
}

#calc-app .down-payment-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#calc-app .mode-options {
  display: flex;
  gap: 8px;
}

#calc-app button.mode-toggle {
  flex: 1;
  width: auto;
  margin-top: 0;
  padding: 10px 14px;
  background: #e2e8f0;
  color: #123b5d;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
}

#calc-app button.mode-toggle:hover {
  background: #cbd5e1;
}

#calc-app button.mode-toggle.active {
  background: #123b5d;
  color: white;
  border-color: #123b5d;
}

#calc-app .result-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

#calc-app .result-row span:first-child {
    color: #475569;
}

#calc-app .result-row strong {
    text-align: right;
}

#calc-app .breakdown {
    margin-top: 16px;
}

#calc-app .approval-scale-wrap {
    margin: 9px 0 12px;
}

#calc-app .approval-scale {
    position: relative;
    height: 16px;
    border-radius: 999px;
    background: linear-gradient(to right, #dc2626 0%, #facc15 50%, #16a34a 100%);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

#calc-app .approval-scale-marker {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 26px;
    border: 2px solid #ffffff;
    border-radius: 5px;
    background: #0f172a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, -50%);
    transition: left 0.25s ease;
    pointer-events: none;
}

#calc-app .approval-scale-labels {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 7px;
    color: #64748b;
    font-size: 11px;
}

#calc-app .approval-scale-note {
    margin: 9px 0 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

#calc-app .bar {
    display: flex;
    height: 14px;
    border-radius: 8px;
    overflow: hidden;
    margin: 14px 0;
    background: #e2e8f0;
}

#calc-app .bar div {
    height: 100%;
    transition: width .3s;
}

#calc-app .legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 13px;
}

#calc-app .legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
}

#calc-app .dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

#calc-app button {
    width: 100%;
    padding: 11px;
    margin-top: 6px;
    background: #123b5d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

#calc-app button:hover {
    background: #1e5078;
}

#calc-app .secondary {
    background: #e2e8f0;
    color: #1e293b;
    margin-top: 10px;
}

#calc-app .secondary:hover {
    background: #cbd5e1;
}

#calc-app .loan-purpose-options {
   margin-bottom: 24px;
}

#calc-app .loan-purpose-options button {
   margin-top: 0;
}

#calc-app .note {
    padding: 12px 22px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
    border-top: 1px solid #e2e8f0;
}

@media (max-width: 700px) {
#calc-app .content {
      grid-template-columns: 1fr;
      padding: 16px;
      gap: 18px;
}

#calc-app .header {
      padding: 18px 16px;
}

#calc-app .header h2 {
      font-size: 22px;
}

#calc-app .payment {
      font-size: 32px;
}
}

#calc-app .apply-link {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    border: 2px solid #123b5d;
    border-radius: 8px;
    background: white;
    color: #123b5d;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
}

#calc-app .apply-link:hover,
#calc-app .apply-link:focus-visible {
    background: #e2f0fa;
}

#calc-app .hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
