/* Palette + layout lifted from MCP_Network/templates/index.html:8-190 so the
   two apps share a visual identity once they merge. */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  color: #333;
  background: #f5f7fa;
  height: 100vh;
  overflow: hidden;
}

.header {
  background: #2c3e50;
  color: white;
  padding: 12px 20px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.header .sub { font-size: 12px; font-weight: 400; color: #bdc3c7; }

.container {
  display: flex;
  height: calc(100vh - 56px);
}

.sidebar {
  width: 380px;
  background: white;
  border-right: 1px solid #ddd;
  overflow-y: auto;
  padding: 16px;
}

.sidebar section { margin-bottom: 22px; }
.sidebar h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #2c3e50;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}
.sidebar label { font-size: 12px; font-weight: 600; color: #555; display: block; margin-bottom: 4px; }
.sidebar select, .sidebar input[type="text"], .sidebar input[type="number"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 10px;
  background: white;
}
.sidebar input[type="checkbox"] { margin-right: 6px; }

.sidebar .param-help {
  font-size: 11px;
  color: #888;
  margin: -6px 0 10px 0;
  line-height: 1.4;
}

.upload-area {
  border: 2px dashed #bbb;
  border-radius: 6px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  color: #777;
  transition: all .15s;
  background: #fafbfc;
  overflow: hidden;           /* stop long filenames escaping the box */
  overflow-wrap: anywhere;    /* wrap long unbroken filenames */
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}
.upload-area.has-file { border-color: #27ae60; color: #27ae60; background: #f0faf3; }
.upload-area:hover { border-color: #3498db; color: #3498db; }
.upload-area strong {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

button.primary {
  background: #3498db;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}
button.primary:disabled { background: #bdc3c7; cursor: not-allowed; }
button.primary:hover:not(:disabled) { background: #2980b9; }

button.secondary {
  background: #ecf0f1;
  color: #333;
  border: 1px solid #ccc;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.main {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.tabs {
  display: flex;
  border-bottom: 2px solid #ddd;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tab {
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.tab.active { color: #3498db; border-bottom-color: #3498db; }

.tab-body { background: white; border: 1px solid #ddd; border-radius: 4px; padding: 16px; min-height: 400px; }
.tab-body img { max-width: 100%; height: auto; display: block; margin: 0 auto; }

.info-box {
  background: #ecf0f1;
  border-left: 3px solid #3498db;
  padding: 10px 12px;
  border-radius: 3px;
  margin-bottom: 12px;
  font-size: 13px;
}
.info-box.warn { background: #fff4e6; border-left-color: #e67e22; }
.info-box.error { background: #fdecea; border-left-color: #e74c3c; color: #a52015; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th, .data-table td {
  border: 1px solid #ddd;
  padding: 6px 10px;
  text-align: left;
}
.data-table th {
  background: #f5f7fa;
  font-weight: 600;
  color: #2c3e50;
}
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* League-table diagonal and common-comparator accents. The diagonal shows
 * the treatment name on a subtle gray background; when a common comparator
 * is selected, that treatment's row + column are tinted and its diagonal
 * cell is highlighted so it reads as the focal treatment. */
.data-table td.league-diag {
  background: #f0f2f5;
  text-align: center;
  color: #2c3e50;
}
.data-table td.league-diag-comp {
  background: #fde2c3;
  color: #7a3e00;
}
.data-table th.league-comp-col,
.data-table .league-comp-row > th {
  background: #fff1df;
}
.data-table td.league-comp-col,
.data-table td.league-comp-row {
  background: #fffaf2;
}
/* Upper-triangle cells are visually suppressed so the league table reads
 * as a ladder: only the lower triangle + diagonal carry ink. */
.data-table td.league-empty {
  border: none;
  background: transparent;
}

pre.raw-output {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 12px;
  border-radius: 4px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  max-height: 500px;
  overflow: auto;
  white-space: pre-wrap;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #ccc;
  border-top-color: #3498db;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.advanced-toggle {
  display: inline-block;
  font-size: 12px;
  color: #3498db;
  cursor: pointer;
  margin-bottom: 8px;
  user-select: none;
}
.advanced-params { display: none; padding: 8px; background: #fafbfc; border-radius: 4px; margin-bottom: 10px; }
.advanced-params.open { display: block; }

.filter-panel {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 8px;
}
.filter-col { margin-bottom: 8px; }
.filter-col .label { font-size: 11px; font-weight: 600; color: #666; margin-bottom: 3px; }
.filter-col select { height: 80px; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  background: #ecf0f1;
  border-radius: 10px;
  font-size: 11px;
  color: #555;
  margin-right: 4px;
}
.pill.green { background: #d4edda; color: #155724; }
.pill.blue  { background: #d1ecf1; color: #0c5460; }

/* Mode tabs (NMA / ITC) in the header — pill buttons that swap the sidebar
 * and results pane between the two analysis modes. */
.mode-tabs {
  display: flex;
  gap: 6px;
}
.mode-tabs .mode-tab {
  background: #34495e;
  color: #ecf0f1;
  border: 1px solid #4a6277;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.15s;
}
.mode-tabs .mode-tab:hover { background: #3d5a77; }
.mode-tabs .mode-tab.active {
  background: #3498db;
  border-color: #3498db;
  color: white;
}

/* ===========================================================================
   Claude badge + activity panel — mirrors MCP_Network/templates/index.html
   so the two apps stay visually consistent.
   =========================================================================== */

.claude-badge {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.12); padding: 6px 14px; border-radius: 20px;
  font-size: 13px; color: white; font-weight: 500;
}
.claude-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #e74c3c;
}
.claude-badge .dot.connected { background: #27ae60; }

.claude-panel {
  position: fixed; bottom: 16px; left: 16px;
  width: 380px; max-height: 260px;
  background: rgba(255,255,255,0.96); border: 1px solid #d5d8dc;
  border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  display: flex; flex-direction: column; overflow: hidden;
  font-size: 13px; z-index: 90;
}
.claude-panel.minimized { height: auto; max-height: none; }
.claude-panel.minimized .claude-panel-body { display: none; }

.claude-panel-header {
  background: #2c3e50; color: white; padding: 8px 14px;
  font-weight: 600; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
}
.claude-panel-header button {
  background: none; border: none; color: white; cursor: pointer;
  font-size: 16px; width: auto; padding: 0; margin: 0;
}
.claude-panel-body {
  flex: 1; overflow-y: auto; padding: 10px 14px;
}
.claude-log-entry {
  padding: 4px 0; border-bottom: 1px solid #f0f0f0;
  font-size: 12px; color: #555; line-height: 1.4;
}
.claude-log-entry:last-child { border-bottom: none; }
.claude-log-entry .time { color: #aaa; font-size: 11px; margin-right: 6px; }
.claude-log-entry.highlight { color: #2c3e50; font-weight: 600; }
