/* settings_panel.css — Saltybot Settings (Issue #614) */

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

:root {
  --bg0:   #050510;
  --bg1:   #070712;
  --bg2:   #0a0a1a;
  --bd:    #0c2a3a;
  --bd2:   #1e3a5f;
  --dim:   #374151;
  --mid:   #6b7280;
  --base:  #9ca3af;
  --hi:    #d1d5db;
  --cyan:  #06b6d4;
  --green: #22c55e;
  --amber: #f59e0b;
  --red:   #ef4444;
}

body {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  background: var(--bg0);
  color: var(--base);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Header ── */
#header {
  display: flex;
  align-items: center;
  padding: 5px 12px;
  background: var(--bg1);
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: wrap;
}
.logo { color: #f97316; font-weight: bold; letter-spacing: .15em; font-size: 13px; flex-shrink: 0; }

#conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dim); flex-shrink: 0; transition: background .3s;
}
#conn-dot.connected { background: var(--green); }
#conn-dot.error     { background: var(--red); animation: blink 1s infinite; }

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }
@keyframes fadeout { 0%{opacity:1} 70%{opacity:1} 100%{opacity:0} }

.save-ind {
  font-size: 10px; font-weight: bold; letter-spacing: .1em;
  color: var(--green); padding: 2px 8px;
  border: 1px solid var(--green); border-radius: 3px;
  animation: fadeout 2s forwards;
}
.save-ind.hidden { display: none; }

#ws-input {
  background: var(--bg2); border: 1px solid var(--bd2); border-radius: 4px;
  color: #67e8f9; padding: 2px 7px; font-family: monospace; font-size: 11px; width: 185px;
}
#ws-input:focus { outline: none; border-color: var(--cyan); }

.hbtn {
  padding: 2px 8px; border-radius: 4px; border: 1px solid var(--bd2);
  background: var(--bg2); color: #67e8f9; font-family: monospace;
  font-size: 10px; font-weight: bold; cursor: pointer; transition: background .15s;
  white-space: nowrap;
}
.hbtn:hover { background: #0e4f69; }
.apply-btn { border-color: #14532d; color: #86efac; }
.apply-btn:hover { background: #052010; }
.del-btn { border-color: #7f1d1d; color: #fca5a5; }
.del-btn:hover { background: #1c0505; }

/* ── Tab bar ── */
#tab-bar {
  display: flex;
  background: var(--bg1);
  border-bottom: 1px solid var(--bd);
  flex-shrink: 0;
  padding: 0 12px;
  gap: 2px;
}
.tab-btn {
  padding: 6px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--mid);
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: .1em;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--base); }
.tab-btn.active { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ── Main ── */
#main {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
}

/* ── Tab panels ── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 860px;
  margin: 0 auto;
}

/* ── Section card ── */
.section-card {
  background: var(--bg2);
  border: 1px solid var(--bd2);
  border-radius: 8px;
  padding: 12px;
}
.sec-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 8px;
  flex-wrap: wrap;
}
.sec-title {
  font-size: 11px; font-weight: bold; letter-spacing: .1em;
  color: #67e8f9; text-transform: uppercase;
}
.sec-node {
  font-size: 9px; color: var(--mid); margin-top: 2px;
}
.sec-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Parameter fields ── */
.param-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px 50px;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--bd);
}
.param-row:last-child { border-bottom: none; }
.param-label { font-size: 10px; color: var(--mid); }
.param-unit  { font-size: 9px;  color: var(--dim); text-align: right; }

/* Slider */
.param-slider {
  -webkit-appearance: none;
  width: 100%; height: 4px; border-radius: 2px;
  background: var(--bd2); outline: none; cursor: pointer;
}
.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--cyan); cursor: pointer;
}
.param-slider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--cyan); cursor: pointer; border: none;
}
.param-slider.changed::-webkit-slider-thumb { background: var(--amber); }
.param-slider.changed::-moz-range-thumb     { background: var(--amber); }

/* Number input */
.param-input {
  background: var(--bg0); border: 1px solid var(--bd2);
  border-radius: 3px; color: var(--hi); padding: 2px 5px;
  font-family: monospace; font-size: 10px; text-align: right;
  width: 72px;
}
.param-input:focus { outline: none; border-color: var(--cyan); }
.param-input.changed { border-color: var(--amber); color: var(--amber); }

/* Toggle switch */
.toggle-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--bd);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-desc { font-size: 9px; color: var(--dim); }

.toggle-switch {
  position: relative;
  width: 36px; height: 18px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--dim); border-radius: 9px; cursor: pointer;
  transition: background .2s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--cyan); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(18px); }

/* Status / feedback line */
.sec-status {
  margin-top: 6px;
  font-size: 9px;
  min-height: 14px;
  transition: color .3s;
}
.sec-status.ok     { color: var(--green); }
.sec-status.err    { color: var(--red); }
.sec-status.loading { color: var(--amber); }

/* ── System tab ── */
.diag-placeholder {
  color: var(--dim); font-size: 10px; padding: 12px 0; text-align: center;
}
#diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.diag-card {
  background: var(--bg0);
  border: 1px solid var(--bd);
  border-radius: 5px;
  padding: 8px;
}
.diag-card-title {
  font-size: 9px; font-weight: bold; letter-spacing: .08em;
  color: #0891b2; margin-bottom: 5px; text-transform: uppercase;
}
.diag-kv {
  display: flex; justify-content: space-between;
  padding: 2px 0; font-size: 9px;
  border-bottom: 1px solid var(--bd);
}
.diag-kv:last-child { border-bottom: none; }
.diag-k { color: var(--mid); }
.diag-v { color: var(--hi); font-family: monospace; }
.diag-v.ok    { color: var(--green); }
.diag-v.warn  { color: var(--amber); }
.diag-v.err   { color: var(--red); }

#net-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

/* Signal bars */
.sig-bars {
  display: inline-flex; align-items: flex-end; gap: 2px; height: 14px;
}
.sig-bar {
  width: 4px; border-radius: 1px; background: var(--dim);
}
.sig-bar.lit { background: var(--cyan); }

/* Node list */
#node-list-wrap {
  display: flex; flex-wrap: wrap; gap: 4px;
  max-height: 160px; overflow-y: auto;
}
.node-chip {
  font-size: 9px; padding: 1px 6px; border-radius: 2px;
  border: 1px solid var(--bd); background: var(--bg0);
  color: var(--mid);
}
.node-chip.active-node { border-color: var(--bd2); color: var(--base); }

/* ── Preset bar ── */
#preset-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--bg1);
  border-top: 1px solid var(--bd);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.plbl { font-size: 10px; color: var(--mid); letter-spacing: .08em; }

#preset-select {
  background: var(--bg2); border: 1px solid var(--bd2); border-radius: 4px;
  color: #67e8f9; padding: 2px 6px; font-family: monospace; font-size: 10px;
  cursor: pointer;
}
#preset-select:focus { outline: none; }

#preset-name {
  background: var(--bg2); border: 1px solid var(--bd2); border-radius: 4px;
  color: var(--hi); padding: 2px 7px; font-family: monospace; font-size: 11px; width: 140px;
}
#preset-name:focus { outline: none; border-color: var(--cyan); }

/* ── Footer ── */
#footer {
  background: var(--bg1); border-top: 1px solid var(--bd);
  padding: 3px 12px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; font-size: 10px; color: var(--dim);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .param-row {
    grid-template-columns: 140px 1fr 70px 44px;
    gap: 5px;
  }
  #diag-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  .param-row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }
  .param-label { grid-column: 1 / 3; }
  .param-unit  { text-align: left; }
}
