/* ========================================================================== */
/*                                ROOT VARIABLES                               */
/* ========================================================================== */

:root {
  --bg: #0d111a;
  --panel: #151b26;
  --elev: #1b222f;
  --txt: #d5d7db;
  --dim: #8e95a1;
  --acc: #ff3b30;
  --ok: #00ff88;
  --bad: #ff4d4d;
  --radius: 12px;
}

/* ========================================================================== */
/*                                 GLOBAL RESET                                */
/* ========================================================================== */

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

body {
  background: var(--bg);
  color: var(--txt);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
}

/* Main container */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ========================================================================== */
/*                                    TABS                                     */
/* ========================================================================== */

.tabs {
  display: flex;
  background: var(--panel);
  border-radius: var(--radius);
  margin: 10px;
  overflow: hidden;
}

.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  color: var(--dim);
  cursor: pointer;
  transition: 0.2s;
  font-weight: 600;
}

.tab.active {
  background: var(--elev);
  color: var(--acc);
  box-shadow: inset 0 0 12px rgba(255, 59, 48, 0.2);
}

/* ========================================================================== */
/*                                   PANELS                                    */
/* ========================================================================== */

.panel {
  flex: 1;
  background: var(--panel);
  margin: 10px;
  border-radius: var(--radius);
  padding: 14px;
  overflow: auto;
}

.section {
  background: var(--elev);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

/* Titles inside sections */
.section h3 {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

/* ========================================================================== */
/*                                FORM ELEMENTS                                */
/* ========================================================================== */

label {
  display: block;
  margin-top: 8px;
  color: var(--txt);
}

input,
select {
  width: 100%;
  background: var(--elev);
  color: var(--txt);
  border: none;
  border-radius: 10px;
  padding: 5px;
  margin-top: 6px;
}

/* ========================================================================== */
/*                                   BUTTONS                                   */
/* ========================================================================== */

button {
  background: var(--elev);
  color: #333;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 4px 15px;
  cursor: pointer;
  transition: 0.2s;
}

button:hover {
  background: var(--acc);
  color: #fff;
}

.btn-primary {
  background: #7b5cff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary:hover {
  background: #6d4ee0;
}

.btn-danger {
  background: #ff4d4d;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.btn-danger:hover {
  background: #d94141;
}

/* ========================================================================== */
/*                                 CONSOLE BOX                                 */
/* ========================================================================== */

.console-box {
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px;
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.4;
  overflow: auto;
  height: 280px;
  color: #c9d1d9;
}

/* ========================================================================== */
/*                                OVERVIEW GRID                                */
/* ========================================================================== */

.overview-grid {
  display: grid;
  grid-template-columns: 30% 70%;
  gap: 16px;
  margin-top: 12px;
  align-items: start;
}

/* Left panel (simulation/live) */
.control-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
  min-height: 400px;
}

/* Right panel (network/debug) */
.network-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.network-panel .console-box {
  flex: 1;
  height: auto;
  min-height: 420px;
}

/* ========================================================================== */
/*                               STATUS INDICATORS                             */
/* ========================================================================== */

.state-connected {
  color: var(--ok);
}

.state-waiting {
  color: #ffd166;
}

.state-error {
  color: var(--bad);
}

.state-neutral {
  color: #aaa;
}

/* Main status line */
.status-line {
  margin-top: 10px;
  font-family: Consolas, monospace;
  font-size: 13px;
  color: #aaa;
}

/* ========================================================================== */
/*                                   CHART                                     */
/* ========================================================================== */

#cvd-chart {
  background: #0d1117;
  min-height: 160px;
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 10px;
  margin-top: 8px;
}

/* ========================================================================== */
/*                                  ICEBERGS                                   */
/* ========================================================================== */

.iceberg-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: #66c8ff;
  margin-bottom: 10px;
}

.iceberg-history {
  margin-top: 12px;
  background: #0d131f;
  border: 1px solid #1e2a3a;
  border-radius: 10px;
  padding: 10px;
  max-height: 200px;
  overflow-y: auto;
  font-family: Consolas, monospace;
  font-size: 13px;
}

.iceberg-history .sell {
  color: #ff4d4d;
  font-weight: bold;
}

.iceberg-history .buy {
  color: #00ff88;
  font-weight: bold;
}

/* ========================================================================== */
/*                                 CVD / RSI                                   */
/* ========================================================================== */

#analytics-grid {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

#analytics-grid > div {
  flex: 1;
}

#cvd-module,
#rsi-module,
#iceberg-module {
  background: var(--elev);
  border-radius: var(--radius);
  padding: 12px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

#cvd-module h3,
#rsi-module h3,
#iceberg-module h3 {
  color: #66c8ff;
  margin-bottom: 8px;
  font-size: 15px;
}

/* ========================================================================== */
/*                             CVD SENSITIVITY SLIDER                          */
/* ========================================================================== */

#cvd-sens {
  -webkit-appearance: none;
  width: 60%;
  height: 6px;
  background: linear-gradient(90deg, #ff8181, #ff5454, #ff0000);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}

#cvd-sens::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #ff0000;
  border-radius: 50%;
  border: 1px solid #fff;
  box-shadow: 0 0 6px #ff000066;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

/* ========================================================================== */
/*                                TOGGLE SWITCH                                */
/* ========================================================================== */

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  background-color: #444;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 20px;
  transition: 0.3s;
}

