/* Down Payment Calculator Styles - Exact Clone of Reference Images */

:root {
  --dp-navy: #1b365d;
  --dp-blue: #0844a4;
  --dp-blue-hover: #002277;
  --dp-green-header: #4a7c33;
  --dp-green-header-hover: #3d682a;
  --dp-green-btn: #3e7b23;
  --dp-green-btn-hover: #33671c;
  --dp-gray-btn: #808080;
  --dp-gray-btn-hover: #6c6c6c;
  --dp-border: #cccccc;
  --dp-border-light: #cbd5e1;
  --dp-bg-form: #f2f2f2;
  --dp-table-alt: #f1f5f9;
  --dp-text: #333333;
  --dp-text-dark: #0f172a;
}

/* Page Layout */
body {
  font-family: Arial, Helvetica, sans-serif;
  color: #333333;
  background-color: #ffffff;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

.dp-page-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}

/* Breadcrumbs Row */
.dp-breadcrumbs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2px;
}

.dp-breadcrumbs {
  font-size: 13px;
  color: #0844a4;
}
.dp-breadcrumbs a {
  color: #0844a4;
  text-decoration: none;
}
.dp-breadcrumbs a:hover {
  text-decoration: underline;
}
.dp-breadcrumbs span {
  color: #777777;
  margin: 0 4px;
}
.dp-breadcrumbs .crumb-current {
  color: #333333;
}

