/* =========================================================
   Solar Panel Calculator — sp- prefix
   3 Layers: Country tabs → Feature tabs → Tool panels
   ========================================================= */

.sp-wrap *, .sp-wrap *::before, .sp-wrap *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.sp-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1e293b;
  max-width: 1100px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(15, 23, 42, 0.08);
}

.sp-header {
  display: flex;
  align-items: center;
  gap: clamp(10px, 2vw, 14px);
  padding: clamp(14px, 2.5vw, 22px) clamp(14px, 3vw, 26px);
  background: linear-gradient(135deg, #78350f, #b45309);
}

.sp-header-icon {
  width: clamp(38px, 5vw, 46px);
  height: clamp(38px, 5vw, 46px);
  background: rgba(255, 255, 255, 0.15);
  border-radius: 11px;
  color: #fcd34d;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sp-title {
  font-size: clamp(16px, 2.5vw, 20px);
  font-weight: 800;
  color: #fff;
  margin-bottom: 3px;
}

.sp-subtitle {
  font-size: clamp(11px, 1.7vw, 13px);
  color: #fde68a;
  line-height: 1.4;
}

.sp-layer {
  padding: 12px clamp(14px, 3vw, 24px);
  border-bottom: 1px solid #e2e8f0;
  background: #fffbeb;
}

.sp-feature-layer {
  background: #fff7ed;
}

.sp-layer-label {
  font-size: 11px;
  font-weight: 800;
  color: #92400e;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.sp-tab-row {
  display: grid;
  gap: 8px;
}

.sp-country-tabs {
  grid-template-columns: repeat(4, 1fr);
}

.sp-feature-tabs {
  grid-template-columns: repeat(4, 1fr);
}

.sp-tab,
.sp-choice,
.sp-action {
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #475569;
  font-size: clamp(12px, 1.7vw, 13px);
  font-weight: 700;
  padding: 9px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.sp-tab:hover,
.sp-choice:hover,
.sp-action:hover {
  border-color: #d97706;
  color: #ffffff;
  background: #74340D;
}

.sp-tab.active,
.sp-choice.active {
  background: #78350f;
  border-color: #78350f;
  color: #fff;
}

.sp-body {
  display: flex;
  align-items: flex-start;
}

.sp-form,
.sp-results {
  width: 50%;
  padding: clamp(14px, 2.5vw, 22px);
}

.sp-form {
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sp-results {
  background: #fffbeb;
  min-width: 0;
}

.sp-tool-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.sp-tool-panel.active {
  display: flex;
}

.sp-panel-head {
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
}

.sp-panel-title {
  font-size: clamp(15px, 2vw, 17px);
  font-weight: 850;
  color: #78350f;
  margin-bottom: 4px;
}

.sp-panel-desc {
  font-size: clamp(11.5px, 1.6vw, 12.5px);
  color: #92400e;
  line-height: 1.45;
}

.sp-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sp-label {
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sp-hint,
.sp-note {
  font-size: clamp(11px, 1.6vw, 12px);
  color: #64748b;
  line-height: 1.45;
}

.sp-btn-group {
  display: grid;
  gap: 7px;
}

.sp-btn-2 { grid-template-columns: repeat(2, 1fr); }
.sp-btn-5 { grid-template-columns: repeat(5, 1fr); }

.sp-prefix-wrap,
.sp-suffix-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}

.sp-prefix-wrap:focus-within,
.sp-suffix-wrap:focus-within {
  border-color: #d97706;
  background: #fff;
}

.sp-prefix,
.sp-suffix {
  padding: 0 11px;
  height: 44px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  background: #f1f5f9;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.sp-prefix { border-right: 1px solid #e2e8f0; }
.sp-suffix { border-left: 1px solid #e2e8f0; }

.sp-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 44px;
  border: none;
  outline: none;
  background: transparent;
  padding: 0 12px;
  font-size: 14px;
  color: #1e293b;
  -moz-appearance: textfield;
  appearance: textfield;
}

.sp-input::-webkit-outer-spin-button,
.sp-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.sp-slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sp-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #e2e8f0;
  border-radius: 4px;
  outline: none;
}

.sp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d97706;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #d97706;
}

.sp-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d97706;
  cursor: pointer;
  border: 2px solid #fff;
}

.sp-slider-val {
  min-width: 54px;
  text-align: right;
  font-size: 15px;
  font-weight: 800;
  color: #92400e;
}

.sp-appliance-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sp-appliance-head {
  display: grid;
  grid-template-columns: 1.35fr 70px 58px 78px;
  gap: 8px;
  align-items: center;
  padding: 0 8px 2px;
  color: #92400e;
  font-size: 10.5px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sp-appliance-row {
  display: grid;
  grid-template-columns: 1.35fr 70px 58px 78px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.sp-appliance-name {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
}

.sp-appliance-watts {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.sp-appliance-row .sp-input {
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  padding: 0 8px;
}

.sp-custom-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  gap: 8px;
}

.sp-custom-row .sp-input {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}

.sp-action {
  background: #fef3c7;
  color: #92400e;
}

.sp-mini-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  font-size: 13px;
}

.sp-mini-result strong {
  color: #92400e;
}

.sp-battery-fields {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.sp-battery-fields.active {
  display: flex;
}

.sp-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 12px;
  color: #854d0e;
  line-height: 1.5;
}

.sp-disclaimer svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #ca8a04;
}

.sp-hero-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.sp-hero-card,
.sp-output,
.sp-incentive-block,
.sp-roi {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

.sp-hero-card {
  padding: clamp(10px, 1.8vw, 14px);
  text-align: center;
}

.sp-hero-main {
  background: #fef3c7;
  border-color: #f59e0b;
}

.sp-hero-label,
.sp-output-title,
.sp-roi-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.sp-hero-val {
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 900;
  color: #1e293b;
  margin-top: 4px;
}

.sp-hero-main .sp-hero-val {
  color: #92400e;
}

.sp-hero-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.sp-output,
.sp-incentive-block,
.sp-roi {
  padding: 14px;
  margin-bottom: 12px;
}

.sp-output-title,
.sp-roi-title {
  margin-bottom: 10px;
}

.sp-out-row,
.sp-inc-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #f1f5f9;
  color: #475569;
  font-size: 13px;
}

.sp-out-row:last-child,
.sp-inc-row:last-child {
  border-bottom: none;
}

.sp-out-row span:last-child,
.sp-inc-row span:last-child {
  text-align: right;
  font-weight: 800;
  color: #92400e;
}

.sp-inc-credit {
  background: #f0fdf4;
  margin: 0 -14px;
  padding: 8px 14px;
}

.sp-inc-credit span:first-child {
  color: #15803d;
  font-weight: 700;
}

.sp-inc-credit span:last-child {
  color: #16a34a;
}

.sp-inc-net {
  font-weight: 800;
}

.sp-payback-track {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.sp-track-line {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}

.sp-track-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f59e0b, #16a34a);
}

.sp-track-points {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.sp-track-point {
  border: 1px solid transparent;
  padding: 7px 6px;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: all 0.15s ease;
}

.sp-track-point:hover {
  background: #74340D;
  border-color: #fed7aa;
  color: #ffffff;
}

.sp-track-point.active {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}

.sp-track-note {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: #92400e;
}

.sp-eco-card,
.sp-angle-card,
.sp-battery-card {
  background: #f8fafc;
}

.sp-note {
  margin-top: 8px;
  color: #94a3b8;
}

.sp-roi-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sp-roi-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.sp-roi-yr {
  color: #64748b;
  min-width: 32px;
}

.sp-roi-bar-wrap {
  flex: 1;
  height: 16px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.sp-roi-bar-neg,
.sp-roi-bar-pos {
  height: 100%;
  border-radius: 4px;
  position: absolute;
  top: 0;
}

.sp-roi-bar-neg {
  right: 50%;
  background: #fca5a5;
}

.sp-roi-bar-pos {
  left: 50%;
  background: #86efac;
}

.sp-roi-center {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  background: #cbd5e1;
}

.sp-roi-val {
  min-width: 76px;
  text-align: right;
  font-weight: 700;
}

.sp-roi-val.pos { color: #16a34a; }
.sp-roi-val.neg { color: #dc2626; }

/* ==============================================
   SCREEN 1 — MOBILE: max 480px
   ============================================== */
@media (max-width: 480px) {
  .sp-country-tabs { grid-template-columns: repeat(2, 1fr); }
  .sp-feature-tabs { grid-template-columns: repeat(2, 1fr); }
  .sp-body { flex-direction: column; }
  .sp-form, .sp-results { width: 100%; padding: 14px; }
  .sp-form { border-right: none; border-bottom: 1px solid #e2e8f0; }
  .sp-hero-grid { grid-template-columns: 1fr; }
  .sp-btn-5 { grid-template-columns: repeat(2, 1fr); }
  .sp-appliance-head,
  .sp-appliance-row { grid-template-columns: 1fr 52px 46px 62px; gap: 6px; }
  .sp-custom-row { grid-template-columns: 1fr; }
}

/* ==============================================
   SCREEN 2 — TABLET: 481px – 899px
   ============================================== */
@media (min-width: 481px) and (max-width: 899px) {
  .sp-country-tabs { grid-template-columns: repeat(4, 1fr); }
  .sp-feature-tabs { grid-template-columns: repeat(4, 1fr); }
  .sp-body { flex-direction: column; }
  .sp-form, .sp-results { width: 100%; padding: 18px; }
  .sp-form { border-right: none; border-bottom: 1px solid #e2e8f0; }
  .sp-hero-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ==============================================
   SCREEN 3 — DESKTOP: 900px+
   ============================================== */
@media (min-width: 900px) {
  .sp-body { flex-direction: row; }
  .sp-results { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; }
}