.slider:before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .slider {
  background-color: #e33;
}

input:checked + .slider:before {
  transform: translateX(18px);
}

/* ========================================================================== */
/*                             MANUAL ARM PANEL                                */
/* ========================================================================== */

#manual-arm-panel {
  position: absolute;
  top: 85px;
  right: 30px;
  z-index: 9999;
  display: flex;
  gap: 10px;
}

#manual-arm-panel button {
  padding: 2px 15px;
  font-size: 14px;
  border-radius: 6px;
  background: #171d26;
  color: #ccc;
  transition: 0.15s;
}

#manual-arm-panel button:hover {
  background: #222a35;
  border-color: #4ea3ff;
  color: #fff;
}

#btnArmBuy {
  color: #00ff88;
  border-color: #00ff8866;
}

#btnArmSell {
  color: #ff4d4d;
  border-color: #ff4d4d66;
}

/* ========================================================================== */
/*                                RESPONSIVE                                   */
/* ========================================================================== */

@media (max-width: 900px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
  .network-panel {
    margin-top: 12px;
  }
}

@media (max-width: 1000px) {
  #analytics-grid {
    flex-direction: column;
  }
}



/* =========================================================
   CVD MODULE —  styles 
   ========================================================= */

#cvd-module, #iceberg-module, #rsi-module{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#cvd-module h3, #iceberg-module h3, #rsi-module h3, #box-signals-chart h3 {
  display: flex; 
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  color: #66c8ff;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 4px;
}

#cvd-toggle, #iceberg-toggle, #rsi-toggle, #box-toggle {
  background: none;
  border: none;
  color: #9cf;
  cursor: pointer;
}

/* SETTINGS PANEL */
#cvd-settings,  #iceberg-settings, #rsi-settings, #box-settings {
  display: none;
  margin-bottom: 12px;
}

.settings-box {
  background: #1a1f2b;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

/* Header inside settings */
.box-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.box-settings-header h4 {
  margin: 0;
  font-size: 14px;
}


.row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.row label {
  font-family: Consolas, monospace;
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.5;
}
.ice-grid, .rsi-grid, .box-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  align-items: center;
}

.input-num {
  width: 60px;
  text-align: center;
  background: #0e1118;
  color: #e33;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 6px;
}

.input-num-wide {
  width: 70px;
  text-align: center;
  background: #0e1118;
  color: #e33;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 6px;
}

/* Strict mode toggle */
#ice-strict {
  width: 48px;
  height: 24px;
  border-radius: 24px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s ease;
}

#ice-strict .toggle-knob {
  position: absolute;
  top: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.3s ease;
}
.rsi-select {
  width: 90px;
  text-align: center;
  background: #0e1118;
  color: #e33;
  border: 1px solid #333;
  border-radius: 6px;
}

#resetPnLBtn {
  background: #2a3245;
  color: #ff6b6b;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  font-family: Consolas, monospace;
}
/* Status panel */
#box-status {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #333;
  border-radius: 8px;
}
.status-grid {
  font-family: Consolas, monospace;
  font-size: 13px;
  color: #ddd;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  height: 100%;
}

#multi-container {
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #aaa;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-right: 10px;
}

/* Divergence counters */
.div-counter {
  border-radius: 4px;
  padding: 2px 6px;
  font-family: Consolas, monospace;
  font-size: 13px;
}

#divBearCount {
  background: #2a1c1c;
  color: #ff4d4d;
  border: 1px solid #ff4d4d;
}

#divBullCount {
  background: #102a18;
  color: #00ff88;
  border: 1px solid #00ff88;
}

.cvd-sens {
  width: 60%;
}

#cvd-bias, #ice-bias {
  color: #ccc;
}

/* STATS */
.cvd-stats, .ice-stats {
  font-family: Consolas, monospace;
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.5;
}



/* MOMENTUM BAR */
#cvd-momentum {
  position: relative;
  height: 8px;
  width: 100%;
  background: #333;
  border-radius: 6px;
  overflow: hidden;
}

#cvd-center {
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  background: #555;
}

#cvd-bar {
  position: absolute;
  top: 0;
  height: 100%;
  width: 0%;
  background: #999;
  border-radius: 0;
  transition: all 0.25s ease;
}

/* DIVERGENCES LIST */
#cvd-list, #ice-list, #rsi-list {
  background: #0d131f;
  border: 1px solid #1e2a3a;
  border-radius: 10px;
  padding: 8px;
  max-height: 180px;
  overflow: auto;
  font-family: Consolas, monospace;
  font-size: 13px;
}

#cvd-list .placeholder, #ice-list .placeholder, #rsi-list .placeholder {
  color: #666;
}


/* Signal log console */
.console-box {
  background: #0e1118;
  color: #ccc;
  font-family: Consolas, monospace;
  height: 600px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #333;
}

#box-signals{margin-top:10px;}

#box-status h4{display:flex; justify-content:space-between;}






