/* ============================================================
   VLMS Software - Shared Tool Page System
   ============================================================ */

:root {
  --tool-hero-top: 148px;
  --tool-hero-bottom: 154px;
  --tool-shell-bg: linear-gradient(180deg, #081227 0%, #0d1840 48%, #f3f7fc 48.1%, #eff4fb 100%);
  --tool-shell-shadow: 0 30px 80px rgba(10, 15, 46, 0.16);
  --tool-card-shadow: 0 18px 48px rgba(10, 15, 46, 0.12);
  --tool-border-soft: rgba(255, 255, 255, 0.12);
}

main {
  background: var(--tool-shell-bg);
}

/* Hero */
.tool-hero {
  position: relative;
  overflow: hidden;
  margin-top: calc(var(--nav-h) * -1);
  padding: calc(var(--tool-hero-top) + var(--nav-h)) 0 var(--tool-hero-bottom);
  background:
    radial-gradient(circle at 16% 18%, rgba(102, 230, 255, 0.18), transparent 18%),
    radial-gradient(circle at 82% 24%, rgba(134, 118, 255, 0.22), transparent 24%),
    linear-gradient(145deg, #071126 0%, #10204b 52%, #09142f 100%);
}

.tool-hero::before,
.tool-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tool-hero::before {
  background:
    linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.045) 34%, transparent 45%),
    radial-gradient(circle, rgba(93, 210, 255, 0.1) 1px, transparent 1.6px);
  background-size: auto, 28px 28px;
  opacity: 0.9;
}

.tool-hero::after {
  inset: auto -10vw -120px auto;
  width: 44vw;
  height: 44vw;
  min-width: 360px;
  min-height: 360px;
  border-radius: 50%;
  border: 1px solid rgba(121, 226, 255, 0.16);
  box-shadow:
    0 0 0 40px rgba(121, 226, 255, 0.06),
    0 0 0 96px rgba(135, 118, 255, 0.08);
  opacity: 0.9;
}

.tool-hero-inner {
  position: relative;
  max-width: 700px;
  z-index: 1;
}

.tool-hero-inner::after {
  content: "";
  position: absolute;
  right: -360px;
  top: -8px;
  width: 560px;
  height: 240px;
  border-radius: 42px;
  transform: rotate(-16deg);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.08) 24%, rgba(113, 219, 255, 0.22) 62%, rgba(129, 111, 255, 0.2) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  filter: blur(0.2px);
  opacity: 0.9;
  pointer-events: none;
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(245, 248, 255, 0.88);
  font: 600 0.72rem/1 var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
  backdrop-filter: blur(16px);
}

.tool-badge::before {
  content: "";
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #6be3ff 0%, #7b61ff 100%);
  box-shadow: 0 0 20px rgba(107, 227, 255, 0.65);
}

.tool-hero h1 {
  margin: 0 0 1rem;
  max-width: 10.5ch;
  font: 700 clamp(3rem, 6vw, 5rem)/0.94 var(--font-display);
  letter-spacing: -0.05em;
  color: #fff;
  text-wrap: balance;
}

.tool-subtitle {
  margin: 0 0 1.7rem;
  max-width: 640px;
  font: 400 clamp(1rem, 1.8vw, 1.16rem)/1.75 var(--font-body);
  color: rgba(225, 234, 252, 0.76);
}

.tool-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tool-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 42px;
  padding: 0.72rem 0.95rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(232, 239, 255, 0.74);
  font: 500 0.82rem/1 var(--font-body);
  backdrop-filter: blur(16px);
}

.tool-meta-item svg {
  opacity: 0.88;
}

/* Layout */
.tool-section {
  position: relative;
  z-index: 2;
  margin-top: calc(var(--tool-hero-bottom) * -1 + 42px);
  padding: 0 0 5.75rem;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 1.7rem;
  align-items: start;
}

/* Form card */
.tool-form-card {
  position: sticky;
  top: 102px;
  padding: 1.75rem;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 250, 255, 0.98) 100%);
  border: 1px solid rgba(210, 221, 240, 0.92);
  box-shadow: var(--tool-shell-shadow);
  backdrop-filter: blur(16px);
}

