/* ===================================================
   SYP Fluid Sampler — Waikato Scientific Design System
   Dark Scientific Aesthetic · v2.0
   =================================================== */

:root {
  --bg-base:       #0b0f1c;
  --bg-surface:    #111827;
  --bg-card:       #161f33;
  --bg-input:      #1c2640;
  --bg-hover:      #1e2d4a;

  --border:        #253352;
  --border-focus:  #2db3c8;

  --text-primary:  #e8edf5;
  --text-secondary:#8fa3c0;
  --text-muted:    #526078;
  --text-data:     #a8f0e8;

  --teal:          #2db3c8;
  --teal-dim:      #1a6e7d;
  --teal-glow:     rgba(45,179,200,0.15);
  --blue:          #3b82f6;
  --blue-dim:      #1d4ed8;
  --green:         #10b981;
  --green-dim:     #065f46;
  --amber:         #f59e0b;
  --amber-dim:     #92400e;
  --red:           #ef4444;
  --red-dim:       #7f1d1d;
  --orange:        #f97316;

  --radius-sm:     4px;
  --radius:        8px;
  --radius-lg:     12px;

  --font-ui:       'Helvetica Neue', Arial, sans-serif;
  --font-data:     'Courier New', Courier, monospace;
  --font-heading:  Georgia, 'Times New Roman', serif;

  --shadow-card:   0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow:   0 0 20px rgba(45,179,200,0.2);
}


/* ── Light mode overrides ───────────────────────── */
html.light {
  --bg-base:       #f0f4f8;
  --bg-surface:    #ffffff;
  --bg-card:       #ffffff;
  --bg-input:      #e8edf5;
  --bg-hover:      #dce4ef;

  --border:        #c8d4e3;
  --border-focus:  #2db3c8;

  --text-primary:  #1a2340;
  --text-secondary:#3d5278;
  --text-muted:    #7a90b0;
  --text-data:     #0e7a8a;

  --teal-dim:      #a8e4ed;
  --teal-glow:     rgba(45,179,200,0.10);
  --green-dim:     #bbf7d0;
  --amber-dim:     #fde68a;
  --red-dim:       #fecaca;
  --blue-dim:      #bfdbfe;

  --shadow-card:   0 2px 12px rgba(0,0,0,0.10);
  --shadow-glow:   0 0 16px rgba(45,179,200,0.12);
}
html.light body,
html.light html { background: var(--bg-base); }
html.light .syp-header { border-bottom-color: var(--border); }

/* ── Theme toggle button ────────────────────────── */
.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--teal); color: var(--teal); }

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

html {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
}

body {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 40px;
  background: var(--bg-base);
  text-align: left;
}

/* ── Header / Logo ─────────────────────────────── */
.syp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.syp-logo { height: 36px; }
/* Logo is JPEG (no transparency). In light mode use screen blend to suppress
   the dark background. Replace with a transparent PNG for a clean result. */
html.light .syp-logo {
  mix-blend-mode: multiply;
  filter: invert(1) hue-rotate(180deg);
}
.syp-title {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.syp-connection-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  display: inline-block;
  margin-right: 6px;
}

/* ── Page headings ─────────────────────────────── */
h1 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: normal;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: normal;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
h3 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }

