/* Hesapoo Calc engine v2.0 — premium calculator UI, self-contained tokens */
.hp-calc {
  --hp-primary: #2563EB;
  --hp-primary-dark: #1E40AF;
  --hp-accent: #F59E0B;
  --hp-accent-hover: #D97706;
  --hp-heading: #0F172A;
  --hp-body: #334155;
  --hp-muted: #64748B;
  --hp-border: #E2E8F0;
  --hp-surface: #F8FAFC;
  --hp-bg: #FFFFFF;
  --hp-error: #DC2626;
  --hp-success: #16A34A;
  --hp-info-bg: #EFF6FF;

  position: relative;
  background: var(--hp-bg);
  border: 1px solid var(--hp-border);
  border-radius: 16px;
  padding: 24px 22px 22px;
  margin: 0 0 28px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 3px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.05);
  overflow: hidden;
}
/* Signature: brand accent bar */
.hp-calc::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--hp-primary) 0%, var(--hp-primary) 70%, var(--hp-accent) 70%);
}
.hp-calc *, .hp-calc *::before, .hp-calc *::after { box-sizing: border-box; }

.hp-calc-intro { margin: 0 0 18px; color: var(--hp-muted); font-size: 15px; }

/* Subject groups as soft cards */
.hp-group {
  border: 1px solid var(--hp-border);
  background: var(--hp-surface);
  border-radius: 12px;
  margin: 0 0 14px;
  padding: 14px 14px 8px;
  display: flex; flex-wrap: wrap; gap: 10px 12px;
}
.hp-group-legend {
  width: 100%; padding: 0; margin: 0 0 4px;
  font-size: 13px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--hp-primary);
}

.hp-field { flex: 1 1 100%; margin-bottom: 6px; }
.hp-field-half { flex: 1 1 calc(50% - 6px); min-width: 128px; }
.hp-field label {
  display: block; font-size: 13.5px; font-weight: 600;
  margin-bottom: 5px; color: var(--hp-heading);
}
.hp-field input {
  width: 100%; font-size: 17px; padding: 11px 13px;
  border: 1.5px solid var(--hp-border); border-radius: 10px;
  background: var(--hp-bg); color: var(--hp-heading);
  font-feature-settings: "tnum" 1; font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, box-shadow .15s ease;
  appearance: textfield; -moz-appearance: textfield;
}
.hp-field input::-webkit-outer-spin-button,
.hp-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.hp-field input:focus {
  outline: none; border-color: var(--hp-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.hp-field input.hp-invalid { border-color: var(--hp-error); background: #FEF2F2; }
.hp-error-msg { color: var(--hp-error); font-size: 12.5px; margin: 4px 0 0; }

/* CTA */
.hp-btn {
  display: block; width: 100%; min-height: 52px; margin-top: 14px;
  font-size: 17px; font-weight: 700; color: #fff; letter-spacing: .01em;
  background: linear-gradient(180deg, var(--hp-accent) 0%, var(--hp-accent-hover) 100%);
  border: none; border-radius: 12px; cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, .35);
  transition: transform .1s ease, box-shadow .15s ease;
}
.hp-btn:hover { box-shadow: 0 6px 16px rgba(245, 158, 11, .45); }
.hp-btn:active { transform: translateY(1px); }
.hp-btn:focus-visible { outline: 3px solid rgba(37,99,235,.4); outline-offset: 2px; }
.hp-btn-reset {
  background: transparent; color: var(--hp-muted); box-shadow: none;
  font-weight: 500; min-height: 40px; margin-top: 6px; font-size: 14px;
}
.hp-btn-reset:hover { color: var(--hp-heading); box-shadow: none; }
.hp-btn-reset:active { transform: none; }

/* ============ RESULT ============ */
.hp-result {
  background: linear-gradient(180deg, var(--hp-info-bg) 0%, #FFFFFF 130%);
  border: 1px solid #DBEAFE;
  border-radius: 14px; padding: 20px; margin-top: 18px;
  animation: hp-reveal .35s ease;
}
@keyframes hp-reveal {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.hp-result-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

/* Score gauge */
.hp-gauge { width: 116px; height: 116px; flex: 0 0 auto; }
.hp-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.hp-gauge .hp-gauge-bg { fill: none; stroke: var(--hp-border); stroke-width: 10; }
.hp-gauge .hp-gauge-val {
  fill: none; stroke: var(--hp-primary); stroke-width: 10;
  stroke-linecap: round; transition: stroke-dashoffset .8s ease;
}
.hp-result-main { flex: 1 1 200px; }
.hp-result-label { font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--hp-muted); margin: 0; }
.hp-result-number {
  font-size: 44px; font-weight: 800; line-height: 1.1;
  color: var(--hp-primary); margin: 2px 0 0;
  font-feature-settings: "tnum" 1;
}
.hp-result-max { font-size: 16px; font-weight: 600; color: var(--hp-muted); }

/* Percentile bar */
.hp-dilim { margin-top: 14px; }
.hp-dilim-label { display: flex; justify-content: space-between; font-size: 14px; color: var(--hp-heading); font-weight: 600; margin-bottom: 6px; }
.hp-dilim-bar { height: 10px; background: var(--hp-border); border-radius: 6px; overflow: hidden; }
.hp-dilim-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--hp-primary), var(--hp-accent));
  transition: width .8s ease;
}

.hp-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; background: #fff; border-radius: 10px; overflow: hidden; }
.hp-table th, .hp-table td { padding: 9px 12px; border-bottom: 1px solid var(--hp-border); text-align: left; }
.hp-table th { font-weight: 600; color: var(--hp-heading); background: var(--hp-surface); }
.hp-table td { color: var(--hp-body); }
.hp-table tr:last-child td { border-bottom: none; font-weight: 700; color: var(--hp-heading); }
.hp-result-meta { font-size: 12.5px; color: var(--hp-muted); margin: 12px 0 0; }

.hp-disclaimer { font-size: 13px; color: var(--hp-muted); margin: 14px 0 0; }

@media (max-width: 480px) {
  .hp-calc { padding: 18px 14px 16px; border-radius: 12px; }
  .hp-result-number { font-size: 36px; }
  .hp-gauge { width: 96px; height: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  .hp-calc *, .hp-result { transition: none !important; animation: none !important; }
}

/* v3: legend alignment fix (pull legend out of fieldset border into flow) */
.hp-group-legend { float: left; width: 100%; margin: 0 0 10px; }
.hp-group { padding-top: 14px; }

/* v3: select + date fields */
.hp-field select {
  width: 100%; font-size: 17px; padding: 11px 13px;
  border: 1.5px solid var(--hp-border); border-radius: 10px;
  background: var(--hp-bg); color: var(--hp-heading);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.hp-field select:focus {
  outline: none; border-color: var(--hp-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.hp-field input[type="date"] { font-family: inherit; min-height: 46px; }
.hp-result-rows { margin-top: 6px; }
.hp-result-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--hp-border); font-size: 15px; }
.hp-result-row:last-child { border-bottom: none; }
.hp-result-row b { color: var(--hp-heading); }
.hp-badge-ok { display:inline-block; background:#DCFCE7; color:#166534; font-size:13px; font-weight:700; padding:2px 10px; border-radius:10px; }
.hp-badge-no { display:inline-block; background:#FEE2E2; color:#991B1B; font-size:13px; font-weight:700; padding:2px 10px; border-radius:10px; }
