/**
 * SolarPlus Calculator — Stylesheet
 * Based on SolarPlus Style Guide
 *
 * Colors:
 *   CTA:        #FF3B30  (Primary Action — red)
 *   Accent:     #FF7A00  (Secondary — orange highlights)
 *   Trust:      #2D6A4F  (Green — eco/certification)
 *   Text:       #1A1A1A  (Primary)
 *   Text Sec:   #6B7280  (Secondary)
 *   Border:     #E0E0E0
 *   Bg Soft:    #F5F5F5
 *   White:      #FFFFFF
 *
 * Typography:
 *   Headings:   Manrope 600–800
 *   Body:       Inter 400–500
 *
 * Border Radius: 8px (consistent)
 * Spacing Base:  8px
 */

/* ========================================================
 * RESET & BASE
 * ======================================================== */
.sp-calc,
.sp-calc * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.sp-calc {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  max-width: 540px;
  margin: 0 auto;
  padding: 32px 24px;
  background: #FFFFFF;
  color: #1A1A1A;
  line-height: 1.6;
}

/* ========================================================
 * SCREEN STATES
 * ======================================================== */
.sp-screen {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sp-screen.active {
  display: block;
  opacity: 1;
}

/* ========================================================
 * TYPOGRAPHY
 * ======================================================== */
.sp-title {
  font-family: 'Manrope', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #1A1A1A;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 8px;
}

.sp-sub {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #6B7280;
  line-height: 1.65;
  margin-bottom: 28px;
}

/* ========================================================
 * TOGGLE — Residential / Commercial
 * ======================================================== */
.sp-toggle {
  display: flex;
  background: #F5F5F5;
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 24px;
}

.sp-calc .sp-toggle-btn {
  flex: 1 !important;
  padding: 12px 8px !important;
  border: none !important;
  background: #FFFFFF !important;
  border-radius: 6px !important;
  font-family: 'Manrope', sans-serif !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  color: #1A1A1A !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: none !important;
  text-decoration: none !important;
  text-transform: none !important;
  line-height: 1.4 !important;
  outline: none !important;
}

.sp-calc .sp-toggle-btn:hover,
.sp-calc .sp-toggle-btn:focus,
.sp-calc .sp-toggle-btn:visited {
  background: #FFFFFF !important;
  color: #1A1A1A !important;
  border: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
  outline: none !important;
}

.sp-calc .sp-toggle-btn.active,
.sp-calc .sp-toggle-btn.active:hover,
.sp-calc .sp-toggle-btn.active:focus {
  background: #FF3B30 !important;
  color: #FFFFFF !important;
  border: none !important;
  box-shadow: none !important;
}

.sp-calc .sp-toggle-btn:hover,
.sp-calc .sp-toggle-btn:focus,
.sp-calc .sp-toggle-btn:active {
  background: #FFFFFF !important;
  color: #1A1A1A !important;
  box-shadow: none !important;
  border: none !important;
  outline: none !important;
}

.sp-calc .sp-toggle-btn.active:hover,
.sp-calc .sp-toggle-btn.active:focus,
.sp-calc .sp-toggle-btn.active:active {
  background: #FF3B30 !important;
  color: #FFFFFF !important;
  box-shadow: none !important;
  border: none !important;
}

/* ========================================================
 * FORM FIELDS
 * ======================================================== */
.sp-field {
  margin-bottom: 20px;
}

.sp-label {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #1A1A1A;
  margin-bottom: 6px;
  display: block;
}

.sp-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #1A1A1A;
  background: #FFFFFF;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  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='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.sp-select:focus {
  border-color: #1A1A1A;
}

.sp-input-wrap {
  position: relative;
}

.sp-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #6B7280;
  pointer-events: none;
}

.sp-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #6B7280;
  pointer-events: none;
}

.sp-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #1A1A1A;
  background: #FFFFFF;
  outline: none;
  transition: border-color 0.2s ease;
  -moz-appearance: textfield;
}

.sp-input.has-prefix {
  padding-left: 40px;
}

.sp-input.has-suffix {
  padding-right: 52px;
}

.sp-input::-webkit-outer-spin-button,
.sp-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sp-input:focus {
  border-color: #1A1A1A;
}

.sp-input::placeholder {
  color: #9CA3AF;
  font-weight: 400;
}

/* Error messages */
.sp-error {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #FF3B30;
  margin-top: 6px;
  display: none;
  line-height: 1.5;
}

/* ========================================================
 * CALCULATE BUTTON
 * ======================================================== */
.sp-calc-btn {
  width: 100%;
  padding: 16px 24px;
  background: #FF3B30;
  border: none;
  border-radius: 8px;
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #FFFFFF;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin-top: 8px;
}

.sp-calc-btn:hover {
  background: #E0352B;
}

.sp-calc-btn:disabled {
  background: #F5F5F5;
  color: #9CA3AF;
  cursor: not-allowed;
}

/* ========================================================
 * LOADING SCREEN
 * ======================================================== */
.sp-loading-wrap {
  text-align: center;
  padding: 48px 0;
}

.sp-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #E0E0E0;
  border-top-color: #FF3B30;
  border-radius: 50%;
  animation: sp-spin 0.9s linear infinite;
  margin: 0 auto 28px;
}

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

