/* ROI Calculator Frontend Styles */

/* Reset and Base Styles */
.roi-calculator-wrapper * {
  box-sizing: border-box;
}

/* Main Calculator Container */
.roi-calculator {
  max-width: 800px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Calculator Header */
.calculator-header {
  background: linear-gradient(135deg, #3c767a 0%, #1A6066 100%);
  color: white;
  padding: 2rem;
  text-align: center;
}

.calculator-header h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.75rem;
  font-weight: 600;
}

.calculator-description {
  margin: 0;
  opacity: 0.9;
  line-height: 1.5;
}

/* Form Sections */
.form-sections {
  padding: 2rem;
}

.form-section {
  margin-bottom: 2.5rem;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section h4 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #2c3e50;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 0.5rem;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.product-option {
  position: relative;
}

.product-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  z-index: -1;
}

.product-card {
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  position: relative;
}

.product-card:hover {
  border-color: #667eea;
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.product-option input[type="radio"]:checked + label .product-card {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.product-card h5 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #2c3e50;
}

.product-card .price {
  font-size: 1.25rem;
  font-weight: 700;
  color: #667eea;
  margin: 0;
}

.featured-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #f39c12;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Form Grid and Groups */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.95rem;
}

.form-group input,
.form-group select {
  padding: 0.75rem;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group small {
  margin-top: 0.25rem;
  color: #6c757d;
  font-size: 0.85rem;
}

/* Range Input Styles */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #e9ecef;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #667eea;
  border-radius: 50%;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #667eea;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.range-display {
  text-align: center;
  margin: 0.5rem 0;
  font-weight: 600;
}

.range-value {
  font-size: 1.25rem;
  color: #667eea;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #6c757d;
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  font-weight: normal;
  margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
  margin-right: 0.5rem;
  width: auto;
}

/* Form Actions */
.form-actions {
  padding: 0 2rem 2rem 2rem;
  text-align: center;
}

