/* Loan Comparison Widget - CSS */

.loan-comparison-page {
  padding: 1rem;
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

.loan-comparison-widget {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0px 0px 19px 1px rgba(0, 0, 0, 0.09);
  overflow: hidden;
  overflow-x: hidden; /* Prevent horizontal overflow from any child elements */
  position: relative; /* Establish containing block for fixed children */
}

.loan-comparison-widget .hidden {
  opacity: 0;
  pointer-events: none;
  user-select: none;
  height: 0;
  width: 0;
  overflow: hidden;
  position: absolute;
  top: -9999px;
}
/* Header */

/* Personalized Message */
.personalized-message {
  background: linear-gradient(135deg, #00137d 0%, #0019a3 100%);
  color: #ffffff;
  padding: 24px 32px;
  margin: 0 0 24px 0;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 19, 125, 0.15);
  text-align: center;
  max-width: 1400px;
}

.personalized-message p {
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.6;
  margin: 0;
  letter-spacing: -0.01em;
}

@media (max-width: 768px) {
  .personalized-message {
    padding: 20px 24px;
    margin: 0 0 20px 0;
  }

  .personalized-message p {
    font-size: 1rem;
  }
}

/* .widget-header {
  background: linear-gradient(135deg, #00137d 0%, #2c5282 100%);
  color: white;
  padding: 30px 20px;
  text-align: center;
}

.widget-header h2 {
  font-size: 32px;
  margin-bottom: 8px;
  font-weight: 700;
}

.widget-subtitle {
  font-size: 16px;
  opacity: 0.95;
} */

/* Filters */
.widget-filters {
  padding: 24px;
  background-color: #f7fafc;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;

  gap: 20px;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  height: 100%;
}

.filters-row-1 {
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.filters-row-2 {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.filter-group {
  flex: 1;
  min-width: 180px;
}

.filter-group-features {
  flex: 3;
  min-width: 400px;
}

.filter-group-data {
  flex: 1;
  min-width: 200px;
}

.filter-group-slider {
  flex: 2;
  min-width: 300px;
}

.filter-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 12px;
}

.loan-comparison-widget .filter-select,
.loan-comparison-widget .sort-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Heebo', sans-serif;
  background-color: white;
  color: #1a202c;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.loan-comparison-widget .filter-select:hover,
.loan-comparison-widget .sort-select:hover {
  border-color: #00137d;
}

.loan-comparison-widget .filter-select:focus,
.loan-comparison-widget .sort-select:focus {
  outline: none;
  border-color: #00137d;
  box-shadow: 0 0 0 3px rgba(0, 19, 125, 0.1);
}

/* Feature Tags */
.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.feature-tag,
.feature-tag:focus {
  padding: 5px 12px;
  background-color: white;
  border: 2px solid #cbd5e0;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Heebo', sans-serif;
  color: #1a202c;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.feature-tag:hover {
  border-color: #00137d;
  background-color: #eff6ff;
}

.feature-tag.active {
  background: linear-gradient(135deg, #00137d 0%, #2c5282 100%);
  border-color: #00137d;
  color: white;
}

.feature-tag:active {
  transform: scale(0.95);
}

/* Dual Range Slider */
.dual-range-slider {
  position: relative;
  width: 100%;
  height: 30px;
  margin-top: 7px;
}

.slider-track-bg {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  z-index: 1;
}

.slider-track-fill {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  background: #00137d;
  border-radius: 3px;
  z-index: 2;
  pointer-events: none;
}

.amount-slider-handle {
  position: absolute;
  top: 65%;
  transform: translateY(-50%);
  width: 100%;
  height: 0; /* Remove default height */
  -webkit-appearance: none;
  pointer-events: none; /* Let clicks pass through track */
  background: none;
  z-index: 3;
  margin: 0;
}

/* Webkit Thumb */
.amount-slider-handle::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto; /* Re-enable pointer events for thumb */
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #00137d;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: grab;
  margin-top: -10px; /* Center vertiacally if needed, but transform handles it */
  position: relative;
  z-index: 4;
  transition: transform 0.1s ease;
}

.amount-slider-handle::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.amount-slider-handle::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

/* Firefox Thumb */
.amount-slider-handle::-moz-range-thumb {
  pointer-events: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #00137d;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  cursor: grab;
  z-index: 4;
  transition: transform 0.1s ease;
}

.amount-slider-handle::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.amount-slider-handle::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

/* Slider Values Display */
.slider-values-display {
  display: flex;
  justify-content: space-between;
  margin-top: 15px; /* Space below slider handles */
  padding-top: 25px;
}

.value-box {
  font-size: 13px;
  font-weight: 600;
  color: #2d3748;
  min-width: 80px;
  text-align: center;
}

.value-label {
  font-size: 11px;
  color: #4a5568;
  margin-left: 4px;
  font-weight: normal;
}

#minAmountDisplay,
#maxAmountDisplay {
  color: #00137d;
  font-weight: 700;
}

/* Mobile: larger touch target */
@media (max-width: 768px) {
  .amount-slider {
    height: 10px;
  }
  .amount-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    border-width: 4px;
  }
  .amount-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-width: 4px;
  }
}