.form-section-title {
  margin: 0 0 1.1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(197, 208, 227, 0.7);
  color: #09142f;
  font: 600 0.94rem/1.2 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.form-group {
  margin-bottom: 1.05rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.46rem;
  color: #27344f;
  font: 600 0.88rem/1.45 var(--font-body);
}

.required {
  color: #ff4757;
}

.form-group input[type="number"],
.form-group select {
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(188, 202, 226, 0.9);
  border-radius: 14px;
  background: rgba(247, 250, 255, 0.95);
  color: #09142f;
  font: 500 0.95rem/1.35 var(--font-body);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-group input::placeholder {
  color: #8da0bd;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: rgba(0, 212, 255, 0.9);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.1);
}

.field-hint {
  display: block;
  margin-top: 0.42rem;
  color: #8190a9;
  font: 400 0.76rem/1.45 var(--font-body);
}

.input-error {
  border-color: #ff4757 !important;
  box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.12) !important;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.slider-wrapper input[type="range"] {
  flex: 1;
}

.slider-wrapper input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  background: linear-gradient(135deg, #00d4ff 0%, #7b61ff 100%);
  box-shadow: 0 8px 18px rgba(0, 212, 255, 0.28);
}

.slider-value {
  min-width: 72px;
  color: #0c7dbc;
  text-align: right;
  font: 700 0.87rem/1 var(--font-mono);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: #3a4860;
  font: 500 0.88rem/1.3 var(--font-body);
}

.radio-label input {
  accent-color: var(--cyan);
}

.btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 0.6rem;
  min-height: 52px;
  border-radius: 16px;
  font-weight: 700;
  box-shadow: 0 18px 28px rgba(0, 212, 255, 0.22);
}

.form-disclaimer {
  margin-top: 0.85rem;
  text-align: center;
  color: #8a97ae;
  font: 400 0.74rem/1.55 var(--font-body);
}

/* Result panel */
.result-panel {
  min-height: 620px;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(114, 216, 255, 0.14), transparent 26%),
    linear-gradient(180deg, rgba(8, 17, 38, 0.98) 0%, rgba(11, 22, 52, 0.98) 100%);
  border: 1px solid rgba(103, 122, 170, 0.28);
  box-shadow: var(--tool-shell-shadow);
}

.result-header {
  position: relative;
  padding: 2.35rem 2.25rem 1.9rem;
  text-align: left;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0%, rgba(112, 213, 255, 0.07) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.result-header::after {
  content: "";
  position: absolute;
  inset: auto 2.25rem -1px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(110, 215, 255, 0.5), rgba(255, 255, 255, 0));
}

.result-header h2 {
  margin: 0.55rem 0 0.4rem;
  color: #fff;
  font-size: 1.12rem;
}

.big-metric {
  font: 700 clamp(3.15rem, 5vw, 4.8rem)/0.92 var(--font-mono);
  letter-spacing: -0.06em;
}

.grade-display {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.48rem 1rem;
  border-radius: 999px;
  font: 700 1rem/1 var(--font-mono);
  margin-bottom: 0.65rem;
}

.grade-a,
.grade-b,
.grade-c,
.grade-d,
.grade-f {
  border: 1px solid transparent;
}

