/* ==========================================================================
   Home Equity Loan Calculator - Exact Clone Stylesheet
   Matches Reference Image 1 & 2 pixel-by-pixel with responsive modern design
   ========================================================================== */

.he-page-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 12px 16px 48px;
  font-family: Arial, Helvetica, sans-serif;
  color: #333333;
  font-size: 13px;
  line-height: 1.5;
}

/* Top Breadcrumbs & Action Bar */
.he-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 10px;
}

.he-breadcrumbs {
  color: #0844a4;
}

.he-breadcrumbs a {
  color: #0844a4;
  text-decoration: none;
}

.he-breadcrumbs a:hover {
  text-decoration: underline;
}

.he-breadcrumbs .sep {
  color: #777777;
  margin: 0 4px;
}

.he-breadcrumbs .current {
  color: #333333;
}

.he-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.he-top-btn {
  background: none;
  border: none;
  color: #0844a4;
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
}

.he-top-btn:hover {
  color: #052c6e;
}

/* Page Title & Intro */
.he-page-title {
  color: #1e4a7a;
  font-size: 26px;
  font-weight: bold;
  margin: 2px 0 12px 0;
  letter-spacing: -0.3px;
}

.he-page-desc {
  font-size: 13px;
  color: #444;
  margin: 0 0 16px 0;
  line-height: 1.5;
}

/* Main Layout: Calculator & Sidebar */
.he-two-col-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.he-main-column {
  flex: 1;
  min-width: 0;
}

.he-sidebar-column {
  width: 250px;
  flex-shrink: 0;
}

/* Main Calculator Grid (Left form + Right results) */
.he-calc-box-wrap {
  background: #ffffff;
  border: 1px solid #d4d4d4;
  border-radius: 3px;
  padding: 16px;
  margin-bottom: 16px;
}

.he-calc-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: flex-start;
}

/* Form Styles */
.he-form-table {
  width: 100%;
}

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

.he-form-label {
  font-size: 13px;
  color: #333333;
  flex: 1;
}

.he-form-field {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.he-input {
  height: 25px;
  padding: 2px 6px;
  font-size: 13px;
  border: 1px solid #7f9db9;
  background-color: #ffffff;
  color: #000000;
  font-family: inherit;
  box-sizing: border-box;
}

.he-input:focus {
  outline: 1px solid #2b638f;
}

.he-input-num {
  width: 110px;
  text-align: left;
}

.he-input-prefix {
  font-size: 13px;
  color: #333;
}

.he-input-suffix {
  font-size: 13px;
  color: #333;
  margin-left: 2px;
}

.he-checkbox-row {
  margin: 12px 0 14px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.he-checkbox-row input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #2b638f;
}

.he-checkbox-row label {
  cursor: pointer;
  user-select: none;
}

/* Button Group */
.he-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.he-btn-calc {
  background-color: #2e7d32;
  color: #ffffff;
  border: 1px solid #256628;
  padding: 4px 16px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

.he-btn-calc:hover {
  background-color: #256628;
}

.he-btn-clear {
  background-color: #9e9e9e;
  color: #ffffff;
  border: 1px solid #828282;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 2px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

.he-btn-clear:hover {
  background-color: #828282;
}

/* Rate Link Button */
.he-rates-banner-btn {
  display: inline-block;
  background-color: #2b638f;
  color: #ffffff;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: normal;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  text-decoration: none;
  margin: 14px 0 20px 0;
}

.he-rates-banner-btn:hover {
  background-color: #1e4a7a;
}

/* Results Panel */
.he-results-box {
  background: #ffffff;
  border-radius: 2px;
}

.he-result-banner {
  background-color: #2e6930;
  color: #ffffff;
  padding: 6px 12px;
  font-size: 15px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 2px 2px 0 0;
}

.he-save-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 11px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  opacity: 0.9;
  text-decoration: none;
  line-height: 1;
}

.he-save-btn:hover {
  opacity: 1;
}

.he-result-body {
  padding: 10px 12px;
  background: #fdfdfd;
  border: 1px solid #d4d4d4;
  border-top: none;
}

.he-result-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid #eeeeee;
}

.he-result-stat-row:last-of-type {
  border-bottom: none;
}

.he-stat-val {
  font-weight: normal;
}

/* Donut Chart and Legend */
.he-chart-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 14px;
  padding-top: 8px;
}