/* .loan-comparison-widget .slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #718096;
  margin-top: 5px;
} */

.loan-comparison-widget .btn-reset {
  padding: 10px 24px;
  background-color: #718096;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Heebo', sans-serif;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  align-self: flex-end;
  height: 42px;
  flex-shrink: 0;
}

.loan-comparison-widget .btn-reset:hover {
  background-color: #2c5282;
}

/* Results Header */
.results-header {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.results-header-top {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.last-update-date {
  font-size: 12px !important;
  color: #718096;
  font-style: italic;
  text-align: right;
  padding: 4px 8px;
  position: absolute !important;
  top: 3px !important;
  left: 3px !important;
}

.results-header-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 16px;
}

.results-count {
  font-size: 15px;
  color: #4a5568;
}

.results-count strong {
  color: #00137d;
  font-weight: 700;
}

.results-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* View Toggle */
.view-toggle {
  display: flex;
  gap: 4px;
  background: #f3f4f6;
  padding: 4px;
  border-radius: 8px;
}

.view-toggle-btn {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

.view-toggle-btn.active {
  background: white;
  color: #00137d;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sort-select-compact {
  padding: 6px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Heebo', sans-serif;
  background-color: white;
  color: #1a202c;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 140px;
  max-width: 200px;
}

.sort-select-compact:hover {
  border-color: #00137d;
}

.sort-select-compact:focus {
  outline: none;
  border-color: #00137d;
  box-shadow: 0 0 0 3px rgba(0, 19, 125, 0.1);
}

.loan-comparison-widget .btn-reset-compact {
  padding: 6px 16px;
  border: 1px solid #718096;
  color: #718096;
  background: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Heebo', sans-serif;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.loan-comparison-widget .btn-reset-compact:hover {
  border: 1px solid rgb(30, 62, 100);
}

/* Loans Container */
.loans-container {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  transition: all 0.3s ease;
}

/* Slider View - Swiper Configuration */
.loans-container.slider-view {
  display: block !important;
  padding: 20px;
  position: relative;
  overflow: visible;
}

/* Initial server-rendered slider view (before Swiper initializes) */
.loans-container.slider-view .swiper-wrapper {
  display: flex;
  align-items: stretch;
  padding-bottom: 10px;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.loans-container.slider-view .swiper-wrapper {
  scrollbar-width: none; /* Firefox */
}

.loans-container.slider-view .swiper-wrapper::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

/* Server-rendered cards in slider mode (before Swiper) */
.loans-container.slider-view .swiper-slide {
  height: auto;
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  width: calc(33.333% - 14px); /* 3 cards visible */
  scroll-snap-align: start;
}

/* Swiper initialized - override server styles */
.loans-container.slider-view.swiper-initialized .swiper-wrapper {
  overflow-x: visible;
  scroll-snap-type: none;
  gap: 0;
}

.loans-container.slider-view.swiper-initialized .swiper-slide {
  width: auto; /* Swiper controls width */
}

.loans-container.slider-view .swiper-slide .loan-card {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
}

/* Swiper Navigation Buttons */
.loans-container.slider-view .loan-widget-swiper-button-next,
.loans-container.slider-view .loan-widget-swiper-button-prev {
  color: #2563eb;
  background: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.loans-container.slider-view .loan-widget-swiper-button-next {
  transform: translateX(-5px);
}
.loans-container.slider-view .loan-widget-swiper-button-prev {
  transform: translateX(5px);
}

.loans-container.slider-view .loan-widget-swiper-button-next:after,
.loans-container.slider-view .loan-widget-swiper-button-prev:after {
  font-size: 15px;
  font-weight: bold;
}

.loans-container.slider-view .loan-widget-swiper-button-next:hover,
.loans-container.slider-view .loan-widget-swiper-button-prev:hover {
  background: #2563eb;
  color: white;
}

/* Swiper Pagination */
.loans-container.slider-view .loan-widget-swiper-pagination {
  bottom: -10px;
}

.loans-container.slider-view
  .loan-widget-swiper-pagination
  .swiper-pagination-bullet {
  background: #cbd5e0;
  opacity: 1;
}

.loans-container.slider-view
  .loan-widget-swiper-pagination
  .swiper-pagination-bullet-active {
  background: #2563eb;
}

/* Loan Card */
.loan-card {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  will-change: transform, box-shadow;
}

.loan-card:hover {
  box-shadow: 0px 0px 19px 1px rgba(0, 0, 0, 0.09);
  transform: translateY(-4px);
  border-color: #bce0f7;
}

.loan-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.loan-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0;
}

.bank-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.header-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.bank-logo {
  max-width: 100px !important;
  max-height: 40px;
  object-fit: contain;
  object-position: right center;
  display: block;
}

.bank-info .hebrew-name {
  font-size: 11px;
  font-weight: 400;
  color: #757575;
  margin: 0;
}

.loan-purpose-badge {
  border: solid 1px #00137d;
  color: #00137d;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.loan-name-rating-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 15px;
}

/* H3 Title with reversed visual order using flexbox */
.loan-title {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 4px;
  flex: 1;
  margin: 0;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  margin-top: 8px;
}

/* Loan type text - appears below visually but first in DOM */
.loan-type-text {
  font-size: 13px;
  font-weight: 600;
  color: #1a202c;
  /* width: 20ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; */
  text-align: right;
}

/* Bank name text - appears above visually but second in DOM */
.bank-name-text {
  font-size: 11px;
  font-weight: 400;
  color: #757575;
  /* white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%; */
}

/* Hide the separator pipe visually but keep it in DOM for SEO */
.separator-pipe {
  display: none;
}

/* Legacy support - keep for backwards compatibility */
.loan-type {
  font-size: 13px !important;
  font-weight: 600;
  color: #1a202c;
  flex: 1;
}
.loan-card .loan-type {
  /* width: 20ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; */
  text-align: right;
}

.loan-details {
  margin-bottom: 15px;
}

.detail-row {
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

.detail-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  color: #4a5568;
  font-weight: 500;
  font-size: 12px;
  text-align: right;
}

.detail-value {
  color: #1a202c;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.2;
  text-align: right;
}

.interest-rate {
  color: #000000;
}

.loan-amount {
  color: #00137d;
}

.loan-card .loan-amount,
.loan-card .interest-rate {
  /* width: 16ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; */
}

.special-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 15px;
}

.special-features .feature-tag {
  background-color: #eff6ff;
  color: #00137d;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #bce0f7;
}

/* Card Actions */
.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.card-actions button {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Heebo', sans-serif;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Details Button - Lighter Style */
.btn-details {
  background: #e5e7eb;
  color: #4a5568;
  border: 1px solid #cbd5e0;
}

.btn-details:hover {
  background: #d1d5db;
  border-color: #9ca3af;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.btn-details:active {
  transform: translateY(0);
}

/* Eligibility Button - Deep Blue */
.btn-eligibility {
  background: linear-gradient(135deg, #00137d 0%, #2c5282 100%);
  color: white;
  will-change: transform, box-shadow;
}

.btn-eligibility:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 19, 125, 0.3);
}

.btn-eligibility:active {
  transform: translateY(0);
}

/* Loan Details - Hidden in cards for SEO */
.loan-details-content {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* Loan Details Sidebar */
.loan-details-sidebar {
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  pointer-events: none;
  overflow: hidden; /* Prevent horizontal overflow from hidden panel */
}

.loan-details-sidebar.active {
  pointer-events: auto;
}

.loan-details-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.loan-details-sidebar.active .loan-details-overlay {
  opacity: 1;
}

.loan-details-panel {
  position: absolute;
  top: 0;
  right: -600px; /* Start off-screen to the right */
  width: 100%;
  max-width: 600px;
  height: 100%;
  background: white;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  direction: rtl;
  will-change: right;
}

.loan-details-sidebar.active .loan-details-panel {
  right: 0; /* Slide to visible position */
}

.loan-details-close {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #718096;
  transition: all 0.2s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loan-details-close:hover {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}

.loan-details-scroll-content {
  flex: 1;
  overflow-y: auto;
  padding: 40px 32px 32px;
  text-align: right !important;
}

.loan-details-header {
  padding-bottom: 24px;
  border-bottom: 2px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.sidebar-bank-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.sidebar-bank-logo {
  max-width: 150px !important;
  max-height: 50px !important;
  object-fit: contain;
  object-position: right center;
}

.loan-details-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: #00137d;
  margin: 0;
  line-height: 1.2;
}

.sidebar-header-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.loan-details-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.loan-details-section h3 {
  font-size: 16px;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

.loan-details-section p {
  font-size: 14px;
  line-height: 1.7;
  color: #1a202c;
  margin: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-grid-item {
  background: #f7fafc;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-grid-label {
  font-size: 12px;
  font-weight: 600;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-grid-value {
  font-size: 20px;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.2;
}

.detail-grid-value.interest-rate {
  color: #38a169;
}

.detail-grid-value.loan-amount {
  color: #00137d;
}

.loan-details-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loan-details-list li {
  padding: 10px 12px;
  background: #f7fafc;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: #1a202c;
  position: relative;
  padding-right: 28px;
}

.loan-details-list li::before {
  content: '\2713'; /* Unicode for ✓ */
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #00137d;
  font-weight: bold;
}

.terms-list li::before {
  content: '\2022'; /* Unicode for • */
  color: #718096;
}

/* Sidebar Footer with Eligibility Button */
.sidebar-footer {
  padding: 24px 32px;
  padding-bottom: 0;
}

.btn-sidebar-eligibility {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, #00137d 0%, #2c5282 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Heebo', sans-serif;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 19, 125, 0.2);
}

.btn-sidebar-eligibility:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 19, 125, 0.35);
}

.btn-sidebar-eligibility:active {
  transform: translateY(0);
}

/* Mobile responsive - Bottom Sheet */
@media (max-width: 768px) {
  .loan-details-panel {
    top: auto;
    bottom: -100%;
    right: 0;
    left: 0;
    max-width: 100%;
    height: 85vh;
    max-height: 85vh;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .loan-details-sidebar.active .loan-details-panel {
    bottom: 0;
  }

  .loan-details-panel::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #cbd5e0;
    border-radius: 2px;
    z-index: 10;
  }

  .loan-details-close {
    top: 16px;
    left: 16px;
  }

  .loan-details-scroll-content {
    padding: 50px 20px 20px;
  }

  .sidebar-footer {
    padding: 16px 20px 24px;
    background: white;
    border-top: 1px solid #e5e7eb;
  }

  .loan-card .loan-amount,
  .loan-card .interest-rate {
    width: 13ch;
  }
}

.btn-source:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 19, 125, 0.3);
}

/* Loading & No Results */
.loan-comparison-widget .loading {
  text-align: center;
  padding: 60px 20px;
  color: #4a5568;
  font-size: 16px;
  width: 100%;
  grid-column: 1 / -1;
  height: 376px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Scroll Loading Indicator */
.loan-comparison-widget .scroll-loading {
  text-align: center;
  padding: 40px 20px;
  color: #4a5568;
  font-size: 14px;
  opacity: 0.5;
  transition: opacity 0.3s;
}

.loan-comparison-widget .loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 12px;
  border: 4px solid #e5e7eb;
  border-top-color: #00137d;
  border-radius: 50%;
  animation: loan-widget-spin 0.8s linear infinite;
}

@keyframes loan-widget-spin {
  to {
    transform: rotate(360deg);
  }
}

.loan-comparison-widget .scroll-loading p {
  margin: 0;
  font-weight: 500;
}

.loan-comparison-widget .no-results {
  text-align: center;
  padding: 60px 20px;
  grid-column: 1 / -1;
}

.loan-comparison-widget .no-results p {
  font-size: 18px;
  color: #4a5568;
  margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .widget-filters {
    padding: 16px;
  }

  .filters-row {
    flex-direction: column;
    gap: 12px;
  }

  .filters-row-1 {
    padding-bottom: 16px;
  }

  .filter-group,
  .filter-group-wide,
  .filter-group-slider,
  .filter-group-sort {
    width: 100%;
    min-width: 100%;
  }

  .btn-reset {
    width: 100%;
    height: auto;
  }

  .results-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .results-header-top {
    width: 100%;
  }

  .last-update-date {
    font-size: 10px !important;
    width: 100% !important;
    text-align: center !important ;
    left: 0 !important;
    top: 5px !important;
    padding: 3px 6px;
  }

  .results-header-bottom {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .results-controls {
    width: 100%;
    justify-content: space-between;
  }

  .sort-select-compact {
    flex: 1;
    min-width: 0;
  }

  .btn-reset-compact {
    flex-shrink: 0;
  }

  .loans-container {
    grid-template-columns: 1fr;
  }

  .widget-header h2 {
    font-size: 24px;
  }
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loan-card {
  animation: fadeIn 0.3s ease-in-out;
}
/* ========================================
   NEW FILTER ELEMENTS & VISUALIZATIONS
   ======================================== */

/* Checkbox Filters */
.checkbox-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.loan-comparison-widget .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #1a202c;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.loan-comparison-widget .checkbox-label:hover {
  color: #00137d;
}

.loan-comparison-widget .checkbox-label input[type='checkbox'] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #00137d;
}

/* Star Rating Display */
.star-rating-wrapper {
  position: relative;
  display: inline-block;
}

.star-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px 0;
  direction: ltr;
  cursor: help;
  text-align: left;
}

.loan-details-header .star-rating {
  direction: rtl;
}

.star {
  color: #cbd5e0;
  font-size: 16px;
  line-height: 1;
}

.star.filled {
  color: #fbbf24;
}

.star.half {
  color: #fbbf24;
  opacity: 0.5;
}

.rating-value {
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-inline-start: 4px;
}

.rating-info-icon {
  width: 16px !important;
  height: 16px !important;
  opacity: 0.6;
  cursor: help;
  margin-inline-start: 4px;
  transition: opacity 0.2s;
  vertical-align: middle;
}

.star-rating:hover .rating-info-icon {
  opacity: 1;
}

/* Rating Explanation Tooltip */
.rating-tooltip {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: 280px;
  max-width: 350px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  pointer-events: none;
  direction: rtl;
}

.loan-details-header .rating-tooltip {
  left: auto;
  right: 0;
}
.loan-details-header .tooltip-arrow {
  right: 20px;
}

.star-rating-wrapper:hover .rating-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tooltip-arrow {
  position: absolute;
  bottom: -6px;
  left: 20px;
  width: 12px;
  height: 12px;
  background: white;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  transform: rotate(45deg);
}
/* New Sidebar Structure */
.loan-details-body.new-structure {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.details-section .section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

.details-list-summary,
.details-list-simple,
.details-list-icons,
.details-list-check {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.details-list-summary li {
  font-size: 15px;
  color: #4a5568;
  background: #f7fafc;
  padding: 8px 12px;
  border-radius: 6px;
}

.details-list-summary li strong {
  color: #2d3748;
  margin-left: 4px;
}

.details-list-icons li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15px;
  color: #4a5568;
}

.details-list-icons .emoji {
  font-size: 18px;
  flex-shrink: 0;
}

.details-list-icons .label {
  font-weight: 600;
  color: #2d3748;
  min-width: 90px;
}

.details-list-check li {
  position: relative;
  padding-right: 24px;
  font-size: 15px;
  color: #4a5568;
}

.details-list-check li::before {
  content: '✓';
  position: absolute;
  right: 0;
  color: #38a169;
  font-weight: bold;
}

.legal-standard {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}

.legal-warning {
  font-size: 13px;
  margin-bottom: 4px;
}

.btn-sidebar-eligibility {
  display: block;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #00137d 0%, #2c5282 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
}

.btn-sidebar-eligibility:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 19, 125, 0.4);
}
.tooltip-line {
  font-size: 13px;
  line-height: 1.6;
  color: #374151;
  margin: 6px 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.tooltip-line:first-child {
  margin-top: 0;
}

.tooltip-line:last-child {
  margin-bottom: 0;
}

/* Low Credit Badge */
.low-credit-badge {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid #10b981;
  color: #10b981;
  font-size: 10px;
  font-weight: 600;
  border-radius: 20px;
  white-space: nowrap;
}

/* Additional filters row for full-page version */
.filters-row-3 {
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}
/* ========================================
   NEW COMPACT FILTER BAR (V2 UI)
   ======================================== */

.filter-bar-compact {
  background: white;
  padding: 20px;
  border-radius: 12px 12px 0 0;
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
  border-bottom: 1px solid #e5e7eb;
}

.credit-history-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Low Credit Score Toggle Button */
.low-credit-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: none;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s;
  max-width: 200px;
}

.low-credit-toggle-btn:hover {
  border-color: #9ca3af;
}

.low-credit-toggle-btn.active {
  background: #00137d;
  color: white;
  border-color: #00137d;
  box-shadow: 0 2px 4px rgba(0, 19, 125, 0.3);
}

.low-credit-toggle-btn .toggle-icon {
  font-size: 18px;
  line-height: 1;
  font-weight: bold;
}

.low-credit-toggle-btn.active .toggle-icon::before {
  content: '\2611'; /* Unicode for ☑ */
}

.low-credit-toggle-btn:not(.active) .toggle-icon::before {
  content: '\2610'; /* Unicode for ☐ */
}

.filter-group-inline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
  flex: 1;
}

