/**
 * Form Styles - Multi-step form and product cards
 */

/* Form Container */
.form-container {
  max-width: 700px;
  margin: 0 auto;
  padding: var(--spacing-lg) 0;
  width: 100%;
  overflow-x: hidden;
}

/* Progress Indicator */
.progress-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-xl);
  position: relative;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-color);
  z-index: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
  flex: 1;
}

.progress-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-white);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  transition: all 0.3s;
}

.progress-step.active .progress-circle {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.progress-step.completed .progress-circle {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.progress-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-align: center;
}

.progress-step.active .progress-label {
  color: var(--primary-color);
  font-weight: 600;
}

/* Form Steps */
.form-step {
  display: none;
}

.form-step.active {
  display: block;
  animation: fadeIn 0.3s;
}

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

/* Form Groups */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  color: var(--text-primary);
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.75rem;
  font-size: var(--font-size-base);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s;
  min-height: 44px;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input.error,
.form-select.error {
  border-color: var(--error-color);
}

.form-error {
  color: var(--error-color);
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-xs);
  display: none;
}

.form-error.visible {
  display: block;
}

.form-help {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--spacing-xs);
}

/* Range Slider */
.range-slider {
  width: 100%;
  margin: var(--spacing-md) 0;
}

.range-input {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-lg);
  background: var(--border-color);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.range-input::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.range-input::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-md);
}

.range-value {
  text-align: center;
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--primary-color);
  margin: var(--spacing-sm) 0;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-xl);
}

.form-actions .btn {
  flex: 1;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Product Card */
.product-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  transition: all 0.2s;
  cursor: pointer;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.product-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.product-header {
  display: flex;
  align-items: center;
  margin-bottom: var(--spacing-md);
}

.product-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-right: var(--spacing-sm);
}

.product-name {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
}

.product-details {
  margin-bottom: var(--spacing-md);
}

.product-detail {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-xs) 0;
  border-bottom: 1px solid var(--border-color);
}

.product-detail:last-child {
  border-bottom: none;
}

.detail-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.detail-value {
  font-weight: 600;
  color: var(--text-primary);
}

.product-rate {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--primary-color);
  text-align: center;
  margin: var(--spacing-md) 0;
}

/* Responsive */
@media (max-width: 768px) {
  .product-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
  }
  
  .form-actions {
    flex-direction: column-reverse;
  }
  
  .progress-bar {
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .progress-label {
    font-size: 0.75rem;
  }
  
  .progress-circle {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-sm);
  }
  
  .card {
    padding: 1.5rem 1rem;
  }
  
  .form-container {
    padding: 2rem 0;
  }
  
  .container-sm {
    padding: 0 1rem;
  }
  
  .product-card {
    padding: 1rem;
  }
  
  .product-name {
    font-size: 1rem;
  }
  
  .product-rate {
    font-size: 1.25rem;
  }
}

/* Product Comparison Cards - Step 3 */
.form-step #productsContainer > div {
  min-width: 0; /* Prevent grid overflow */
}

.form-step #productsContainer > div > div[style*="grid-template-columns"] {
  display: grid !important;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr !important;
  gap: 1.5rem !important;
  align-items: center !important;
}

/* Responsive adjustments for product cards */
@media (max-width: 1400px) {
  .form-step #productsContainer > div > div[style*="grid-template-columns"] {
    grid-template-columns: 2fr 0.8fr 0.8fr 0.8fr 1fr !important;
    gap: 1rem !important;
  }
  
  .form-step #productsContainer > div {
    padding: 2rem 1.5rem !important;
  }
}

@media (max-width: 1200px) {
  .form-step #productsContainer > div > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 1rem !important;
  }
  
  .form-step #productsContainer > div {
    padding: 1.5rem !important;
  }
  
  /* Hide feature bullets on tablet */
  .form-step #productsContainer > div > div > div:first-child > div:last-child {
    display: none !important;
  }
}

@media (max-width: 768px) {
  /* Full width container on mobile */
  .form-container {
    max-width: 100% !important;
    padding: 1rem 0 !important;
  }
  
  .container-sm {
    max-width: 100% !important;
    padding: 0 0.75rem !important;
  }
  
  /* Loan Calculator - Step 1 Mobile */
  #loanCalculator {
    padding: 1.5rem 1rem !important;
    margin-bottom: 1.5rem !important;
  }
  
  #loanCalculator h3 {
    font-size: 1.25rem !important;
  }
  
  #loanCalculator p {
    font-size: 0.875rem !important;
  }
  
  /* Make calculator single column on mobile */
  #loanCalculator > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  
  /* Adjust input fields */
  #loanCalculator input[type="text"],
  #loanCalculator input[type="number"] {
    font-size: 1rem !important;
    padding: 0.75rem 1rem 0.75rem 2rem !important;
  }
  
  /* Adjust result cards */
  #loanCalculator #monthlyPayment {
    font-size: 2.5rem !important;
  }
  
  /* Full width button in calculator */
  #loanCalculator button {
    width: 100% !important;
    padding: 1rem !important;
  }
  
  /* Single column layout */
  .form-step #productsContainer > div > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }
  
  /* Adjust card padding */
  .form-step #productsContainer > div {
    padding: 1.5rem 1rem !important;
    border-radius: 12px !important;
  }
  
  /* Center all content on mobile */
  .form-step #productsContainer > div > div > div {
    text-align: center !important;
  }
  
  /* Keep description left-aligned */
  .form-step #productsContainer > div > div > div:first-child {
    text-align: left !important;
  }
  
  /* Adjust font sizes for mobile */
  .form-step #productsContainer > div > div > div:first-child h4 {
    font-size: 1.25rem !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
  }
  
  .form-step #productsContainer > div > div > div:first-child p {
    font-size: 0.875rem !important;
  }
  
  /* Hide feature bullets on mobile */
  .form-step #productsContainer > div > div > div:first-child > div:last-child {
    display: none !important;
  }
  
  /* Adjust stat cards */
  .form-step #productsContainer > div > div > div[style*="padding: 1.5rem"] {
    padding: 1rem !important;
  }
  
  /* Make buttons full width */
  .form-step #productsContainer > div > div > div:last-child {
    width: 100% !important;
  }
  
  .form-step #productsContainer > div > div > div:last-child button {
    width: 100% !important;
    padding: 1rem 1.5rem !important;
  }
  
  /* Hide "Top Pick" badge on mobile */
  .form-step #productsContainer > div > div[style*="position: absolute"] {
    top: 10px !important;
    right: 10px !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 0.625rem !important;
  }
  
  /* Adjust review counts */
  .form-step #productsContainer > div > div > div:first-child > div:nth-child(2) {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.25rem !important;
  }
  
  .form-step #productsContainer > div > div > div:first-child > div:nth-child(2) > span:nth-child(2) {
    display: none !important; /* Hide separator */
  }
}

/* Ensure container doesn't overflow */
.form-container {
  max-width: 1400px !important;
  margin: 0 auto;
}

.container-sm {
  max-width: 1400px !important;
}
