/* Arbitrading Bot — Dark theme dashboard (v5.1) */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #0f1419;
  color: #e6e6e6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: #11161c;
  border-bottom: 1px solid #1f2933;
  position: sticky;
  top: 0;
  z-index: 10;
}
header h1 { margin: 0; font-size: 20px; color: #4fc3f7; }
.header-right { display: flex; align-items: center; gap: 14px; }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 20px;
}

.panel {
  background: #151b22;
  border: 1px solid #1f2933;
  border-radius: 8px;
  padding: 18px 20px;
}
.panel h2 {
  margin: 0 0 14px 0;
  font-size: 16px;
  color: #f0f0f0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.cat-legend {
  float: right;
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #9aa4b1;
}

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.badge-idle    { background: #37424f; color: #c2d1e0; }
.badge-running { background: #2e7d32; color: #e8f5e9; }
.badge-error   { background: #c62828; color: #ffebee; }

.logout {
  color: #7fa7c7;
  text-decoration: none;
  font-size: 13px;
}
.logout:hover { color: #fff; }

/* ---------- Price hero ---------- */
.price-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.price-hero-left { display: flex; flex-direction: column; gap: 6px; }
.price-hero-label {
  display: flex; align-items: center; gap: 8px;
  color: #f0f0f0;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.lock-icon {
  color: #6b7885;
  font-size: 12px;
  cursor: help;
}
.price-hero-value {
  color: #4fc3f7;
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.price-hero-right {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex: 1 1 500px;
  max-width: 720px;
}
.trigger-box {
  background: #0f1419;
  border: 1px solid #1f2933;
  border-radius: 6px;
  padding: 10px 12px;
}
.trigger-label {
  color: #f0f0f0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}
#trigger-buy  .trigger-label { color: #81c784; }
#trigger-sell .trigger-label { color: #ef9a9a; }
.trigger-value {
  font-size: 15px;
  font-weight: 600;
  color: #e6e6e6;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.trigger-distance {
  color: #9aa4b1;
  font-size: 12px;
  margin: 3px 0 6px 0;
}
.trigger-bar {
  background: #1f2933;
  border-radius: 3px;
  height: 6px;
  overflow: hidden;
}
.trigger-bar-fill {
  height: 100%;
  transition: width 0.5s ease;
}
.trigger-bar-fill.buy  { background: linear-gradient(90deg, #2e7d32, #66bb6a); }
.trigger-bar-fill.sell { background: linear-gradient(90deg, #c62828, #ef5350); }

/* ---------- Metrics grid ---------- */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.metric {
  background: #0f1419;
  border: 1px solid #1f2933;
  padding: 10px 12px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}
.metric-label {
  color: #f0f0f0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.metric span:last-child {
  color: #e6e6e6;
  font-size: 15px;
  font-weight: 500;
  word-break: break-all;
}

.resume-info {
  margin-top: 10px;
  font-size: 12px;
  color: #9aa4b1;
}
.resume-info.resumed { color: #81c784; }
.resume-info.fresh   { color: #ffb74d; }

/* ---------- Controls ---------- */
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  transition: opacity 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:not(:disabled):hover { opacity: 0.85; }
.btn-green  { background: #2e7d32; }
.btn-red    { background: #c62828; }
.btn-orange { background: #ef6c00; }
.btn-blue   { background: #1976d2; }

.btn-mini {
  padding: 6px 12px;
  background: #37424f;
  color: #f0f0f0;
  border: 1px solid #1f2933;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-mini:hover { background: #455162; }

.msg {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  min-height: 20px;
}
.msg.ok    { background: #1b5e20; color: #e8f5e9; }
.msg.error { background: #b71c1c; color: #ffebee; }

.pending-info {
  display: none;
  margin-top: 10px;
  padding: 8px 12px;
  background: #4a2c00;
  border-left: 3px solid #ef6c00;
  color: #ffe0b2;
  font-size: 12px;
  border-radius: 4px;
}
.pending-info.visible { display: block; }

.msg-inline {
  margin-top: 6px;
  font-size: 12px;
  min-height: 16px;
}
.msg-inline.ok    { color: #81c784; }
.msg-inline.error { color: #ef9a9a; }

/* ---------- Config form ---------- */
.cfg-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.cfg-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 3px solid transparent;
  background: #0f1419;
}
.cfg-row[data-cat="LIVE"]       { border-left-color: #2e7d32; }
.cfg-row[data-cat="NEXT_CYCLE"] { border-left-color: #ef6c00; }
.cfg-row[data-cat="RESTART"]    { border-left-color: #c62828; }

.cfg-row label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #f0f0f0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cfg-row input,
.cfg-row select {
  background: #11161c;
  border: 1px solid #1f2933;
  color: #e6e6e6;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.cfg-row input:focus,
.cfg-row select:focus {
  outline: none;
  border-color: #4fc3f7;
}

/* Category badges */
.cat-badge {
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #0f1419;
}
.cat-live    { background: #66bb6a; }
.cat-next    { background: #ffb74d; }
.cat-restart { background: #ef5350; color: #fff; }

.symbol-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
}

.cfg-notice {
  margin-top: 14px;
  padding: 10px 12px;
  background: #1f2933;
  border-left: 3px solid #4fc3f7;
  color: #e6e6e6;
  font-size: 12px;
  border-radius: 4px;
}
.cfg-notice strong { color: #f0f0f0; }

/* ---------- VIP Config (Promote 2) ---------- */
.vip-config-wrap {
  grid-column: 1 / -1;
  margin-top: 14px;
  padding: 14px;
  background: #0d1218;
  border: 1px solid #2e7d32;
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.vip-config-wrap.hidden { display: none; }
.vip-config-header {
  grid-column: 1 / -1;
  color: #66bb6a;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 4px;
  border-bottom: 1px solid #1f2933;
}
.cfg-row-full {
  grid-column: 1 / -1;
}
.vip-config-wrap textarea {
  background: #11161c;
  border: 1px solid #1f2933;
  color: #e6e6e6;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-family: "Consolas", "Courier New", monospace;
  resize: vertical;
  min-height: 90px;
}
.vip-config-wrap textarea:focus {
  outline: none;
  border-color: #4fc3f7;
}
.vip-config-hint {
  grid-column: 1 / -1;
  color: #9aa4b1;
  font-size: 12px;
  line-height: 1.55;
  padding: 8px 10px;
  background: #11161c;
  border-radius: 4px;
}
.vip-config-hint code {
  background: #0f1419;
  padding: 1px 5px;
  border-radius: 3px;
  color: #4fc3f7;
}

/* ---------- ATR panel ---------- */
.atr-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.atr-controls label {
  color: #f0f0f0;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}
.atr-controls select {
  background: #11161c;
  border: 1px solid #1f2933;
  color: #e6e6e6;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
}
.atr-result {
  color: #e6e6e6;
  font-size: 13px;
  margin-left: 10px;
}
.atr-hint {
  margin-top: 10px;
  color: #9aa4b1;
  font-size: 12px;
}
.atr-hint code {
  background: #11161c;
  padding: 1px 5px;
  border-radius: 3px;
  color: #4fc3f7;
  font-size: 12px;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th, td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #1f2933;
}
th {
  color: #f0f0f0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
  background: #11161c;
}
tr:hover td { background: #1a222b; }

/* ---------- Login page ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
}
.login-box {
  background: #151b22;
  border: 1px solid #1f2933;
  padding: 40px;
  border-radius: 8px;
  width: 320px;
}
.login-box h1 { margin: 0 0 24px 0; color: #4fc3f7; font-size: 22px; }
.login-box label {
  color: #f0f0f0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.login-password-wrap {
  position: relative;
  margin-bottom: 16px;
}
.login-password-wrap input {
  width: 100%;
  background: #0f1419;
  border: 1px solid #1f2933;
  color: #e6e6e6;
  padding: 10px 40px 10px 12px;
  border-radius: 4px;
  font-size: 14px;
}
.login-password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #6b7885;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  line-height: 1;
}
.login-password-toggle:hover { color: #e6e6e6; }
.login-box button.login-submit {
  width: 100%;
  padding: 10px;
  background: #4fc3f7;
  color: #0f1419;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.login-box .error {
  margin-top: 14px;
  padding: 8px 10px;
  background: #b71c1c;
  color: #ffebee;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 800px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .cfg-form { grid-template-columns: 1fr; }
  .symbol-row { grid-template-columns: 1fr; }
  .price-hero-right { grid-template-columns: 1fr; }
  .price-hero-value { font-size: 24px; }
}

/* ---------- Help icon (?) for VIP field tooltips ---------- */
.help-q {
  display: inline-block;
  width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  background: #37424f;
  color: #f0f0f0;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  margin: 0 4px;
  vertical-align: middle;
  text-transform: none;
}
.help-q:hover { background: #4fc3f7; color: #0f1419; }

/* ---------- Staging banner (Phase 6) ---------- */
.staging-banner {
  background: #c62828;
  color: #fff;
  text-align: center;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid #b71c1c;
}
.staging-banner-login {
  position: static;
  margin-bottom: 20px;
  border-radius: 6px;
}
