/* pool.css — Pool Shot Margin Visualizer styles */

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  padding: 12px 16px;
  background: #1a1a1a;
  color: #e8e8e8;
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  max-width: 860px;
}

/* ── Table ─────────────────────────────────────────────────────────────────── */

#table-container {
  width: 100%;
  margin-bottom: 12px;
}

#table-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

/* ── Controls ──────────────────────────────────────────────────────────────── */

#controls {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.control-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group label,
.control-col > label {
  font-size: 0.85rem;
  color: #ccc;
  font-weight: 500;
}

/* ── Outputs ───────────────────────────────────────────────────────────────── */

#outputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

/* ── Sliders ───────────────────────────────────────────────────────────────── */

input[type="range"] {
  width: 100%;
  accent-color: #7ec8e3;
  cursor: pointer;
  height: 44px;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
}

input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
}

/* ── Shot info rows ────────────────────────────────────────────────────────── */

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  border-bottom: 1px solid #2e2e2e;
  padding-top: 6px;
  padding-bottom: 6px;
}

.info-label {
  color: #888;
}

.info-value {
  color: #e0e0e0;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ── Toggle group ──────────────────────────────────────────────────────────── */

.toggle-group {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #3a3a3a;
}

.toggle-group button {
  flex: 1;
  padding: 3px 8px;
  min-height: 22px;
  font-size: 0.8rem;
  font-family: inherit;
  background: #252525;
  color: #aaa;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toggle-group button:not(:last-child) {
  border-right: 1px solid #3a3a3a;
}

.toggle-group button:hover {
  background: #333;
}

.toggle-group button.active {
  background: #3a5a7a;
  color: #e8e8e8;
  font-weight: 600;
}

/* ── Checkbox toggle ───────────────────────────────────────────────────────── */

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  accent-color: #7ec8e3;
  cursor: pointer;
}

/* ── Disabled state (CIT slider when compensation is off) ──────────────────── */

.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Drag interactions ─────────────────────────────────────────────────────── */

.draggable {
  cursor: grab;
}

#table-svg.dragging {
  cursor: grabbing;
  user-select: none;
}

/* ── Degenerate state warning ──────────────────────────────────────────────── */

#degenerate-msg {
  display: none;
  background: #3a1a1a;
  border: 1px solid #a03030;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #e08080;
  line-height: 1.4;
}

/* ── Info popups ───────────────────────────────────────────────────────────── */

.info-btn {
  cursor: pointer;
  opacity: 0.4;
  margin-left: 3px;
  font-size: 0.85em;
  user-select: none;
  fill: #aaa; /* for SVG text info buttons */
}
.info-btn:hover { opacity: 0.85; }

.info-popup {
  position: fixed;
  background: #2e2e2e;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 10px 14px;
  max-width: 280px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #ddd;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ── Credits ───────────────────────────────────────────────────────────────── */

#credits {
  margin-top: 16px;
  font-size: 0.8rem;
  color: #888;
}

#credits a {
  color: #aaa;
}

/* ── Mobile ────────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  body {
    padding: 8px 10px;
  }

  #controls-grid,
  #outputs-grid {
    grid-template-columns: 1fr;
  }
}