.filter-group-inline label {
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
  text-align: right;
}

.loan-comparison-widget .slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.loan-comparison-widget .amount-slider-compact {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  outline: none;
  -webkit-appearance: none;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

.loan-comparison-widget .amount-slider-compact::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #00137d;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 19, 125, 0.3);
  border: 3px solid white;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.loan-comparison-widget .amount-slider-compact::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 6px rgba(0, 19, 125, 0.4);
}

.loan-comparison-widget .amount-slider-compact::-webkit-slider-thumb:active {
  transform: scale(1.1);
  transition: none;
}

.loan-comparison-widget .amount-slider-compact::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #00137d;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 4px rgba(0, 19, 125, 0.3);
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.loan-comparison-widget .amount-slider-compact::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 6px rgba(0, 19, 125, 0.4);
}

.loan-comparison-widget .amount-slider-compact::-moz-range-thumb:active {
  transform: scale(1.1);
  transition: none;
}

@media (max-width: 768px) {
  .loan-comparison-widget {
    padding-top: 10px;
  }
  .loan-comparison-widget .amount-slider-compact {
    height: 8px;
  }
  .loan-comparison-widget .amount-slider-compact::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
    border-width: 4px;
  }
  .loan-comparison-widget .amount-slider-compact::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-width: 4px;
  }
}

