/* NZ Solar Toolkit - public tool styles. All scoped under .stk-tool. */

.stk-tool {
  --stk-ink: #000000;
  --stk-accent: #8ECBDE;
  --stk-line: #e2e8ec;
  --stk-muted: #3a3a3a;
  --stk-bg: #ffffff;
  max-width: 640px;
  margin: 1.5em auto;
  padding: 28px 26px;
  background: var(--stk-bg);
  border: 1px solid var(--stk-line);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
  color: var(--stk-ink);
  font-size: 16px;
  line-height: 1.55;
  box-sizing: border-box;
}
.stk-tool *, .stk-tool *::before, .stk-tool *::after { box-sizing: border-box; }

.stk-phase { animation: stk-fade .35s ease; }
@keyframes stk-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.stk-tool__title { font-size: 22px; font-weight: 800; margin: 0 0 10px; color: var(--stk-ink); line-height: 1.2; }
.stk-intro { font-size: 16px; color: var(--stk-ink); margin: 0 0 20px; }

/* Question blocks */
.stk-qblock { margin: 0 0 22px; }
.stk-qlabel { font-size: 16px; font-weight: 700; margin: 0 0 10px; color: var(--stk-ink); }

/* Select */
.stk-select {
  width: 100%; font-size: 16px; padding: 13px 14px; border: 1px solid var(--stk-line);
  border-radius: 10px; background: #fff; color: var(--stk-ink); appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px;
}
.stk-select:focus { outline: none; border-color: var(--stk-accent); box-shadow: 0 0 0 3px rgba(142,203,222,.35); }

/* Radio option cards */
.stk-option {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin: 0 0 10px;
  border: 1.5px solid var(--stk-line); border-radius: 12px; cursor: pointer; font-size: 16px;
  color: var(--stk-ink);
  transition: border-color .15s, background .15s;
}
.stk-option span { color: inherit; }
.stk-option:hover { border-color: var(--stk-accent); }
.stk-option input { accent-color: var(--stk-ink); width: 18px; height: 18px; margin: 0; }
.stk-option:has(input:checked) { border-color: var(--stk-ink); background: rgba(142,203,222,.12); }

/* Slider */
.stk-slider { display: flex; align-items: center; gap: 16px; }
.stk-slider input[type="range"] { flex: 1; accent-color: var(--stk-ink); height: 6px; }
.stk-slider__value {
  min-width: 96px; text-align: right; font-size: 18px; font-weight: 800; color: var(--stk-ink);
  white-space: nowrap;
}

/* Toggle */
.stk-toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.stk-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.stk-toggle__track {
  width: 52px; height: 30px; border-radius: 99px; background: #cfd8dd; position: relative; transition: background .2s;
}
.stk-toggle__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s;
}
.stk-toggle input:checked + .stk-toggle__track { background: var(--stk-ink); }
.stk-toggle input:checked + .stk-toggle__track::after { transform: translateX(22px); }
.stk-toggle__labels em { font-style: normal; font-size: 16px; font-weight: 700; color: var(--stk-ink); }
.stk-toggle__labels em[data-on] { display: none; }
.stk-toggle input:checked ~ .stk-toggle__labels em[data-on] { display: inline; }
.stk-toggle input:checked ~ .stk-toggle__labels em[data-off] { display: none; }