.he-donut-wrap {
  width: 110px;
  height: 110px;
  position: relative;
}

.he-donut-legend {
  font-size: 12px;
  line-height: 1.8;
}

.he-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.he-legend-swatch {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 1px;
}

.he-swatch-blue {
  background-color: #3b82f6;
}

.he-swatch-green {
  background-color: #84cc16;
}

/* Amortization Schedule Section */
.he-schedule-section {
  margin-top: 20px;
  margin-bottom: 28px;
}

.he-section-title {
  color: #000000;
  font-size: 17px;
  font-weight: bold;
  margin: 0 0 8px 0;
}

.he-schedule-tabs {
  margin-bottom: 12px;
  font-size: 13px;
}

.he-schedule-tab {
  color: #0844a4;
  text-decoration: none;
  cursor: pointer;
  margin-right: 14px;
}

.he-schedule-tab.active {
  font-weight: bold;
  color: #000000;
  text-decoration: none;
  cursor: default;
}

.he-schedule-split {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: flex-start;
}

/* Amortization Table */
.he-table-container {
  overflow-x: auto;
  border: 1px solid #d4d4d4;
  max-height: 520px;
  overflow-y: auto;
}

.he-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 12px;
  font-family: Arial, Helvetica, sans-serif;
}

.he-table th {
  background-color: #2b638f;
  color: #ffffff;
  padding: 5px 8px;
  font-weight: bold;
  border: 1px solid #235277;
  position: sticky;
  top: 0;
  z-index: 2;
}

.he-table th:first-child {
  text-align: center;
}

.he-table td {
  padding: 4px 8px;
  border: 1px solid #e0e0e0;
}

.he-table td:first-child {
  text-align: center;
  font-weight: normal;
}

.he-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

.he-table tr:hover {
  background-color: #f0f7ff;
}

/* Line Graph */
.he-graph-wrap {
  border: 1px solid #d4d4d4;
  padding: 10px;
  background-color: #ffffff;
  border-radius: 2px;
}

.he-graph-legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 11px;
  margin-bottom: 6px;
}

.he-graph-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.he-line-swatch {
  width: 14px;
  height: 3px;
  display: inline-block;
}

.he-graph-svg {
  width: 100%;
  height: 220px;
  display: block;
}

/* Second Section: Borrowing Power Calculator */
.he-borrow-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.he-borrow-title {
  color: #1e4a7a;
  font-size: 20px;
  font-weight: bold;
  margin: 0 0 8px 0;
}

.he-borrow-desc {
  font-size: 13px;
  color: #333333;
  line-height: 1.5;
  margin-bottom: 14px;
}

.he-borrow-grid {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 20px;
  align-items: flex-start;
}

.he-borrow-form-box {
  background-color: #ffffff;
  border: 1px solid #d4d4d4;
  padding: 14px;
  border-radius: 2px;
}

.he-borrow-row {
  margin-bottom: 10px;
}

.he-borrow-label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: #333;
}

.he-select {
  height: 26px;
  font-size: 13px;
  padding: 2px 6px;
  border: 1px solid #7f9db9;
  background-color: #ffffff;
  color: #000;
  width: 100%;
  box-sizing: border-box;
}

.he-borrow-res-box {
  background-color: #ffffff;
  border: 1px solid #d4d4d4;
  border-radius: 2px;
}

.he-borrow-res-header {
  background-color: #2e6930;
  color: #ffffff;
  padding: 6px 12px;
  font-size: 15px;
  font-weight: bold;
}

.he-borrow-res-content {
  padding: 14px 16px;
}