.loan-comparison-widget .slider-value-display {
  font-size: 16px;
  font-weight: 600;
  color: #00137d;
  min-width: 85px;
  text-align: left;
}

.filter-select-icons {
  padding: 10px 10px 10px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #1a202c;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%234a5568' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.filter-select-icons:hover {
  border-color: #00137d;
}

.filter-select-icons:focus {
  outline: none;
  border-color: #00137d;
  box-shadow: 0 0 0 3px rgba(0, 19, 125, 0.1);
}

.loan-comparison-widget .btn-advanced-toggle {
  padding: 10px 20px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: #00137d;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.loan-comparison-widget .btn-advanced-toggle:hover {
  background: #f7fafc;
  border-color: #00137d;
}

.loan-comparison-widget .btn-advanced-toggle.active {
  background: #00137d;
  color: white;
  border-color: #00137d;
}

.loan-comparison-widget .btn-advanced-toggle.active .toggle-icon {
  transform: rotate(180deg);
}

.loan-comparison-widget .toggle-icon {
  transition: transform 0.3s;
}

.loan-comparison-widget .advanced-filters-section {
  background: white;
  padding: 0 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  gap: 20px;
  height: 0;
  min-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, height 0.3s ease, padding 0.3s ease, min-height 0.3s ease;
  will-change: height, opacity;
}