/* ── Cards ─────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.card-title {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title::before {
  content: '';
  display: inline-block;
  width: 3px; height: 14px;
  background: var(--teal);
  border-radius: 2px;
}

/* ── Status Grid ───────────────────────────────── */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-cell {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.stat-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-value {
  font-family: var(--font-data);
  font-size: 1.15rem;
  color: var(--text-data);
  letter-spacing: 0.03em;
}
.stat-value.alert { color: var(--red); }
.stat-value.warn  { color: var(--amber); }
.stat-value.ok    { color: var(--green); }

/* ── Tables ─────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 16px;
}
th {
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-data);
  font-size: 0.85rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-hover); }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 22px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.btn-lg {
  font-size: 1rem;
  padding: 14px 32px;
  border-radius: var(--radius-lg);
}
.btn-sm {
  font-size: 0.75rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}

.btn-primary  { background: var(--teal);  color: #0b0f1c; }
.btn-blue     { background: var(--blue);  color: #fff; }
.btn-green    { background: var(--green); color: #fff; }
.btn-amber    { background: var(--amber); color: #0b0f1c; }
.btn-red      { background: var(--red);   color: #fff; }
.btn-orange   { background: var(--orange);color: #fff; }
.btn-ghost    { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-off      { background: #2a3040; color: var(--text-muted); }

.btn:hover { filter: brightness(1.18); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.btn:active { transform: translateY(0); filter: brightness(0.95); }
.btn:disabled, .btn-disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.btn-row.centered { justify-content: center; }

/* Legacy button classes — map to new system */
.blueButton   { @apply .btn .btn-primary; background: var(--teal); color: #0b0f1c; display:inline-flex; align-items:center; justify-content:center; border:none; border-radius:var(--radius); font-family:var(--font-ui); font-size:0.875rem; font-weight:600; letter-spacing:0.04em; padding:10px 22px; cursor:pointer; text-decoration:none; transition:all 0.18s ease; }
.blueButton, .blueButton1, .blueButton2 {
  background: var(--teal); color: #0b0f1c;
  border: none; border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 0.875rem; font-weight: 600;
  padding: 10px 22px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.18s ease; letter-spacing: 0.04em;
}
.blueButton1 { background: var(--blue); color: #fff; }
.blueButton2 { background: var(--teal-dim); color: var(--text-primary); }
.orangeButton { background: var(--orange); color: #fff; border:none; border-radius:var(--radius); font-family:var(--font-ui); font-size:0.875rem; font-weight:600; padding:10px 22px; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; transition:all 0.18s ease; }
.redButton    { background: var(--red);    color: #fff; border:none; border-radius:var(--radius); font-family:var(--font-ui); font-size:0.875rem; font-weight:600; padding:10px 22px; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; transition:all 0.18s ease; }
.greenButton  { background: var(--green);  color: #fff; border:none; border-radius:var(--radius); font-family:var(--font-ui); font-size:0.875rem; font-weight:600; padding:10px 22px; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; transition:all 0.18s ease; }
.offButton    { background: #2a3040; color: var(--text-muted); border:none; border-radius:var(--radius); font-family:var(--font-ui); font-size:0.875rem; font-weight:600; padding:10px 22px; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; transition:all 0.18s ease; }
.invalidButton { background: #2a3040; color: var(--text-muted); opacity:0.5; cursor:not-allowed; border:none; border-radius:var(--radius); font-family:var(--font-ui); font-size:0.875rem; font-weight:600; padding:10px 22px; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }

.blueButton:hover,.blueButton1:hover,.blueButton2:hover,.orangeButton:hover,
.redButton:hover,.greenButton:hover,.offButton:hover {
  filter: brightness(1.18); transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.smallBlueButton {
  background: var(--teal-dim);
  color: var(--text-primary);
  border: none; border-radius: var(--radius-sm);
  font-size: 0.75rem; padding: 4px 10px; cursor: pointer;
}

/* Refresh button */
.refreshButton {
  background: var(--bg-card);
  color: var(--teal);
  border: 1px solid var(--teal-dim);
  border-radius: var(--radius);
  font-family: var(--font-ui); font-size: 0.875rem; font-weight: 600;
  padding: 10px 20px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.2s ease;
}
.refreshButton:hover { background: var(--teal-glow); transform: translateY(-1px); }
.refreshButton .icon { transition: transform 0.5s ease; display: inline-block; }
.refreshButton:hover .icon { transform: rotate(360deg); }

/* ── Forms / Inputs ──────────────────────────────── */
fieldset {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px 20px;
  margin-bottom: 16px;
  width: 100%;
}
legend {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  padding: 0 8px;
  background: var(--bg-card);
  font-weight: 600;
}

label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}
.form-row {
  margin-bottom: 14px;
}
.form-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.form-inline label { margin-bottom: 0; white-space: nowrap; }

input[type=text], input[type=number], input[type=datetime-local],
select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-data);
  font-size: 0.875rem;
  padding: 8px 12px;
  width: 100%;
  max-width: 100%;
  transition: border-color 0.15s;
}
input[type=text]:focus, input[type=number]:focus,
input[type=datetime-local]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--teal-glow);
}
input[type=text].smallTextBox, input[type=number].smallTextBox {
  width: 80px;
}
input.valid   { border-color: var(--green); }
input.invalid { border-color: var(--red); }

input[type=checkbox], input[type=radio] {
  width: 18px; height: 18px;
  accent-color: var(--teal);
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.checkbox-row label { margin-bottom: 0; cursor: pointer; }

.radio-group { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.radio-option {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.radio-option:hover { border-color: var(--teal-dim); background: var(--bg-hover); }
.radio-option.selected { border-color: var(--teal); background: var(--teal-glow); }
.radio-option input { margin-top: 2px; }
.radio-option .opt-label { font-size: 0.9rem; color: var(--text-primary); font-weight: 600; }
.radio-option .opt-desc  { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238fa3c0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
select option { background: var(--bg-card); color: var(--text-primary); }

textarea { resize: vertical; height: 80px; font-size: 0.8rem; }

/* ── Progress Bar ────────────────────────────────── */
progress {
  width: 100%;
  height: 8px;
  border: none;
  border-radius: 4px;
  background: var(--bg-input);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--bg-input); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--teal); border-radius: 4px; transition: width 0.3s; }
progress::-moz-progress-bar { background: var(--teal); border-radius: 4px; }

/* ── Progress steps (wizard) ─────────────────────── */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 20px 0 28px;
}
.step-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700;
  color: var(--text-muted);
  transition: all 0.25s;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.step-dot.active  { background: var(--teal); border-color: var(--teal); color: #0b0f1c; box-shadow: var(--shadow-glow); }
.step-dot.done    { background: var(--teal-dim); border-color: var(--teal-dim); color: var(--text-primary); }
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  max-width: 60px;
  transition: background 0.25s;
}
.step-line.done { background: var(--teal-dim); }

/* ── Wizard panels ───────────────────────────────── */
.wizard-panel { display: none; animation: fadeSlide 0.3s ease; }
.wizard-panel.active { display: block; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wizard-question {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 18px;
  line-height: 1.5;
}

/* ── Alerts / Messages ───────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 0.85rem;
}
.alert-warn    { background: rgba(245,158,11,0.12); border: 1px solid var(--amber-dim); color: var(--amber); }
.alert-error   { background: rgba(239,68,68,0.12);  border: 1px solid var(--red-dim);   color: var(--red); }
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid var(--green-dim); color: var(--green); }
.alert-info    { background: var(--teal-glow);       border: 1px solid var(--teal-dim);  color: var(--teal); }

/* Legacy classes */
.error, .warning, .systemTimeWarning { color: var(--red); font-size: 0.78rem; margin: 4px 0; display: block; }
.success { color: var(--green); font-size: 0.78rem; }

/* ── Logging badge (always-on) ───────────────────── */
.logging-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(16,185,129,0.1);
  border: 1px solid var(--green-dim);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.72rem;
  color: var(--green);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.logging-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Charts ──────────────────────────────────────── */
.chart-container {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}
canvas {
  display: block;
  width: 100% !important;
  height: 220px !important;
  max-width: 100%;
}

/* ── Links ───────────────────────────────────────── */
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--text-data); }

/* ── Back navigation ─────────────────────────────── */
.nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  text-decoration: none;
  margin-bottom: 20px;
  transition: color 0.15s;
}
.nav-back:hover { color: var(--teal); text-decoration: none; }

/* ── Menu grid ───────────────────────────────────── */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}
.menu-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; flex-direction: column;
  align-items: center; gap: 10px;
}
.menu-tile:hover {
  border-color: var(--teal-dim);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  text-decoration: none;
}
.menu-tile-icon { font-size: 1.8rem; }
.menu-tile-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
}
.menu-tile-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Diagnostics ─────────────────────────────────── */
.divDiagnostics {
  background: rgba(45,179,200,0.06);
  border-left: 3px solid var(--teal-dim);
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 12px 16px;
  margin: 12px 0;
  font-family: var(--font-data);
}
.divNotes {
  background: rgba(245,158,11,0.06);
  border-left: 3px solid var(--amber-dim);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 12px 0;
}
.pNotes { font-size: 0.78rem; color: var(--text-secondary); }