.he-borrow-max-msg {
  font-size: 16px;
  font-weight: bold;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.he-borrow-ltv-msg {
  font-size: 13px;
  color: #333333;
  margin-bottom: 14px;
}

.he-borrow-disclaimer {
  font-size: 12px;
  color: #555555;
  line-height: 1.55;
  margin: 0;
  border-top: 1px solid #eeeeee;
  padding-top: 10px;
}

/* Sidebar Styling */
.he-sidebar-search {
  display: flex;
  margin-bottom: 16px;
  gap: 4px;
}

.he-search-input {
  flex: 1;
  height: 28px;
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid #7f9db9;
  box-sizing: border-box;
}

.he-search-btn {
  background-color: #2b638f;
  color: #ffffff;
  border: 1px solid #235277;
  padding: 0 12px;
  font-size: 13px;
  cursor: pointer;
  height: 28px;
  border-radius: 2px;
}

.he-search-btn:hover {
  background-color: #1e4a7a;
}

.he-search-wrap {
  position: relative;
}

.he-search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 260px;
  overflow-y: auto;
  z-index: 1000;
}

.he-search-dropdown.active {
  display: block;
}

.he-search-item {
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
}

.he-search-item:hover,
.he-search-item.focused {
  background-color: #e0f2fe;
}

.he-search-item-cat {
  font-size: 11px;
  color: #64748b;
}

.he-sidebar-card {
  border: 1px solid #2b638f;
  border-radius: 2px;
  overflow: hidden;
  background-color: #ffffff;
}

.he-sidebar-card-header {
  background-color: #2b638f;
  color: #ffffff;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: bold;
}

.he-sidebar-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 10px 8px;
  gap: 4px 12px;
  font-size: 12px;
}

.he-sidebar-links-grid a {
  color: #0844a4;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 1px 0;
}

.he-sidebar-links-grid a:hover {
  text-decoration: underline;
}

.he-sidebar-categories {
  border-top: 1px solid #d4d4d4;
  padding: 8px 10px;
  font-size: 11px;
  text-align: center;
  background-color: #f9f9f9;
}

.he-sidebar-categories a {
  color: #0844a4;
  text-decoration: none;
}

.he-sidebar-categories a:hover {
  text-decoration: underline;
}

/* Fraction Arithmetic Section */
.he-fraction-section {
  margin-top: 36px;
  padding: 20px;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

.he-fraction-title {
  font-size: 18px;
  font-weight: bold;
  color: #1e4a7a;
  margin: 0 0 6px 0;
}

.he-fraction-desc {
  font-size: 13px;
  color: #475569;
  margin: 0 0 16px 0;
  line-height: 1.5;
}

.he-fraction-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.he-frac-input-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.he-frac-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  width: 44px;
}

.he-frac-stack input {
  width: 44px;
  height: 24px;
  text-align: center;
  font-size: 13px;
  border: 1px solid #94a3b8;
  box-sizing: border-box;
}

.he-frac-divider {
  width: 100%;
  height: 1px;
  background-color: #334155;
  margin: 2px 0;
}

.he-frac-op-select {
  height: 32px;
  font-size: 16px;
  padding: 2px 8px;
  border: 1px solid #94a3b8;
  background-color: #ffffff;
}

.he-btn-frac {
  background-color: #0284c7;
  color: #ffffff;
  border: none;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 2px;
}

.he-btn-frac:hover {
  background-color: #0369a1;
}

.he-frac-results {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.he-frac-res-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 10px 16px;
  border-radius: 3px;
  min-width: 140px;
}

.he-frac-res-label {
  display: block;
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.he-frac-res-val {
  font-size: 20px;
  font-weight: bold;
  color: #0f172a;
}

.he-frac-steps {
  font-size: 13px;
  color: #334155;
  padding: 8px 12px;
  background-color: #ffffff;
  border-left: 3px solid #0284c7;
  margin-bottom: 16px;
  border-radius: 0 3px 3px 0;
}

.he-frac-vis-box {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 12px;
  border-radius: 3px;
}

/* SEO, AEO, GEO In-Depth Content */
.he-seo-article {
  margin-top: 36px;
  line-height: 1.65;
  color: #262626;
  font-size: 13px;
}

.he-seo-article h2 {
  font-size: 18px;
  color: #1e4a7a;
  margin: 24px 0 10px 0;
  font-weight: bold;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 4px;
}

.he-seo-article h3 {
  font-size: 15px;
  color: #1e4a7a;
  margin: 18px 0 8px 0;
  font-weight: bold;
}

.he-seo-article p {
  margin: 0 0 12px 0;
}

.he-seo-article ul {
  margin: 0 0 14px 20px;
  padding: 0;
}

.he-seo-article li {
  margin-bottom: 6px;
}

.he-seo-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 20px 0;
  font-size: 12px;
}