.advanced-filters-section.expanded {
  height: auto;
  min-height: 120px;
  opacity: 1;
  padding: 20px;
  overflow: visible;
}

.filter-group-advanced {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 70%;
  min-width: 30%;
}

.filter-group-advanced > label {
  font-size: 14px;
  font-weight: 600;
  color: #1a202c;
}

.bank-multiselect-wrapper {
  position: relative;
}

.bank-multiselect-btn {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: #1a202c;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.bank-multiselect-btn:hover {
  border-color: #00137d;
}

.bank-multiselect-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 100;
  max-height: 300px;
  overflow: hidden;
}

.bank-multiselect-search {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
  z-index: 10;
}

.bank-multiselect-search input {
  width: 90%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
}

.bank-multiselect-options {
  max-height: 220px;
  overflow-y: auto;
}

.bank-option {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.bank-option:hover {
  background: #f7fafc;
}

.bank-option input[type='checkbox'] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #00137d;
}

.bank-option label {
  cursor: pointer;
  flex: 1;
  font-size: 14px;
  color: #1a202c;
}

.loan-comparison-widget .checkbox-label-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.loan-comparison-widget .checkbox-label-inline input[type='checkbox'] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #00137d;
}

.loan-comparison-widget .checkbox-label-inline span {
  font-size: 14px;
  color: #1a202c;
}