/* ── Tooltip (wenk override) ──────────────────────── */
[data-wenk]:after {
  font-family: var(--font-ui) !important;
  background-color: #1c2640 !important;
  border: 1px solid var(--border) !important;
  font-size: 0.75rem !important;
}

/* ── Upload progress ─────────────────────────────── */
#prg {
  background: var(--teal);
  height: 8px;
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 480px) {
  .menu-grid { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: 1fr 1fr; }
  .btn-lg { width: 100%; }
  h1 { font-size: 1.35rem; }
}

/* ── Mobile-first improvements (≤ 430px — most phones) ── */
@media (max-width: 430px) {
  /* Tighter body padding on narrow screens */
  body { padding: 0 10px 32px; }

  /* Header: allow wrapping, reduce logo + title size */
  .syp-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0 10px;
    margin-bottom: 16px;
  }
  .syp-logo { height: 28px; }
  .syp-title { display: none; }

  /* Back-to-site fixed button: smaller + nudge clear of header */
  .back-main-btn {
    top: 6px !important;
    left: 6px !important;
    font-size: 0.68rem !important;
    padding: 4px 10px !important;
  }

  /* Logging badge: smaller */
  .logging-badge { font-size: 0.65rem; padding: 3px 8px; }

  /* Theme toggle: smaller */
  .theme-toggle { font-size: 0.7rem; padding: 4px 8px; }

  /* Cards / fieldsets: reduce padding */
  .card { padding: 14px 12px; }
  fieldset { padding: 12px 12px 16px; }

  /* Buttons: ensure minimum 44px touch target height */
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn-lg { min-height: 48px; font-size: 0.95rem; padding: 12px 20px; }
  .smallBlueButton { min-height: 36px; padding: 6px 12px; font-size: 0.78rem; }

  /* Full-width buttons in button rows */
  .btn-row { flex-direction: column; }
  .btn-row .btn { width: 100%; }

  /* Tables: scroll horizontally rather than breaking layout */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 280px; }

  /* Wizard step indicators: slightly smaller */
  .step-dot { width: 26px; height: 26px; font-size: 0.75rem; }

  /* form-inline: stack vertically (label above input) */
  .form-inline { flex-direction: column; align-items: flex-start; gap: 6px; }
  .form-inline label { white-space: normal; }

  /* Vial number labels: hide on mobile (too small to read) */
  .vial-lbl { display: none; }

  /* Nav back: slightly larger touch area */
  .nav-back { padding: 4px 0; margin-bottom: 14px; }

  /* Stat values: don't let them shrink too small */
  .stat-value { font-size: 1rem; }
}