.he-seo-table th {
  background-color: #2b638f;
  color: #ffffff;
  text-align: left;
  padding: 6px 10px;
  border: 1px solid #235277;
}

.he-seo-table td {
  padding: 6px 10px;
  border: 1px solid #e0e0e0;
}

.he-seo-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

/* FAQ Section */
.he-faq-box {
  margin-top: 24px;
}

.he-faq-item {
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  margin-bottom: 8px;
  overflow: hidden;
  background-color: #ffffff;
}

.he-faq-question {
  width: 100%;
  text-align: left;
  background-color: #f8fafc;
  border: none;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: bold;
  color: #1e293b;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.he-faq-question:hover {
  background-color: #f1f5f9;
}

.he-faq-arrow {
  font-size: 10px;
  transition: transform 0.2s;
}

.he-faq-item.open .he-faq-arrow {
  transform: rotate(180deg);
}

.he-faq-answer {
  display: none;
  padding: 12px 14px;
  font-size: 13px;
  color: #334155;
  background-color: #ffffff;
  border-top: 1px solid #e2e8f0;
  line-height: 1.55;
}

.he-faq-item.open .he-faq-answer {
  display: block;
}

/* Modals: Instant Tool, History, Print */
.he-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.he-modal-card {
  background-color: #ffffff;
  width: 100%;
  max-width: 520px;
  border-radius: 3px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  overflow: hidden;
}

.he-modal-header {
  background-color: #23527c;
  color: #ffffff;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: bold;
}

.he-modal-close {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.he-modal-body {
  padding: 18px 20px;
  font-size: 13px;
}

.he-modal-field {
  margin-bottom: 14px;
}

.he-modal-field label {
  display: block;
  font-size: 13px;
  color: #222;
  margin-bottom: 6px;
  font-weight: 500;
}

.he-modal-field input {
  width: 100%;
  height: 32px;
  padding: 4px 8px;
  font-size: 14px;
  border: 1px solid #7f9db9;
  box-sizing: border-box;
}

.he-btn-instant-compute {
  background-color: #23527c;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 2px;
  width: 100%;
  margin-top: 6px;
}

.he-btn-instant-compute:hover {
  background-color: #193f61;
}

.he-instant-results {
  margin-top: 14px;
  background-color: #f1f5f9;
  padding: 12px;
  border-radius: 2px;
  border: 1px solid #e2e8f0;
}

.he-instant-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

/* Print Modal Sheet */
.he-print-sheet {
  max-height: 480px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  padding: 24px;
  background-color: #ffffff;
  margin-top: 12px;
  font-family: Arial, sans-serif;
}

.he-print-header {
  border-bottom: 2px solid #2b638f;
  padding-bottom: 10px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

/* Toast Message */
.he-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #1e293b;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 4px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  z-index: 10000;
  display: none;
}

/* RTL Support for Arabic */
[dir="rtl"] .he-page-container {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .he-table {
  text-align: left;
}

[dir="rtl"] .he-table th:first-child,
[dir="rtl"] .he-table td:first-child {
  text-align: center;
}

[dir="rtl"] .he-result-banner,
[dir="rtl"] .he-top-bar,
[dir="rtl"] .he-form-row,
[dir="rtl"] .he-modal-header {
  flex-direction: row-reverse;
}

/* Responsive Media Queries */
@media (max-width: 900px) {
  .he-two-col-layout {
    flex-direction: column;
  }
  .he-sidebar-column {
    width: 100%;
  }
  .he-calc-grid {
    grid-template-columns: 1fr;
  }
  .he-schedule-split {
    grid-template-columns: 1fr;
  }
  .he-borrow-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  .site-header,
  .site-footer,
  .he-top-bar,
  .he-sidebar-column,
  .he-fraction-section,
  .he-faq-box,
  .he-rates-banner-btn,
  .he-btn-row,
  .he-modal-overlay {
    display: none !important;
  }

  body, .he-page-container {
    padding: 0;
    margin: 0;
    max-width: 100%;
  }

  .he-two-col-layout {
    display: block;
  }

  .he-table-container {
    max-height: none;
    overflow: visible;
  }
}
