/* ═══ KB Charts — dark theme vert KB ═══ */
:root {
  --bg: #0b0f0d;
  --panel: #121815;
  --panel-2: #1a231e;
  --border: #243029;
  --text: #d7e2dc;
  --text-dim: #7d8f86;
  --green: #22c55e;
  --red: #ef4444;
  --orange: #f59e0b;
  --blue: #3b82f6;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ═══ LOGIN ═══ */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  height: 100vh;
}
.login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  width: min(360px, 90vw);
}
.login-logo {
  width: 140px; height: 140px;
  border-radius: 20px;
  margin-bottom: 16px;
  box-shadow: 0 0 40px rgba(34, 197, 94, .25);
}
.login-box h1 { font-size: 28px; margin-bottom: 8px; letter-spacing: 3px; }
.login-box p { color: var(--text-dim); margin-bottom: 24px; }
.login-box input {
  width: 100%; padding: 12px 16px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 16px; margin-bottom: 12px;
}
.login-box button {
  width: 100%; padding: 12px;
  background: var(--green); color: #06130b;
  border: none; border-radius: 10px;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.login-box button:hover { filter: brightness(1.1); }
#login-error { color: var(--red); margin-top: 12px; min-height: 20px; font-size: 14px; }

/* ═══ LAYOUT ═══ */
#app { display: flex; height: 100vh; }

#sidebar {
  width: 260px; min-width: 260px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}

.brand { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.brand-title { font-size: 16px; font-weight: 800; letter-spacing: 2px; display: flex; align-items: center; gap: 8px; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; }
#sidebar-close { display: none; background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; }

.section-title {
  color: var(--text-dim);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  margin: 14px 0 6px;
}

/* watchlist */
.watch-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
}
.watch-item:hover { background: var(--panel-2); }
.watch-item.active { background: var(--panel-2); border-color: var(--green); }
.watch-item .sym { font-weight: 700; font-size: 14px; }
.watch-item .price-block { text-align: right; font-size: 12px; }
.watch-item .p { color: var(--text); }
.watch-item .chg.up { color: var(--green); }
.watch-item .chg.down { color: var(--red); }
.watch-item .del {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 12px; margin-left: 6px; visibility: hidden;
}
.watch-item:hover .del { visibility: visible; }
.watch-item .del:hover { color: var(--red); }

.add-symbol { display: flex; gap: 6px; margin-top: 6px; }
.add-symbol input {
  flex: 1; min-width: 0; padding: 8px 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.add-symbol button {
  padding: 8px 14px; background: var(--panel-2); color: var(--green);
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.add-symbol button:hover { border-color: var(--green); }
#add-error { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 4px; }

/* toggles */
.toggle {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 4px; font-size: 13px; cursor: pointer; user-select: none;
}
.toggle input { accent-color: var(--green); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid #3a4a40; }
.dot-ben { background: linear-gradient(90deg, #dc2626 50%, #f4f4f5 50%); }
.dot-km { background: linear-gradient(90deg, #22c55e 50%, #a855f7 50%); }
.dot-kb { background: linear-gradient(90deg, #22d3ee 50%, #f97316 50%); }

/* signaux récents */
#signal-list { display: flex; flex-direction: column; gap: 4px; }
.sig-item {
  font-size: 12px; padding: 6px 8px;
  background: var(--panel-2); border-radius: 6px;
  display: flex; justify-content: space-between; gap: 6px;
}
.sig-item .side-buy { color: var(--green); font-weight: 700; }
.sig-item .side-sell { color: var(--red); font-weight: 700; }
.sig-item .meta { color: var(--text-dim); }
.sig-empty { color: var(--text-dim); font-size: 12px; padding: 4px; }

.sidebar-footer { margin-top: auto; padding-top: 16px; }
#logout-btn {
  width: 100%; padding: 8px; background: none;
  color: var(--text-dim); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 12px;
}

/* ═══ MAIN ═══ */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
#sidebar-open { display: none; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }

#coin-info { display: flex; align-items: baseline; gap: 12px; flex: 1; min-width: 0; }
#coin-name { font-size: 18px; font-weight: 800; }
#coin-price { font-size: 18px; font-weight: 600; }
#coin-change { font-size: 14px; }
#coin-change.up { color: var(--green); }
#coin-change.down { color: var(--red); }

#tf-buttons { display: flex; gap: 4px; }
#tf-buttons button {
  padding: 6px 14px; background: none;
  color: var(--text-dim); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 13px;
}
#tf-buttons button.active { background: var(--panel-2); color: var(--green); border-color: var(--green); }
#tf-buttons button:disabled { opacity: .3; cursor: not-allowed; }

#status-bar {
  padding: 6px 16px; font-size: 13px;
  color: var(--text-dim);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
#status-bar b { color: var(--text); }

#chart-container { flex: 1; min-height: 0; position: relative; }

#chart-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 15px;
  background: rgba(11, 15, 13, .7);
}

/* ═══ MOBILE ═══ */
@media (max-width: 800px) {
  #sidebar {
    position: fixed; z-index: 50; height: 100vh; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform .2s ease;
    width: 280px;
  }
  #sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.5); }
  #sidebar-close { display: block; }
  #sidebar-open { display: block; }
  #coin-name { font-size: 15px; }
  #coin-price { font-size: 15px; }
  #coin-change { display: none; }
  #topbar { gap: 8px; padding: 8px 10px; }
  #tf-buttons button { padding: 6px 10px; }
}