.sp-loading-title {
  font-family: 'Manrope', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #1A1A1A;
  margin-bottom: 24px;
}

.sp-checklist {
  list-style: none;
  text-align: left;
  max-width: 300px;
  margin: 0 auto;
}

.sp-checklist li {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #9CA3AF;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.sp-checklist li.sp-visible {
  opacity: 1;
  color: #1A1A1A;
}

.sp-checklist li.sp-done {
  opacity: 1;
  color: #2D6A4F;
}

.sp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #E0E0E0;
  flex-shrink: 0;
  transition: background-color 0.3s ease;
}

.sp-checklist li.sp-visible .sp-dot {
  background: #FF7A00;
}

.sp-checklist li.sp-done .sp-dot {
  background: #2D6A4F;
}

/* ========================================================
 * RESULTS SCREEN
 * ======================================================== */
.sp-results-header {
  margin-bottom: 24px;
}

.sp-results-title {
  font-family: 'Manrope', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #1A1A1A;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 6px;
}

.sp-results-sub {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #6B7280;
  line-height: 1.6;
}

/* Meter type warning */
.sp-meter-warning {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: #92400E;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  line-height: 1.6;
  display: none;
}

/* ========================================================
 * PRIMARY CARDS — 2×2 grid
 * ======================================================== */
.sp-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.sp-card {
  background: #F5F5F5;
  border-radius: 8px;
  padding: 18px 16px;
}

.sp-card-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6B7280;
  margin-bottom: 8px;
}

.sp-card-value {
  font-family: 'Manrope', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #1A1A1A;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.sp-card-value.accent {
  color: #FF7A00;
}

/* ========================================================
 * SLIDER SECTION
 * ======================================================== */
.sp-slider-section {
  background: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  padding: 20px 16px;
  margin-bottom: 16px;
}

.sp-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.sp-slider-title {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #6B7280;
}

.sp-slider-value {
  font-family: 'Manrope', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #1A1A1A;
}

.sp-slider-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sp-slider-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: #9CA3AF;
}

/* Range slider track + thumb */
.sp-range {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #E0E0E0;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.sp-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FF3B30;
  cursor: pointer;
  border: 3px solid #FFFFFF;
  box-shadow: 0 0 0 1px #FF3B30, 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: box-shadow 0.2s ease;
}

.sp-range::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 1px #FF3B30, 0 2px 10px rgba(255, 59, 48, 0.3);
}

.sp-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FF3B30;
  cursor: pointer;
  border: 3px solid #FFFFFF;
  box-shadow: 0 0 0 1px #FF3B30, 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Best savings marker */
.sp-best-wrap {
  position: relative;
  height: 28px;
  margin-bottom: 4px;
}

.sp-best-marker {
  position: absolute;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.sp-best-arrow {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 7px solid #FF7A00;
  margin: 0 auto 2px;
}

.sp-best-label {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: #FF7A00;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Slider stats — panels + generation */
.sp-slider-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #E0E0E0;
}

.sp-slider-stat {
  text-align: center;
}

.sp-slider-stat-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #6B7280;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sp-slider-stat-value {
  font-family: 'Manrope', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #1A1A1A;
}

/* ========================================================
 * SECONDARY STATS
 * ======================================================== */
.sp-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.sp-stat {
  background: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  padding: 14px;
}

.sp-stat-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.sp-stat-value {
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #1A1A1A;
}

/* Trust green for eco values */
.sp-stat-value.eco {
  color: #2D6A4F;
}

/* ========================================================
 * DISCLAIMER
 * ======================================================== */
.sp-disclaimer {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: #6B7280;
  line-height: 1.7;
  padding: 14px 16px;
  background: #F5F5F5;
  border-radius: 8px;
  margin-bottom: 16px;
  border-left: 3px solid #E0E0E0;
}

/* ========================================================
 * CTA BUTTON
 * ======================================================== */
.sp-cta-btn {
  width: 100%;
  padding: 16px 24px;
  background: #FF3B30;
  border: none;
  border-radius: 8px;
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #FFFFFF;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin-bottom: 12px;
}

.sp-cta-btn:hover {
  background: #E0352B;
}

/* ========================================================
 * RECALCULATE BUTTON
 * ======================================================== */
.sp-recalc-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sp-recalc-btn:hover {
  background: #F5F5F5;
  color: #1A1A1A;
}

/* ========================================================
 * RESPONSIVE — Mobile First
 * ======================================================== */

/* Tablet and below */
@media (max-width: 768px) {
  .sp-calc {
    padding: 24px 16px;
  }

  .sp-title {
    font-size: 24px;
  }

  .sp-results-title {
    font-size: 20px;
  }

  .sp-card-value {
    font-size: 20px;
  }

  .sp-cards,
  .sp-secondary,
  .sp-slider-stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* Small mobile */
@media (max-width: 380px) {
  .sp-calc {
    padding: 20px 12px;
  }

  .sp-title {
    font-size: 22px;
  }

  .sp-cards,
  .sp-secondary,
  .sp-slider-stats {
    grid-template-columns: 1fr;
  }

  .sp-card-value {
    font-size: 18px;
  }

  .sp-slider-stat-value {
    font-size: 14px;
  }
}
