/* ============================================
   COMMON.CSS - Stile condiviso Contours / Cluster / Techniques
   Sobrio, elegante, compatto
============================================ */
:root {
  --maroon: #800000;
  --muted: #666;
  --border: #ccc;
  --bg-soft: #fafafa;
  --bg-success: #f7faf7;
  --accent: #5a1a7a;
  --mono: "Courier New", Courier, monospace;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 14.5px;
  color: #222;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.1rem 1.3rem 2.5rem;
}

/* Tipografia */
h1 {
  font-size: 1.75rem;
  margin: 0 0 0.35rem 0;
  font-weight: 650;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.15rem;
  margin: 1.4rem 0 0.7rem 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

h3 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem 0;
  color: var(--maroon);
  font-weight: 600;
}

.bold-maroon { color: var(--maroon); font-weight: 600; }
.link-comment { color: var(--muted); font-size: 0.88em; }
.line-maroon {
  border: none;
  border-bottom: 1.5px solid var(--maroon);
  margin: 1.1rem 0;
}

.intro {
  font-size: 0.92rem;
  line-height: 1.35;
  color: #333;
  margin-bottom: 0.6rem;
}

/* Bottoni */
button, .file-row button {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.38rem 0.9rem;
  border: 1px solid #999;
  border-radius: 4px;
  background: #f5f5f5;
  cursor: pointer;
  min-width: 110px;
  text-align: center;
}

button:hover { background: #eee; }

.run-button {
  background: var(--maroon);
  color: #fff;
  border: none;
  padding: 0.5rem 1.3rem;
  font-size: 0.95rem;
  border-radius: 5px;
  min-width: 130px;
}

.run-button.run-disabled {
  background: #808080 !important;
  color: #fff !important;
  cursor: default;
}

.run-button.run-ready {
  background: #d32f2f !important;
  color: #fff !important;
}

.run-button.run-completed {
  background: #2e7d32 !important;
  color: #fff !important;
}

/* nessuna reazione al mouse */
.run-button:hover {
  filter: none !important;
  opacity: 1 !important;
}

.run-button:disabled {
  background: #bbb;
  cursor: default;
}

/* File row e input */
.file-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.35rem 0 0.7rem 0;
}

textarea.paste-area {
  width: 100%;
  max-width: 480px;
  height: 90px;
  font-family: var(--mono);
  font-size: 13px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  resize: vertical;
  background: #fff;
}

/* ============================================
   Tabelle di preview (stile comune)
============================================ */

/* Contenitore sempre visibile */
#data-preview,
.table-container {
  width: 100%;
  min-height: 30px;
  max-height: 280px;               /* circa 10 righe */
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-success);
  margin-top: 0.35rem;
}

/* Tabella */
.preview-grid,
#preview-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
}

/* Intestazioni e celle centrate */
.preview-grid th,
.preview-grid td,
#preview-table th,
#preview-table td {
  text-align: center;
  padding: 4px 10px;
  border: 1px solid #ddd;
  white-space: nowrap;
}

/* Intestazione */
.preview-grid th,
#preview-table th {
  background: #f0f0f0;
  border-color: #ccc;
  font-weight: 600;
}

/* Prima colonna (indice # o nome individuo) */
.preview-grid td:first-child,
#preview-table td:first-child {
  font-weight: 500;
  color: #555;
}
/* Inglese sempre corsivo grigio */
.link-comment {
  color: var(--muted);
  font-size: 0.88em;
  font-style: italic;
}

/* Parametri */
.param-columns {
  display: flex;
  gap: 1.2%;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.param-col {
  flex: 1 1 30%;
  min-width: 200px;
}

.param-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.35rem 0;
  flex-wrap: wrap;
}

.param-row label {
  min-width: 140px;
  font-size: 0.9rem;
}

input[type="number"],
input[type="text"] {
  width: 72px;
  height: 26px;
  padding: 2px 5px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 3px;
}

input[type="range"] {
  width: 100px;
}

/* Run */
.run-row {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin: 0.8rem 0;
}

#run-status {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Output */
#output-area {
  border: 1px dashed #ccc;
  border-radius: 5px;
  padding: 1rem;
  min-height: 100px;
  background: #fff;
}

/* Help box */
#help-box {
  position: fixed;
  top: 70px;
  right: 18px;
  width: 420px;
  max-height: 70vh;
  overflow-y: auto;
  background: #fffff8;
  border: 1px solid #aaa;
  padding: 12px 14px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.12);
  z-index: 9999;
  font-size: 0.9rem;
}

.help-hidden { display: none; }

/* Utility */
.hidden { display: none !important; }

@media (max-width: 820px) {
  .param-col { flex-basis: 100%; }
  .param-row label { min-width: 120px; }
}

/* Slider stile originale Contours */
.param-row input[type="range"] {
  width: 100px;
  height: 22px;
  margin: 0;
  padding: 0;
  background: #eee;
  border-radius: 6px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.param-row input[type="range"]::-webkit-slider-runnable-track {
  height: 22px;
  background: #eee;
  border-radius: 6px;
}

.param-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 22px;
  background: var(--accent);
  border-radius: 2px;
  cursor: pointer;
  margin-top: 0;
}

.param-row input[type="range"]::-moz-range-track {
  height: 22px;
  background: #eee;
  border-radius: 6px;
}

.param-row input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 22px;
  background: var(--accent);
  border-radius: 2px;
  cursor: pointer;
  border: none;
}