/* SpringStatistik — stats260510_v01.css */

/* ── Layout ──────────────────────────────────────────────── */
.stats-section {
  margin: 2rem 0;
}
.stats-section h2 {
  margin-bottom: 0.75rem;
}

/* ── Distans-kort (hub-grid) ─────────────────────────────── */
.dist-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}
@media (max-width: 600px) {
  .dist-grid { grid-template-columns: 1fr; grid-auto-flow: row; justify-content: center; }
}
.dist-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.dist-card:hover {
  box-shadow: 0 3px 12px rgba(0,0,0,0.12);
  border-color: #2f5233;
  text-decoration: none;
}
.dist-card .card-header {
  margin: 0 0 0.2rem;
}
.dist-card .card-badge {
  display: inline-block;
  background: #e85d04;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.45em 0.9em;
  border-radius: 50px;
}
.dist-card .card-median {
  font-size: 0.9rem;
  color: #555;
}
.dist-card .card-chart {
  height: 72px;
  margin: 0.5rem 0 0.6rem;
  pointer-events: none;
}
.dist-card .card-cta {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #2196F3;
  font-weight: 600;
}

/* ── Kalkylator ──────────────────────────────────────────── */
.stats-calc {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1.5rem;
}
.stats-calc .calc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-end;
  max-width: 620px;
}
.stats-calc label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
  color: #444;
}
.stats-calc input[type="text"],
.stats-calc select {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  font-size: 1rem;
  width: 100%;
}
.stats-calc .field      { flex: 0 0 auto; }
.stats-calc .field-time { flex: 0 0 auto; }
.stats-calc .field-time input { width: 8ch; }
.stats-calc .field select { width: auto; }
.stats-calc .field-dist { flex: 0 0 145px; }
.stats-calc .calc-row > button {
  align-self: flex-end;
  background: #2f5233;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.4rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.stats-calc button:hover { background: #1e3b22; }
.calc-result {
  margin-top: 1rem;
  padding: 0.9rem 1.1rem;
  background: #f0f7f0;
  border-left: 4px solid #2f5233;
  border-radius: 6px;
  font-size: 1.05rem;
  display: none;
}
.calc-result.visible { display: block; }

/* ── Könstoggle ──────────────────────────────────────────── */
.gender-toggle {
  display: flex;
  border: 2px solid #2f5233;
  border-radius: 25px;
  overflow: hidden;
}
.gender-toggle button {
  flex: 1;
  padding: 0.45rem 1rem;
  border: none;
  background: #f0f0f0;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  color: #333;
  white-space: nowrap;
}
.gender-toggle button.active {
  background: #2f5233;
  color: #fff;
}

/* ── Sektionskontroller (kön + tabell/graf i rad) ────────── */
.section-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

/* ── Tabell/Graf-toggle (flik-stil) ─────────────────────── */
.view-toggle {
  display: inline-flex;
  border-bottom: 2px solid #e0e0e0;
  gap: 0;
}
.view-toggle button {
  padding: 0.3rem 0.85rem;
  border: none;
  background: none;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: #999;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.view-toggle button.active {
  color: #2f5233;
  border-bottom-color: #2f5233;
}
.view-toggle button:hover:not(.active) { color: #555; }

/* ── Tabeller ────────────────────────────────────────────── */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0.5rem 0 1.5rem;
}
.stats-table th {
  background: #2f5233;
  color: #fff;
  padding: 0.5rem 0.7rem;
  text-align: left;
  font-weight: 600;
}
.stats-table td {
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid #eee;
}
.stats-table tr:nth-child(even) td { background: #f8f8f8; }
.stats-table tr:hover td { background: #eef4ee; }
.stats-table .highlight { font-weight: 700; color: #2f5233; }
.stats-table td:first-child,
.stats-table th:first-child { white-space: nowrap; }

/* ── Diagram ─────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 280px;
  margin: 0.5rem 0 1.5rem;
}

/* ── Kalkylator-visualisering ────────────────────────────── */
.calc-viz {
  margin-top: 1rem;
  border-top: 1px solid #e0e0e0;
  padding-top: 0.75rem;
}
.calc-viz .view-toggle {
  margin-bottom: 0.75rem;
}
.calc-viz .chart-container {
  height: 220px;
  margin-bottom: 0;
}

/* Percentilskala */
.ruler-wrap {
  padding: 2rem 0 0.5rem;
  position: relative;
}
.ruler-ticks {
  position: relative;
  height: 2.8rem;
  margin-bottom: 0.2rem;
}
.ruler-tick {
  position: absolute;
  transform: translateX(-50%);
  text-align: center;
}
.ruler-tick-line {
  width: 1px;
  height: 10px;
  background: #999;
  margin: 0 auto;
}
.ruler-tick-label {
  font-size: 0.72rem;
  color: #666;
  white-space: nowrap;
}
.ruler-tick-label.top {
  font-weight: 700;
  color: #333;
  margin-bottom: 1px;
}
.ruler-tick-label.bot {
  margin-top: 1px;
}
.ruler-track {
  position: relative;
  height: 12px;
  background: linear-gradient(to right, #2f5233, #a8c9aa, #ddd);
  border-radius: 6px;
  overflow: visible;
}
.ruler-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  border-radius: 6px 0 0 6px;
}
.ruler-user {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  text-align: center;
}
.ruler-user-pin {
  width: 4px;
  height: 24px;
  background: #e85d04;
  margin: 0 auto;
  border-radius: 2px;
}
.ruler-user-label {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #e85d04;
  white-space: nowrap;
}
.ruler-user-label small {
  display: block;
  font-weight: 400;
  color: #555;
  font-size: 0.75rem;
}
.ruler-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #aaa;
  margin-top: 0.4rem;
}

/* ── Datakälla-not ───────────────────────────────────────── */
.stats-source {
  font-size: 0.82rem;
  color: #777;
  border-top: 1px solid #eee;
  padding-top: 0.75rem;
  margin-top: 2rem;
}