/* Generic fields */
.stk-field { margin: 0 0 16px; }
.stk-field label { display: block; font-size: 15px; font-weight: 700; color: var(--stk-ink); }
.stk-field input {
  width: 100%; font-size: 16px; padding: 13px 14px; margin-top: 7px; border: 1px solid var(--stk-line);
  border-radius: 10px; color: var(--stk-ink); background: #fff;
}
.stk-field input:focus { outline: none; border-color: var(--stk-accent); box-shadow: 0 0 0 3px rgba(142,203,222,.35); }
.stk-field-error { display: none; color: #b42318; font-size: 14px; margin-top: 6px; }
.stk-field-error.is-visible { display: block; }

.stk-error { display: none; color: #b42318; font-size: 15px; margin: 4px 0 14px; font-weight: 600; }
.stk-error.is-visible { display: block; }

/* Buttons */
.stk-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 16px; font-weight: 800; padding: 15px 26px; border: none; border-radius: 12px;
  background: var(--stk-ink); color: #fff; cursor: pointer; text-decoration: none;
  transition: transform .08s, box-shadow .15s, background .15s; width: 100%;
}
.stk-btn:hover { box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.stk-btn:active { transform: translateY(1px); }
.stk-btn:disabled { opacity: .55; cursor: default; box-shadow: none; }
.stk-hook__cta { background: var(--stk-accent); color: #00313c; margin-top: 4px; }

/* Loading */
.stk-loading { text-align: center; padding: 44px 0; }
.stk-spinner {
  width: 46px; height: 46px; margin: 0 auto 18px; border-radius: 50%;
  border: 4px solid var(--stk-line); border-top-color: var(--stk-ink); animation: stk-spin 0.9s linear infinite;
}
@keyframes stk-spin { to { transform: rotate(360deg); } }
.stk-loading__msg { font-size: 17px; font-weight: 700; color: var(--stk-ink); margin: 0; }

/* Gate */
.stk-gate__heading { font-size: 24px; font-weight: 800; margin: 0 0 8px; color: var(--stk-ink); }
.stk-gate__sub { font-size: 16px; color: var(--stk-ink); margin: 0 0 22px; }

/* OTP */
.stk-otp__sent { font-size: 16px; margin: 4px 0 16px; color: var(--stk-ink); }
.stk-otp__field input {
  letter-spacing: 8px; font-size: 22px; font-weight: 800; text-align: center;
}
.stk-resend { font-size: 14px; color: var(--stk-ink); margin: 14px 0 0; text-align: center; }
.stk-resend a { color: var(--stk-ink); font-weight: 700; }
.stk-resend a.is-disabled { opacity: .5; pointer-events: none; }

/* Results */
.stk-results__heading { font-size: 24px; font-weight: 800; margin: 0 0 16px; color: var(--stk-ink); }
.stk-results__content { font-size: 16px; color: var(--stk-ink); }

.stk-verdict { border-radius: 14px; padding: 20px 22px; margin: 0 0 20px; border: 2px solid; }
.stk-verdict--yes { border-color: #b6e6cc; background: #eafaf1; }
.stk-verdict--maybe { border-color: #f5d99a; background: #fff7e8; }
.stk-verdict__label { display: block; font-size: 22px; font-weight: 900; margin-bottom: 6px; }
.stk-verdict--yes .stk-verdict__label { color: #096a46; }
.stk-verdict--maybe .stk-verdict__label { color: #8a5a00; }
.stk-verdict__note { font-size: 15px; margin: 0; color: var(--stk-ink); }

/* Result tables */
.stk-table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 15px; }
.stk-table th, .stk-table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--stk-line); color: var(--stk-ink); }
.stk-table thead th { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--stk-muted); }
.stk-table__highlight { background: rgba(142,203,222,.16); }
.stk-table__highlight td { font-weight: 600; }

.stk-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 18px; }
.stk-stat { border: 1px solid var(--stk-line); border-radius: 12px; padding: 16px; text-align: center; }
.stk-stat__value { font-size: 26px; font-weight: 900; color: var(--stk-ink); line-height: 1.1; }
.stk-stat__label { font-size: 13px; color: var(--stk-muted); margin-top: 6px; }

.stk-note { font-size: 14px; color: var(--stk-ink); background: #fff7e8; border: 1px solid #f5d99a; border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.stk-disclaimer { font-size: 13px; color: var(--stk-muted); margin: 0 0 4px; }

/* Hook */
.stk-hook { margin-top: 24px; padding-top: 22px; border-top: 1px dashed var(--stk-line); }
.stk-hook__text { font-size: 16px; margin: 0 0 14px; color: var(--stk-ink); }

@media (max-width: 480px) {
  .stk-tool { padding: 22px 16px; }
  .stk-stat-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   DARK SKIN - matches the Solar Sentinel widget (#000 + #8ECBDE glow)
   Applied when the admin selects the dark skin in Settings.
   ===================================================================== */
.stk-tool.stk-skin--dark {
  --stk-ink: #ffffff;
  --stk-accent: #8ECBDE;
  --stk-line: rgba(142, 203, 222, 0.28);
  --stk-muted: #dbe5e9;
  --stk-bg: #0c0c0c;
  background: radial-gradient(circle at 50% -10%, rgba(142, 203, 222, 0.18), transparent 60%), #000000;
  border-color: rgba(142, 203, 222, 0.25);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  color: #ffffff;
}

/* Primary buttons become the accent so they pop on black */
.stk-skin--dark .stk-btn { background: var(--stk-accent); color: #00252e; }
.stk-skin--dark .stk-btn:hover { box-shadow: 0 8px 22px rgba(142, 203, 222, 0.35); }
.stk-skin--dark .stk-hook__cta { background: var(--stk-accent); color: #00252e; }

/* Select: dark field + white dropdown chevron */
.stk-skin--dark .stk-select {
  background-color: var(--stk-bg);
  color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238ECBDE' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.stk-skin--dark .stk-field input { background: var(--stk-bg); color: #ffffff; }
.stk-skin--dark .stk-field input::placeholder { color: #6f7d84; }

/* Option cards */
.stk-skin--dark .stk-option { background: rgba(255, 255, 255, 0.02); }
.stk-skin--dark .stk-option:hover { border-color: var(--stk-accent); }
.stk-skin--dark .stk-option:has(input:checked) { border-color: var(--stk-accent); background: rgba(142, 203, 222, 0.14); }
.stk-skin--dark .stk-option input { accent-color: var(--stk-accent); }

/* Slider + toggle accents */
.stk-skin--dark .stk-slider input[type="range"] { accent-color: var(--stk-accent); }
.stk-skin--dark .stk-toggle input:checked + .stk-toggle__track { background: var(--stk-accent); }
.stk-skin--dark .stk-toggle__track { background: #3a4347; }

/* Spinner */
.stk-skin--dark .stk-spinner { border-color: rgba(142, 203, 222, 0.22); border-top-color: var(--stk-accent); }

/* Verdict cards - translucent tints instead of light boxes */
.stk-skin--dark .stk-verdict--yes { background: rgba(15, 107, 74, 0.22); border-color: #2faf7f; }
.stk-skin--dark .stk-verdict--yes .stk-verdict__label { color: #6fe3b0; }
.stk-skin--dark .stk-verdict--maybe { background: rgba(138, 90, 0, 0.24); border-color: #d9a441; }
.stk-skin--dark .stk-verdict--maybe .stk-verdict__label { color: #f4c870; }
.stk-skin--dark .stk-verdict__note { color: #ffffff; }

/* Tables + stats */
.stk-skin--dark .stk-table__highlight { background: rgba(142, 203, 222, 0.16); }
.stk-skin--dark .stk-stat { background: rgba(255, 255, 255, 0.03); }

/* Notices */
.stk-skin--dark .stk-note { background: rgba(138, 90, 0, 0.2); border-color: rgba(217, 164, 65, 0.5); color: #f3ecdd; }
.stk-skin--dark .stk-error, .stk-skin--dark .stk-field-error { color: #ff8a80; }