.calculate-button {
  background: linear-gradient(135deg, #3c767a 0%, #1A6066 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 200px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calculate-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.calculate-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #ffffff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
  margin-left: 0.5rem;
}

.calculate-button.loading .loading-spinner {
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Results Container */
.calculation-results {
  margin-top: 2rem;
  padding: 2rem;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.results-container {
  max-width: 100%;
}

.results-header h3 {
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
  color: #2c3e50;
  text-align: center;
}

/* Insights */
.insights {
  margin: 1rem 0;
  text-align: center;
}

.insight {
  background: #d4edda;
  color: #155724;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  border-radius: 6px;
  border-left: 4px solid #28a745;
  font-weight: 500;
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.result-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #e9ecef;
  transition: transform 0.2s ease;
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.result-card.highlight {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.result-card h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-value {
  font-size: 2rem;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1;
}

.result-unit {
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

.result-card.environmental .result-value {
  color: #28a745;
}

/* Environmental Section */
.environmental-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: white;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.environmental-section h4 {
  margin: 0 0 1rem 0;
  color: #28a745;
  text-align: center;
}

.environmental-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.env-stat {
  text-align: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.env-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #28a745;
}

.env-label {
  display: block;
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

/* Breakdown Tables */
.results-breakdown {
  margin: 2rem 0;
}

.results-breakdown h4 {
  margin: 0 0 1rem 0;
  text-align: center;
  color: #2c3e50;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.breakdown-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e9ecef;
}

.breakdown-table tr:last-child td {
  border-bottom: none;
}

.breakdown-table tr.total td {
  background: #f8f9fa;
  font-weight: 600;
}

.breakdown-table tr.savings td {
  background: #d4edda;
  color: #155724;
}

.breakdown-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.breakdown-side h5 {
  margin: 0 0 1rem 0;
  text-align: center;
  color: #2c3e50;
}

/* Comparison Calculator Specific */
.comparison-sections {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 2rem;
  align-items: start;
  margin: 2rem 0;
}

.comparison-side h4 {
  text-align: center;
  margin-bottom: 1rem;
}

.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.vs-divider span {
  background: #667eea;
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
}

.product-selection {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 1rem;
}

.product-checkbox,
.product-radio {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  margin: 0.5rem 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.product-checkbox:hover,
.product-radio:hover {
  background: #f8f9fa;
}

.product-checkbox input[type="checkbox"],
.product-radio input[type="radio"] {
  margin-right: 0.75rem;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid #e9ecef;
  border-radius: 4px;
  margin-right: 0.75rem;
  position: relative;
  transition: all 0.2s ease;
}

/* Radio button styling */
.product-radio .checkmark {
  border-radius: 50%;
}

.product-checkbox input[type="checkbox"]:checked + .checkmark,
.product-radio input[type="radio"]:checked + .checkmark {
  background: #667eea;
  border-color: #667eea;
}

.product-checkbox input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
}

.product-info {
  flex: 1;
}

.product-info strong {
  display: block;
  color: #2c3e50;
  margin-bottom: 0.25rem;
}

.product-info .price {
  color: #667eea;
  font-weight: 600;
}

.product-info .category {
  display: block;
  color: #6c757d;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tabbed Interface */
.tabbed-interface {
  margin: 1rem 0;
}

.tab-nav {
  display: flex;
  border-bottom: 2px solid #e9ecef;
  margin-bottom: 1rem;
}

.tab-button {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  color: #6c757d;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-button:hover {
  color: #667eea;
}

.tab-button.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Error Messages */
.error-message {
  background: #f8d7da;
  color: #721c24;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid #f5c6cb;
  margin: 1rem 0;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .roi-calculator {
    margin: 1rem;
    border-radius: 8px;
  }
  
  .calculator-header {
    padding: 1.5rem;
  }
  
  .form-sections {
    padding: 1.5rem;
  }
  
  .product-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .results-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  
  .breakdown-comparison {
    grid-template-columns: 1fr;
  }
  
  .comparison-sections {
    grid-template-columns: 1fr;
  }
  
  .vs-divider {
    min-height: auto;
    padding: 1rem 0;
  }
  
  .vs-divider span {
    transform: rotate(90deg);
  }
}

@media (max-width: 480px) {
  .calculator-header h3 {
    font-size: 1.5rem;
  }
  
  .result-value {
    font-size: 1.5rem;
  }
  
  .calculate-button {
    width: 100%;
    min-width: auto;
  }
  
  .environmental-stats {
    grid-template-columns: 1fr;
  }
}

/* Comparison Results Styles */
.comparison-results-container {
  padding: 2rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin-top: 2rem;
}

.comparison-header h3 {
  margin: 0 0 1rem 0;
  color: #333;
}

.comparison-summary {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 2rem;
  font-weight: 500;
}

.savings-positive {
  background: #d4edda;
  color: #155724;
  padding: 1rem;
  border-radius: 6px;
  display: block;
}

.savings-negative {
  background: #f8d7da;
  color: #721c24;
  padding: 1rem;
  border-radius: 6px;
  display: block;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
}

.comparison-table th,
.comparison-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
}

.comparison-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #495057;
}

.comparison-table .total-row {
  background: #f8f9fa;
  font-weight: 600;
}

.savings-breakdown {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  border-left: 4px solid #28a745;
}

.savings-breakdown h4 {
  margin: 0 0 1rem 0;
  color: #28a745;
}

.savings-breakdown ul {
  margin: 0;
  padding-left: 1.5rem;
}

.savings-breakdown li {
  margin-bottom: 0.5rem;
}

.comparison-actions {
  text-align: center;
}

.comparison-actions .button {
  margin: 0 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.comparison-actions .save-results-btn {
  background: #667eea;
  color: white;
}

.comparison-actions .share-results-btn {
  background: #6c757d;
  color: white;
}