/* Quick Action Links */
.dp-top-links {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dp-top-link-btn {
  background: none;
  border: none;
  color: #0844a4;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dp-top-link-btn:hover {
  color: #002277;
}

/* Main Heading */
.dp-main-title {
  font-size: 24px;
  font-weight: bold;
  color: #003366;
  margin: 0 0 4px 0;
  line-height: 1.25;
}

.dp-intro-desc {
  font-size: 13px;
  color: #333333;
  margin: 0 0 12px 0;
  line-height: 1.45;
}

/* Main 2-Column Content Layout */
.dp-content-grid {
  display: flex;
  flex-direction: row;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
  box-sizing: border-box;
}

.dp-main-column {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.dp-sidebar {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Individual Calculator Block */
.dp-calc-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dp-calc-block-title {
  font-size: 18px;
  font-weight: bold;
  color: #003366;
  margin: 0;
  line-height: 1.3;
}

.dp-calc-block-desc {
  font-size: 13px;
  color: #333333;
  margin: 0 0 6px 0;
  line-height: 1.4;
}

.dp-calc-card {
  display: flex;
  flex-direction: row;
  gap: 18px;
  align-items: flex-start;
  width: 100%;
  flex-wrap: wrap;
}

/* Form Panel (Left) */
.dp-form-panel {
  width: 295px;
  flex-shrink: 0;
  background-color: var(--dp-bg-form);
  border: 1px solid var(--dp-border);
  border-radius: 3px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-sizing: border-box;
}

.dp-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dp-form-label {
  font-size: 13px;
  color: #333333;
  user-select: none;
  white-space: nowrap;
}

.dp-input-group {
  display: flex;
  align-items: center;
  width: 140px;
  border: 1px solid #a0aec0;
  background-color: #ffffff;
  border-radius: 2px;
  overflow: hidden;
}

.dp-input-prefix {
  padding: 4px 6px;
  font-size: 13px;
  color: #4a5568;
  background-color: #edf2f7;
  border-right: 1px solid #cbd5e0;
  user-select: none;
}

.dp-input-suffix {
  padding: 4px 6px;
  font-size: 12px;
  color: #4a5568;
  background-color: #edf2f7;
  border-left: 1px solid #cbd5e0;
  user-select: none;
  white-space: nowrap;
}

.dp-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 5px 6px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
  text-align: right;
  color: #1a202c;
  background-color: transparent;
}
.dp-input:focus {
  background-color: #f8fafc;
}

/* Closing costs checkbox row with embedded input */
.dp-closing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13px;
}
.dp-closing-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.dp-closing-input-group {
  display: flex;
  align-items: center;
  width: 82px;
  border: 1px solid #a0aec0;
  background: #ffffff;
  border-radius: 2px;
  overflow: hidden;
}
.dp-closing-input {
  width: 48px;
  border: none;
  outline: none;
  padding: 4px 4px;
  font-size: 13px;
  text-align: right;
}
.dp-closing-type-select {
  border: none;
  outline: none;
  background: #edf2f7;
  border-left: 1px solid #cbd5e0;
  font-size: 12px;
  padding: 3px 2px;
  color: #4a5568;
  cursor: pointer;
}

/* Button Group */
.dp-btn-group {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.dp-btn-calc {
  background-color: var(--dp-green-btn);
  color: #ffffff;
  border: 1px solid #2e5c1a;
  border-radius: 3px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease;
}
.dp-btn-calc:hover {
  background-color: var(--dp-green-btn-hover);
}

.dp-btn-clear {
  background-color: var(--dp-gray-btn);
  color: #ffffff;
  border: 1px solid #5c5c5c;
  border-radius: 3px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.dp-btn-clear:hover {
  background-color: var(--dp-gray-hover);
}

/* Results Panel (Right) */
.dp-results-panel {
  flex: 1 1 270px;
  min-width: 260px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
}

.dp-results-header {
  background-color: var(--dp-green-header);
  color: #ffffff;
  padding: 6px 12px;
  font-size: 15px;
  font-weight: bold;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dp-results-save-btn {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  opacity: 0.9;
  padding: 2px 4px;
  border-radius: 2px;
}
.dp-results-save-btn:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.15);
}
.dp-results-save-btn svg {
  width: 14px;
  height: 14px;
}

.dp-results-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #cbd5e1;
  border-top: none;
  background-color: #ffffff;
  font-size: 13px;
}
.dp-results-table tr {
  border-bottom: 1px solid #cbd5e1;
}
.dp-results-table tr:last-child {
  border-bottom: none;
}
.dp-results-table tr:nth-child(even) {
  background-color: var(--dp-table-alt);
}
.dp-results-table td {
  padding: 7px 10px;
}
.dp-results-table td:last-child {
  text-align: right;
  font-weight: bold;
  color: #0f172a;
}

.dp-pmi-note {
  margin-top: 6px;
  font-size: 11.5px;
  color: #475569;
  line-height: 1.4;
}

/* Latest Mortgage Rates Box */
.dp-rates-box {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 3px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: fit-content;
  margin-top: 4px;
}
.dp-rates-title {
  font-size: 13px;
  font-weight: bold;
  color: #1e293b;
}
.dp-rates-row {
  font-size: 13px;
  color: #334155;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.dp-rate-link {
  color: #0056b3;
  text-decoration: underline;
  cursor: pointer;
}
.dp-rates-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dp-rates-btn {
  background-color: #1b365d;
  color: #ffffff;
  font-size: 12px;
  font-weight: bold;
  padding: 5px 12px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.dp-rates-btn:hover {
  background-color: #152c4d;
}

/* Visualizations Section */
.dp-charts-section {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dp-charts-header {
  font-size: 16px;
  font-weight: bold;
  color: #003366;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
  margin: 0;
}
.dp-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 640px) {
  .dp-charts-grid {
    grid-template-columns: 1fr;
  }
}
.dp-chart-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.dp-chart-title {
  font-size: 13px;
  font-weight: bold;
  color: #334155;
  margin-bottom: 8px;
}
.dp-chart-svg {
  width: 100%;
  max-width: 220px;
  height: auto;
}
.dp-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 11.5px;
}
.dp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dp-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* Fraction Arithmetic Section (Requirement 1 & 5) */
.dp-fraction-section {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dp-fraction-title {
  font-size: 16px;
  font-weight: bold;
  color: #003366;
  margin: 0;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
}
.dp-fraction-desc {
  font-size: 13px;
  color: #475569;
  margin: 0;
  line-height: 1.45;
}
.dp-fraction-card {
  display: flex;
  flex-direction: row;
  gap: 20px;
  flex-wrap: wrap;
}
.dp-fraction-form {
  flex: 1 1 280px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dp-fraction-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dp-frac-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.dp-frac-input {
  width: 54px;
  text-align: center;
  font-size: 13px;
  padding: 4px 2px;
  border: 1px solid #94a3b8;
  border-radius: 2px;
}
.dp-frac-bar {
  width: 50px;
  height: 2px;
  background: #334155;
  margin: 2px 0;
}
.dp-frac-op-select {
  padding: 5px 8px;
  font-size: 13px;
  border: 1px solid #94a3b8;
  border-radius: 2px;
  background: #ffffff;
  cursor: pointer;
}
.dp-fraction-results {
  flex: 1 1 280px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dp-frac-output-display {
  display: flex;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
}
.dp-frac-big-res {
  font-size: 22px;
  font-weight: bold;
  color: #1b365d;
}
.dp-frac-dec-tag {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 13px;
  color: #0f172a;
}
.dp-frac-steps-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 12px;
  color: #334155;
  line-height: 1.4;
}

/* Right Sidebar Elements */
.dp-search-box-wrap {
  display: flex;
  gap: 4px;
  position: relative;
  width: 100%;
}
.dp-search-input {
  flex: 1;
  border: 1px solid #a0aec0;
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 2px;
  box-sizing: border-box;
}
.dp-search-btn {
  background-color: #2b6cb0;
  color: #ffffff;
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: bold;
  border-radius: 2px;
  cursor: pointer;
}
.dp-search-btn:hover {
  background-color: #1e4b7a;
}
.dp-search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-top: none;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 200;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}
.dp-search-results-dropdown.open {
  display: block;
}
.dp-search-item {
  display: flex;
  justify-content: space-between;
  padding: 7px 10px;
  font-size: 12.5px;
  color: #1e293b;
  text-decoration: none;
  border-bottom: 1px solid #f1f5f9;
}
.dp-search-item:hover, .dp-search-item.selected {
  background-color: #f1f5f9;
  color: #0844a4;
}
.dp-search-item-cat {
  font-size: 11px;
  color: #64748b;
}

/* Financial Calculators Links Box */
.dp-links-card {
  border: 1px solid #2b6cb0;
  border-radius: 3px;
  background: #ffffff;
  overflow: hidden;
}
.dp-links-header {
  background-color: #2b6cb0;
  color: #ffffff;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: bold;
}
.dp-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 10px;
  gap: 5px 12px;
  font-size: 12.5px;
}
.dp-links-grid a {
  color: #0844a4;
  text-decoration: underline;
}
.dp-links-grid a:hover {
  color: #002277;
}
.dp-more-links-row {
  grid-column: span 2;
  margin-top: 4px;
}
.dp-links-footer {
  border-top: 1px solid #e2e8f0;
  padding: 6px 8px;
  font-size: 11.5px;
  color: #64748b;
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
}
.dp-links-footer a {
  color: #0844a4;
  text-decoration: none;
}
.dp-links-footer a:hover {
  text-decoration: underline;
}

/* SEO Content & FAQ Section */
.dp-seo-section {
  background: #ffffff;
  border-top: 2px solid #e2e8f0;
  padding-top: 20px;
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #334155;
}
.dp-seo-title {
  font-size: 20px;
  font-weight: bold;
  color: #003366;
  margin: 0 0 10px 0;
}
.dp-seo-subtitle {
  font-size: 16px;
  font-weight: bold;
  color: #1b365d;
  margin: 16px 0 6px 0;
}
.dp-faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.dp-faq-item {
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  overflow: hidden;
}
.dp-faq-question {
  background: #f8fafc;
  padding: 10px 14px;
  font-weight: bold;
  font-size: 13.5px;
  color: #1b365d;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.dp-faq-question:hover {
  background: #f1f5f9;
}
.dp-faq-answer {
  padding: 10px 14px;
  font-size: 13px;
  color: #334155;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: none;
  line-height: 1.5;
}
.dp-faq-item.open .dp-faq-answer {
  display: block;
}

/* Modals */
.dp-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.dp-modal-overlay.open {
  display: flex;
}
.dp-modal-card {
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  max-width: 520px;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Instant Modal Header (Image 1 Match) */
.dp-instant-header {
  background-color: #2b6cb0;
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dp-instant-title {
  font-size: 16px;
  font-weight: bold;
  margin: 0;
}
.dp-modal-close-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.dp-instant-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dp-instant-subtitle {
  font-size: 13px;
  color: #475569;
  margin: 0;
}
.dp-instant-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dp-instant-label {
  font-size: 13px;
  font-weight: bold;
  color: #334155;
}
.dp-instant-input {
  border: 1px solid #94a3b8;
  border-radius: 3px;
  padding: 7px 10px;
  font-size: 14px;
  outline: none;
}
.dp-instant-btn {
  background-color: #1e4b7a;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: bold;
  padding: 9px 18px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  align-self: flex-start;
}
.dp-instant-btn:hover {
  background-color: #15385b;
}
.dp-action-btn {
  background-color: #f1f5f9;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  padding: 7px 12px;
  border-radius: 3px;
  font-size: 12.5px;
  cursor: pointer;
}
.dp-action-btn:hover {
  background-color: #e2e8f0;
}

/* History List */
.dp-history-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dp-history-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 8px 10px;
  border-radius: 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

/* Toast Notification */
.dp-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #1e293b;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 4px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 2000;
}
.dp-toast.show {
  opacity: 1;
  visibility: visible;
}

/* Responsive Breakpoints */
@media (max-width: 820px) {
  .dp-content-grid {
    flex-direction: column;
  }
  .dp-sidebar {
    width: 100%;
    max-width: 100%;
  }
  .dp-form-panel {
    width: 100%;
  }
  .dp-results-panel {
    width: 100%;
    max-width: 100%;
  }
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  .dp-print-sheet, .dp-print-sheet * {
    visibility: visible;
  }
  .dp-print-sheet {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
}
body.dp-printing-modal .dp-modal-overlay#dp-print-modal {
  background: #ffffff !important;
}
body.dp-printing-modal .dp-modal-card {
  box-shadow: none !important;
  border: none !important;
  max-width: 100% !important;
  width: 100% !important;
}
body.dp-printing-modal .dp-instant-header,
body.dp-printing-modal .dp-top-links,
body.dp-printing-modal .no-print {
  display: none !important;
}

/* Arabic RTL support */
html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] .dp-input {
  text-align: left;
}
html[dir="rtl"] .dp-results-table td:last-child {
  text-align: left;
}
html[dir="rtl"] .dp-rates-row,
html[dir="rtl"] .dp-rates-btn-row {
  direction: rtl;
}
