/* Exact Regression — interface-only visual revision */

:root {
  --page-bg: #eef1f4;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #d8dee6;
  --border-strong: #bcc6d2;
  --text: #182230;
  --muted: #667282;
  --accent: #245b8f;
  --accent-hover: #1b4b78;
  --focus: rgba(36, 91, 143, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.35;
}

.page-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 28px auto 48px;
}

/* Header */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 8px;
}

.brand-block {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.brand-title {
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

#digits-note {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Main content */
#contentBox {
  margin-top: 14px;
}

.ui-panel {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

#modelPanel {
  margin-top: 14px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
}

.panel-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.compact-heading {
  margin-bottom: 4px;
}

.file-loader {
  flex: 0 0 auto;
}

/* Data entry: three equal ways to provide data */
.data-methods {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  margin-top: 12px;
}

.data-method {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-soft);
}

.data-method h3 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 650;
}

.data-method-help {
  min-height: 2.4em;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.data-method-file,
.data-method-sample {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.sample-data-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
}

.sample-data-link {
  color: var(--accent);
  font-size: 0.9rem;
  text-decoration: none;
}

.sample-data-link:hover {
  text-decoration: underline;
}

.sample-data-loading,
.sample-data-error {
  color: var(--muted);
  font-size: 0.86rem;
}

#dataInput {
  display: block;
  width: 100%;
  height: 180px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.94rem;
  line-height: 1.35;
}

#dataInput:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

#fileFormatLink {
  color: var(--accent);
  font-size: 0.9rem;
  text-decoration: none;
}

#fileFormatLink:hover {
  text-decoration: underline;
}

/* Buttons */
button {
  appearance: none;
  padding: 7px 14px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.button-secondary,
#restartButton {
  background: #fff;
  color: var(--accent);
  border-color: var(--border-strong);
}

.button-secondary:hover,
#restartButton:hover {
  background: var(--surface-soft);
  color: var(--accent-hover);
  border-color: var(--accent);
}

/* Status */
.status-line {
  min-height: 1.1em;
  margin: 8px 4px 0;
  color: var(--muted);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
}

/* Variable/model controls */
.controls {
  margin-top: 0;
}

#variableSelection h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid #e6eaf0;
  font-size: 0.94rem;
  font-weight: 650;
}

#variableSelection h3:first-child {
  margin-top: 8px;
}

#variableSelection h3 button {
  margin-left: 4px !important;
  padding: 4px 9px;
  background: #fff;
  color: var(--accent);
  border-color: var(--border-strong);
  font-size: 0.78rem;
  font-weight: 600;
}

#variableSelection h3 button:hover {
  background: var(--surface-soft);
  border-color: var(--accent);
}

#variableSelection input[type="radio"],
#variableSelection input[type="checkbox"] {
  margin: 0 5px 0 2px;
  accent-color: var(--accent);
  vertical-align: -1px;
}

#variableSelection label {
  display: inline-block;
  margin: 0 18px 7px 0;
  font-size: 0.9rem;
  font-weight: 400;
  white-space: nowrap;
}

/* The only direct button child is "Display Regression results". */
#variableSelection > button {
  display: block !important;
  margin-top: 15px !important;
  padding: 8px 16px;
  font-size: 0.92rem;
}

/* OLS output: restored to the pre-redesign format */
#results {
  margin-top: 2em;
  white-space: pre-wrap;
  line-height: normal;
}

/* Keep the restored OLS formatting on a white results panel. */
#results:not(:empty) {
  padding: 20px 22px 22px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* General table styling */
.table-text {
    font-family: Consolas, "Courier New", monospace;
    margin-left: 0;
}

.table-text table tr:nth-child(even) {
    background-color: #f4f4f4;
}

.table-text table tr:hover {
    background-color: #e0f0ff;
}

/* First table specific spacing */
.first-table {
    table-layout: fixed; /* preserve original layout */
    border-collapse: collapse;
    margin-left: 5mm;
    margin-top: 15px;
    margin-bottom: 5px;
    font-family: Consolas, "Courier New", monospace;
}

/* Table header styling */
.table-text table th {
    padding: 4px;
    text-align: center;
    background-color: #e0e0e0;
    font-weight: bold;
    border: 1px solid #ccc;
}

/* Ensure p-value header stays right-aligned and on one line */
.first-table th.right-align:last-child {
    white-space: nowrap;
    text-align: right;
    width: 70px;
}

/* Table cell styling */
.table-text table td {
    padding: 2px;
    text-align: right;
    border: 1px solid #ccc;
}

/* Align first column to left */
.table-text table td:first-child,
.table-text table th:first-child {
    text-align: left;
}

/* Restore original clickable exact-number appearance */
.coeff-cell {
  text-decoration: underline;
  cursor: pointer;
  color: #1a73e8;
  text-align: right;
}

.coeff-cell:hover {
  color: #0c4da2;
}

.varname-cell {
    font-weight: bold;
    text-align: left;
}

/* Numeric alignment for second table */
.num {
    text-align: right;
}

/* Spacer columns */
.spacer {
    width: 1cm;
}

.spacer2 {
    width: 5mm;
}

/* Restore original precision control */
#results label {
  margin-right: 1.2em;
  font-weight: 500;
  font-size: 0.95em;
}

input[type="number"] {
  width: 60px;
  padding: 0.25em 0.4em;
  border-radius: 5px;
  border: 1px solid #ccc;
  text-align: center;
  font-family: Consolas, "Courier New", monospace;
}

input[type="number"]:focus {
  border-color: #357ABD;
  outline: none;
  box-shadow: 0 0 4px rgba(53,122,189,0.2);
}

/* Timing block: no redesign styling; retain its existing monospace text only. */
#calculationTiming {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* Range input styling retained from original output */
input[type="range"] {
    margin-top: 0px;
    margin-bottom: 0px;
    width: 80px;
    height: 2px;
    accent-color: black;
}

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 18px, 1080px);
    margin-top: 10px;
  }

  #topbar,
  .ui-panel {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand-block {
    display: block;
  }

  #digits-note {
    margin-top: 2px;
  }

  .panel-heading {
    align-items: center;
  }

  .data-methods {
    grid-template-columns: 1fr;
    gap: 10px;
  }


  #dataInput {
    height: 150px;
  }
}
