/* loanrates.css */
/* Uses shared layout + colors from style.css. No dark text colours here. */

#loan-rates-summary,
#loan-rates-borrower-types,
#loan-rates-visuals,
#loan-rates-responsibilities {
  position: relative;
}

/* Summary grid */

.rate-summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(0, 1.4fr);
  gap: 1.75rem;
  align-items: stretch;
}

.rate-card,
.rate-graph-card,
.visual-card {
  border-radius: 1.5rem;
  padding: 1.4rem 1.6rem;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 55%),
    radial-gradient(circle at bottom right, rgba(168, 85, 247, 0.16), transparent 55%),
    rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow:
    0 18px 35px rgba(15, 23, 42, 0.7),
    0 0 40px rgba(56, 189, 248, 0.18);
  backdrop-filter: blur(18px);
  transform: translateY(6px);
  opacity: 0;
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.rate-card h3,
.rate-graph-card h3,
.visual-card h3 {
  font-size: 1rem;
  margin-bottom: 0.6rem;
}

.rate-card .overview-list {
  margin-top: 0.75rem;
}

.rate-number-main {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.rate-number-main.accent {
  text-shadow: 0 0 18px rgba(244, 114, 182, 0.45);
}

.rate-number-sub {
  font-size: 0.9rem;
  opacity: 0.85;
}

/* Graph card */

.rate-graph-card {
  position: relative;
}

.graph-note {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 0.6rem;
}

/* Interest graph */

.rate-graph {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 0.6rem;
}

.rate-graph-row {
  padding: 0.7rem 0.8rem 0.85rem;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.7);
  transform: translateY(8px);
  opacity: 0;
  transition:
    opacity 0.65s ease,
    transform 0.65s ease;
}

.rate-graph-row-active {
  opacity: 1;
  transform: translateY(0);
}

.rate-graph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}

.rate-graph-label {
  font-weight: 500;
}

.rate-graph-value {
  font-size: 0.8rem;
  opacity: 0.86;
}

.rate-graph-bar {
  position: relative;
  width: 100%;
  height: 0.6rem;
  border-radius: 999px;
  background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.45), transparent 60%);
  overflow: hidden;
}

.rate-graph-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #22c55e, #06b6d4, #a855f7);
  box-shadow:
    0 0 14px rgba(56, 189, 248, 0.55),
    0 0 26px rgba(168, 85, 247, 0.45);
  transition: width 0.9s ease-out;
}

/* Borrower tables */

.rate-tables-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(0, 1.3fr);
  gap: 1.75rem;
  margin-top: 1rem;
}

.rate-table-block {
  border-radius: 1.4rem;
  padding: 1.35rem 1.4rem;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 55%),
    rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.8);
}

.rate-table-block h3 {
  font-size: 0.98rem;
  margin-bottom: 0.65rem;
}

.rates-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.rates-table th,
.rates-table td {
  padding: 0.5rem 0.4rem;
  text-align: left;
}

.rates-table thead th {
  font-weight: 600;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.rates-table tbody tr:nth-child(odd) {
  background: rgba(15, 23, 42, 0.85);
}

.rates-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.7);
}

.rates-table tbody tr:hover {
  background: radial-gradient(circle at center, rgba(59, 130, 246, 0.25), rgba(15, 23, 42, 0.9));
}

/* Visuals section */

.visuals-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.1fr);
  gap: 1.75rem;
  align-items: stretch;
}

.visual-text {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

/* LTV graph */

.ltv-graph {
  margin-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.ltv-graph-row {
  padding: 0.75rem 0.85rem 0.9rem;
  border-radius: 1.1rem;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow:
    0 12px 24px rgba(15, 23, 42, 0.85),
    0 0 26px rgba(52, 211, 153, 0.3);
  transform: translateY(8px);
  opacity: 0;
  transition:
    opacity 0.65s ease,
    transform 0.65s ease;
}

.ltv-graph-row-active {
  opacity: 1;
  transform: translateY(0);
}

.ltv-graph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  margin-bottom: 0.45rem;
}

.ltv-label {
  font-weight: 500;
}

.ltv-value {
  font-size: 0.8rem;
  opacity: 0.86;
}

.ltv-bar {
  position: relative;
  display: flex;
  width: 100%;
  height: 0.8rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.85);
}

.ltv-bar-holdings,
.ltv-bar-loan {
  position: relative;
  height: 100%;
  transition: width 0.9s ease-out;
}

.ltv-bar-holdings {
  width: 0;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.6);
}

.ltv-bar-holdings.locked {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.ltv-bar-loan {
  width: 0;
  background: linear-gradient(90deg, #06b6d4, #a855f7);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.6);
}

.ltv-bar-tooltip {
  position: absolute;
  top: -1.5rem;
  left: 0.6rem;
  font-size: 0.7rem;
  opacity: 0.9;
}

/* Duration graph */

.duration-graph {
  margin-top: 1rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.3rem;
}

.duration-bar-col {
  flex: 1;
  text-align: center;
}

.duration-bar {
  position: relative;
  height: 7.5rem;
  border-radius: 999px;
  background: radial-gradient(circle at top, rgba(30, 64, 175, 0.5), rgba(15, 23, 42, 0.95));
  overflow: hidden;
  box-shadow: 0 18px 26px rgba(15, 23, 42, 0.9);
}

.duration-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #a855f7, #22c55e);
  box-shadow:
    0 0 22px rgba(168, 85, 247, 0.7),
    0 0 26px rgba(34, 197, 94, 0.55);
  transition: height 1s ease-out;
}

.duration-label {
  margin-top: 0.5rem;
  font-size: 0.86rem;
  font-weight: 500;
}

.duration-sub {
  font-size: 0.78rem;
  opacity: 0.85;
}

/* Responsibilities */

#loan-rates-responsibilities .overview-list {
  margin-top: 0.75rem;
}

/* Fade-in for cards as they appear */
@media (prefers-reduced-motion: no-preference) {
  .rate-card,
  .rate-graph-card,
  .visual-card {
    will-change: transform, opacity;
  }
}

/* Responsive */

@media (max-width: 1120px) {
  .rate-summary-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .rate-graph-card {
    grid-column: 1 / -1;
  }

  .rate-tables-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .rate-tables-grid > :last-child {
    grid-column: 1 / -1;
  }

  .visuals-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 840px) {
  .rate-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .rate-tables-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .rate-card,
  .rate-graph-card,
  .visual-card,
  .rate-table-block {
    transform: none;
    opacity: 1;
  }

  .ltv-graph-row,
  .rate-graph-row {
    transform: none;
    opacity: 1;
  }
}