.grade-a { background: rgba(0, 255, 136, 0.14); color: #77ffbf; border-color: rgba(0, 255, 136, 0.25); }
.grade-b { background: rgba(90, 226, 255, 0.14); color: #8ce8ff; border-color: rgba(90, 226, 255, 0.24); }
.grade-c { background: rgba(255, 184, 0, 0.14); color: #ffd15a; border-color: rgba(255, 184, 0, 0.24); }
.grade-d { background: rgba(255, 122, 64, 0.15); color: #ffb27d; border-color: rgba(255, 122, 64, 0.22); }
.grade-f { background: rgba(255, 71, 87, 0.15); color: #ff9aa4; border-color: rgba(255, 71, 87, 0.22); }

.result-body {
  padding: 1.55rem 2.25rem 2rem;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem;
  margin-bottom: 1.4rem;
}

.metric-card {
  padding: 1rem 1rem 1.05rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
}

.metric-card .mc-label {
  margin-bottom: 0.45rem;
  color: rgba(230, 237, 255, 0.52);
  font: 600 0.72rem/1.4 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.metric-card .mc-value {
  color: #fff;
  font: 700 clamp(1.15rem, 1.8vw, 1.55rem)/1.1 var(--font-mono);
  letter-spacing: -0.04em;
}

.benchmark-section,
.bench-section {
  margin: 1.45rem 0;
}

.benchmark-section h3,
.bench-section h3,
.leak-sources h3,
.result-body > h3 {
  margin-bottom: 0.9rem;
  color: #fff;
  font: 600 0.94rem/1.4 var(--font-display);
  letter-spacing: 0;
}

.bench-row {
  margin-bottom: 0.95rem;
}

.bench-labels {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.42rem;
}

.bench-name {
  color: rgba(230, 237, 255, 0.72);
  font: 500 0.81rem/1.4 var(--font-body);
}

.bench-val {
  color: #fff;
  font: 700 0.82rem/1 var(--font-mono);
}

.bench-track {
  position: relative;
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bench-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.9s ease;
}

.bench-avg-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.28);
}

.action-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.action-list li {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.82rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(233, 240, 255, 0.8);
  font: 400 0.9rem/1.62 var(--font-body);
}

.action-list li:last-child {
  border-bottom: 0;
}

.action-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  font: 700 0.74rem/1 var(--font-mono);
}

.result-cta {
  padding: 1.4rem 2.25rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.result-cta p {
  margin: 0 0 0.95rem;
  color: rgba(230, 237, 255, 0.68);
  font-size: 0.88rem;
}

.result-cta .btn-primary {
  display: inline-flex;
  align-items: center;
}

/* Callouts and specialized result content */
.recovery-callout,
.leakage-amount {
  border-radius: 20px;
  padding: 1.2rem 1.25rem;
  margin: 1.45rem 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.recovery-callout {
  text-align: center;
  background:
    linear-gradient(135deg, rgba(0, 255, 136, 0.12) 0%, rgba(0, 212, 255, 0.08) 100%);
  border-color: rgba(0, 255, 136, 0.16);
}

.recovery-callout .rec-label,
.leakage-amount .leakage-label {
  color: rgba(230, 237, 255, 0.55);
  font: 600 0.74rem/1.3 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.recovery-callout .rec-value {
  color: #92ffd0;
  font: 700 clamp(1.8rem, 3vw, 2.4rem)/1 var(--font-mono);
  letter-spacing: -0.05em;
  margin-top: 0.35rem;
}

.recovery-callout .rec-sub,
.leakage-amount .leakage-sub {
  color: rgba(230, 237, 255, 0.58);
  font-size: 0.82rem;
  margin-top: 0.3rem;
}

.leakage-amount .leakage-value {
  color: #ff929f;
  font: 700 clamp(2.2rem, 3.5vw, 3rem)/1 var(--font-mono);
  letter-spacing: -0.06em;
  margin-top: 0.4rem;
}

.leak-score-ring {
  width: 144px;
  height: 144px;
  margin-bottom: 0.8rem;
}

.leak-source-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.8rem;
  align-items: start;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.leak-source-item:last-child {
  border-bottom: 0;
}

.leak-source-name {
  color: #fff;
  font: 600 0.9rem/1.3 var(--font-body);
  margin-bottom: 0.2rem;
}

.leak-source-desc {
  color: rgba(230, 237, 255, 0.56);
  font-size: 0.8rem;
  line-height: 1.55;
}

.leak-source-amount {
  color: #ff9ca6;
  text-align: right;
  font: 700 0.9rem/1.2 var(--font-mono);
}

/* Explainer blocks */
.tool-explainer {
  padding: 5.5rem 0 6rem;
  background: transparent;
}

.tool-explainer.reveal {
  opacity: 1;
  transform: none;
}

.section-title {
  margin: 0;
  max-width: 12ch;
  color: #09142f;
  font: 700 clamp(2rem, 3vw, 3rem)/1 var(--font-display);
  letter-spacing: -0.04em;
}

.section-subtitle {
  margin: 1rem 0 0;
  max-width: 720px;
  color: #5b6a84;
  font-size: 1rem;
  line-height: 1.72;
}

.explainer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.2rem;
}

.explainer-item {
  padding: 1.4rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(213, 223, 241, 0.85);
  box-shadow: var(--tool-card-shadow);
  backdrop-filter: blur(14px);
}

.explainer-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.explainer-item h3 {
  margin-bottom: 0.55rem;
  color: #09142f;
  font: 600 1rem/1.28 var(--font-display);
}

.explainer-item p {
  color: #61718b;
  font-size: 0.88rem;
  line-height: 1.65;
}

/* Responsive */
@media (max-width: 1100px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }

  .tool-form-card {
    position: relative;
    top: auto;
  }

  .result-panel {
    min-height: 0;
  }

  .explainer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  :root {
    --tool-hero-top: 112px;
    --tool-hero-bottom: 122px;
  }

  .tool-hero {
    padding-top: var(--tool-hero-top);
  }

  .tool-hero::after {
    right: -180px;
    bottom: -90px;
    width: 360px;
    height: 360px;
    min-width: 0;
    min-height: 0;
  }

  .tool-hero-inner::after {
    right: -220px;
    top: 46px;
    width: 370px;
    height: 180px;
  }

  .tool-hero h1 {
    font-size: clamp(2.4rem, 10vw, 4rem);
  }

  .tool-section {
    margin-top: calc(var(--tool-hero-bottom) * -1 + 24px);
    padding-bottom: 4.75rem;
  }

  .tool-form-card,
  .result-panel {
    border-radius: 24px;
  }

  .tool-form-card {
    padding: 1.35rem;
  }

  .result-header,
  .result-body,
  .result-cta {
    padding-left: 1.35rem;
    padding-right: 1.35rem;
  }

  .metric-row {
    grid-template-columns: 1fr;
  }

  .explainer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .tool-meta-row {
    gap: 0.55rem;
  }

  .tool-meta-item {
    width: 100%;
    justify-content: flex-start;
  }

  .slider-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .slider-value {
    text-align: left;
    min-width: 0;
  }

  .tool-badge {
    font-size: 0.67rem;
    letter-spacing: 0.14em;
  }
}