@media (max-width: 768px) {
  .filter-bar-compact {
    flex-direction: column;
    align-items: stretch;
  }

  /* Mobile: show 1 card at a time in slider */
  .loans-container.slider-view .swiper-slide {
    width: calc(100% - 40px);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  /* Tablet: show 2 cards in slider */
  .loans-container.slider-view .swiper-slide {
    width: calc(50% - 10px);
  }

  .filter-group-inline,
  .filter-group-advanced {
    min-width: 100%;
  }

  .advanced-filters-section {
    flex-direction: column;
    text-align: center;
    justify-content: center;
    align-items: center;
  }
  .credit-history-toggle button {
    min-width: 100%;
    text-align: center;
  }

  .filter-group-inline:has(label[for='loanAmountSlider']) {
    order: -1;
  }
}

/* ========================================
   RATING METHODOLOGY BUTTON
   ======================================== */

.rating-methodology-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 24px auto 0;
  padding: 0 20px;
  display: flex;
  justify-content: center;
}

.btn-rating-methodology {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  background: linear-gradient(135deg, #00137d 0%, #2c5282 100%);
  color: white;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Heebo', sans-serif;
  text-decoration: none;
  border-radius: 50px;
  box-shadow: 0 4px 12px rgba(0, 19, 125, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
}

.btn-rating-methodology:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 19, 125, 0.35);
  text-decoration: none;
  color: white;
}

