/* Mortgage Rate Finder - logo color scheme */
:root {
  --mrf-primary: #C22329;
  --mrf-secondary: #707070;
  --mrf-bg-light: #F9F9F9;
}
.mrf-navbar {
  background-color: #F9F9F9 !important;
}
.mrf-nav-icon {
  color: var(--mrf-secondary) !important;
}
.mrf-nav-icon:hover {
  color: var(--mrf-primary) !important;
}
.btn-primary {
  background-color: var(--mrf-primary);
  border-color: var(--mrf-primary);
}
.btn-primary:hover {
  background-color: #a01d22;
  border-color: #a01d22;
}
.btn-outline-primary {
  color: var(--mrf-primary);
  border-color: var(--mrf-primary);
}
.btn-outline-primary:hover {
  background-color: var(--mrf-primary);
  border-color: var(--mrf-primary);
  color: white;
}
.text-primary, .nav-link.text-white:hover {
  color: var(--mrf-primary) !important;
}
#calc-cost.cost-clickable:hover {
  color: var(--mrf-primary) !important;
}
.history-error-cell:hover {
  color: var(--mrf-primary) !important;
}
.border-success, .text-success {
  --bs-success: #198754;
}
body {
  background-color: white;
  display: flex;
  min-height: 100vh;
  margin: 0;
}
/* Mobile top bar - visible only on small screens */
.mrf-mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  background-color: #F9F9F9;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 0 1rem;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 1030;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.mrf-topbar-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.mrf-topbar-logo img {
  display: block;
  height: 52px;
  width: auto;
}
.mrf-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.mrf-topbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  color: var(--mrf-secondary) !important;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.mrf-topbar-btn i {
  font-size: 2rem;
}
.mrf-topbar-btn:hover {
  color: var(--mrf-primary) !important;
  background-color: rgba(194, 35, 41, 0.08);
}

/* Desktop sidebar - hidden on mobile */
.mrf-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 80px;
  background-color: #F9F9F9;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}
.mrf-sidebar-logo {
  display: block;
  margin-bottom: 1rem;
  flex-shrink: 0;
}
.mrf-sidebar-logo img {
  display: block;
}
.mrf-sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 8px;
  color: var(--mrf-secondary) !important;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.mrf-sidebar-btn:hover {
  color: var(--mrf-primary) !important;
  background-color: rgba(194, 35, 41, 0.08);
}
.mrf-sidebar-btn + .mrf-sidebar-btn {
  margin-top: 0.25rem;
}
.mrf-main {
  flex: 1;
  min-width: 0;
  margin-left: 80px;
  overflow-x: hidden;
}

@media (max-width: 767px) {
  .mrf-mobile-topbar {
    display: flex;
  }
  .mrf-sidebar {
    display: none;
  }
  .mrf-main {
    margin-left: 0;
    padding-top: calc(72px + env(safe-area-inset-top));
  }
}

/* Rate Trends chart */
.mrf-chart-container {
  width: 100%;
}
.mrf-chart-wrapper {
  height: 320px;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.mrf-chart-wrapper canvas {
  display: block;
}
.mrf-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.mrf-legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 2rem;
  background: #fff;
  font-size: 0.85rem;
  color: var(--mrf-secondary);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s;
}
.mrf-legend-pill:hover {
  background-color: #F9F9F9;
  border-color: rgba(0, 0, 0, 0.2);
}
.mrf-legend-pill.active {
  border-color: rgba(0, 0, 0, 0.2);
  background-color: #F9F9F9;
}
.mrf-legend-pill:not(.active) {
  opacity: 0.5;
}
.mrf-legend-pill:not(.active):hover {
  opacity: 0.75;
}
.mrf-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mrf-legend-label {
  white-space: nowrap;
}

.card-header {
  font-weight: 600;
}
#lowest-rate {
  font-size: 2.5rem;
}
.table {
  font-size: 0.9rem;
}
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover {
  background-color: rgba(0, 0, 0, 0.05);
}
th.sortable::after {
  content: '\00a0↕';
  opacity: 0.4;
  font-size: 0.75em;
}
th.sortable.sort-asc::after {
  content: '\00a0↑';
  opacity: 1;
}
th.sortable.sort-desc::after {
  content: '\00a0↓';
  opacity: 1;
}
.form-control-inline {
  display: inline-block;
}
#calc-cost.cost-clickable {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.card .card-header h6 {
  font-weight: 600;
}
/* Top filters */
.mrf-filters-card .mrf-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.mrf-filters-card .mrf-filter-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--mrf-secondary);
  margin-bottom: 0;
}
.mrf-filters-card .mrf-filter-input {
  min-width: 0;
}
.mrf-filters-card #top-filter-lender {
  min-width: 140px;
}
.mrf-filters-card #top-filter-points {
  width: 5.5em;
}
.mrf-filters-card #top-filter-cashout {
  width: 7em;
}
.mrf-filters-card #add-cost-to-loan {
  min-width: 90px;
}
/* Rate history table - date column no wrap */
.mrf-date-col {
  white-space: nowrap;
}
.history-start-col {
  min-width: 11em;
  white-space: nowrap;
}
.history-error-cell {
  max-width: 200px;
  cursor: pointer;
}
.history-error-cell:hover {
  text-decoration: underline;
  color: var(--mrf-primary);
}