.btn-rating-methodology:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .rating-methodology-wrapper {
    margin: 20px auto 0;
    padding: 0 16px;
  }

  .btn-rating-methodology {
    width: 100%;
    padding: 12px 24px;
    font-size: 15px;
  }
}

/* ========================================
   iOS Safari Performance Optimizations
   Fixes blank white spaces during scroll
   ======================================== */

/* Force hardware acceleration for scrolling containers */
.loans-container,
.loans-container.slider-view .swiper-wrapper {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-perspective: 1000;
  perspective: 1000;
}

/* Force hardware acceleration for individual cards */
.loan-card,
.loans-container.slider-view .swiper-slide {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
}

/* Optimize card hover animation for iOS */
.loan-card:hover {
  -webkit-transform: translateZ(0) translateY(-4px);
  transform: translateZ(0) translateY(-4px);
}

/* Ensure smooth scrolling on iOS */
.loans-container.slider-view .swiper-wrapper {
  -webkit-overflow-scrolling: touch;
}

/* Additional mobile performance optimizations */
@media (max-width: 768px) {
  /* Improve touch performance */
  .loan-card,
  button,
  .feature-tag,
  .btn-details,
  .btn-eligibility {
    touch-action: manipulation;
  }

  /* Reduce paint complexity on mobile */
  .loan-comparison-widget {
    contain: layout style paint;
  }

  /* Optimize scrolling performance */
  .loans-container {
    contain: layout style;
  }

  /* Reduce repaints during filtering */
  .filter-bar-compact,
  .advanced-filters-section {
    contain: layout style;
  }
}