/* Brimoza — ortak tasarım sistemi (modern koyu "trading terminal").
   Üç ekran da (Panel /, Çoklu-Bot /bots, Coin Analiz /analiz) bunu kullanır.
   Sınıf adları mevcut HTML/JS ile birebir korunur — yalnız görsel dil profesyonelleşir. */

:root {
  --bg:#090b0f; --bg2:#0d1015;
  --panel:#13171e; --panel2:#181d25; --elev:#1c222b;
  --bd:#242b35; --bd2:#1b212a; --bd3:#2e3640;
  --fg:#e7eaef; --dim:#9aa4b0; --muted:#646d78;
  --pos:#1ecb8b; --pos-d:#0c7d54; --neg:#f0495a; --neg-d:#8f2530; --warn:#f6b545; --accent:#4c8dff; --accent-d:#2f6fe0;
  --pos-bg:rgba(30,203,139,.12); --neg-bg:rgba(240,73,90,.12); --warn-bg:rgba(246,181,69,.12); --accent-bg:rgba(76,141,255,.12);
  --shadow:0 10px 34px rgba(0,0,0,.42); --shadow-sm:0 2px 10px rgba(0,0,0,.3);
  --radius:14px; --radius-sm:9px;
  --sidebar-w:236px; --topbar-h:60px;
  --mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace;
  --sans:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}

* { box-sizing:border-box; }
html,body { margin:0; }
body {
  background:var(--bg); color:var(--fg);
  font-family:var(--sans); font-size:14px; line-height:1.5; -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
a { color:var(--accent); text-decoration:none; }
::selection { background:var(--accent-bg); }

/* Scrollbar */
::-webkit-scrollbar { width:10px; height:10px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:#2a313b; border-radius:8px; border:2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background:#3a434f; }

/* Utilities */
.num { font-family:var(--mono); font-variant-numeric:tabular-nums; }
.pos { color:var(--pos); } .neg { color:var(--neg); } .muted { color:var(--muted); } .dim { color:var(--dim); } .warn { color:var(--warn); }
.right, .r { text-align:right; }

/* ===================== App shell ===================== */
.app { display:grid; grid-template-columns:var(--sidebar-w) 1fr; min-height:100vh; }

.sidebar {
  position:sticky; top:0; align-self:start; height:100vh; display:flex; flex-direction:column;
  background:linear-gradient(180deg, var(--bg2), var(--bg)); border-right:1px solid var(--bd2);
  padding:18px 14px; gap:6px; z-index:30;
}
.sidebar .brand { display:flex; align-items:center; gap:10px; padding:6px 10px 16px; font-weight:800; font-size:16.5px; letter-spacing:.2px; }
.sidebar .brand .logo {
  display:grid; place-items:center; width:30px; height:30px; border-radius:9px;
  background:linear-gradient(135deg, var(--accent), #6aa6ff); color:#06122b; font-size:15px; box-shadow:0 4px 14px rgba(76,141,255,.35);
}
.sidebar .brand-name { background:linear-gradient(90deg,#fff,#c7d2e0); -webkit-background-clip:text; background-clip:text; color:transparent; }
.sidebar .brand-sub { display:block; font-size:9.5px; font-weight:600; letter-spacing:1.6px; color:var(--muted); text-transform:uppercase; margin-top:1px; }

.nav { display:flex; flex-direction:column; gap:3px; margin-top:4px; }
.nav-label { font-size:9.5px; font-weight:700; letter-spacing:1.4px; text-transform:uppercase; color:var(--muted); padding:12px 12px 6px; }
.nav-item {
  display:flex; align-items:center; gap:11px; padding:10px 12px; border-radius:10px; color:var(--dim);
  font-weight:600; font-size:13.5px; letter-spacing:.2px; position:relative; transition:.14s; border:1px solid transparent;
}
.nav-item svg { width:18px; height:18px; flex:none; opacity:.85; }
.nav-item:hover { background:var(--panel); color:var(--fg); }
.nav-item.active { background:var(--accent-bg); color:#dbe7ff; border-color:rgba(76,141,255,.28); }
.nav-item.active svg { opacity:1; color:var(--accent); }
.nav-item.active::before { content:""; position:absolute; left:-14px; top:9px; bottom:9px; width:3px; border-radius:0 3px 3px 0; background:var(--accent); }
.sidebar-foot { margin-top:auto; display:flex; flex-direction:column; gap:10px; padding-top:14px; border-top:1px solid var(--bd2); }
.sidebar-foot .foot-meta { font-size:11px; color:var(--muted); padding:0 6px; line-height:1.6; }

.main { min-width:0; display:flex; flex-direction:column; }

/* Topbar */
.topbar {
  position:sticky; top:0; z-index:20; min-height:var(--topbar-h); display:flex; align-items:center; gap:16px;
  padding:12px 26px; background:rgba(11,13,17,.82); backdrop-filter:blur(12px); border-bottom:1px solid var(--bd2);
}
.topbar h1 { margin:0; font-size:16px; font-weight:700; letter-spacing:.2px; }
.topbar .topbar-sub { font-size:12px; color:var(--muted); }
.topbar-status { margin-left:auto; display:flex; align-items:center; gap:12px; flex-wrap:wrap; font-size:12px; color:var(--dim); }
.topbar-status .mode-badge, .topbar-status .updated { font-size:12px; color:var(--dim); white-space:nowrap; }
.topbar-status .mode-badge b { color:var(--fg); text-transform:uppercase; letter-spacing:.5px; }

/* Mobil: sidebar üstte yatay */
@media (max-width:820px) {
  .app { grid-template-columns:1fr; }
  .sidebar { position:static; height:auto; flex-direction:row; align-items:center; flex-wrap:wrap; padding:10px 14px; gap:8px; border-right:0; border-bottom:1px solid var(--bd2); }
  .sidebar .brand { padding:0 8px 0 4px; }
  .sidebar .brand-sub { display:none; }
  .nav { flex-direction:row; flex-wrap:wrap; margin-top:0; }
  .nav-label { display:none; }
  .nav-item.active::before { display:none; }
  .sidebar-foot { margin:0 0 0 auto; border-top:0; padding-top:0; flex-direction:row; }
  .sidebar-foot .foot-meta { display:none; }
}

/* Eski .appbar (geriye dönük güvenlik; yeni shell .sidebar+.topbar kullanır) */
.appbar { position:sticky; top:0; z-index:20; display:flex; align-items:center; gap:16px; padding:12px 22px;
  background:rgba(11,13,17,.82); backdrop-filter:blur(12px); border-bottom:1px solid var(--bd2); }
.appbar .brand { display:flex; align-items:baseline; gap:9px; font-weight:700; font-size:17px; }
.appbar-status { margin-left:auto; display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.brand .logo { color:var(--accent); }
.brand-sub { color:var(--muted); font-weight:500; font-size:11px; text-transform:uppercase; letter-spacing:1.5px; }

/* ===================== İçerik ===================== */
.wrap { width:100%; max-width:1320px; margin:0 auto; padding:24px 26px 40px; display:flex; flex-direction:column; gap:20px; }

.panel { background:var(--panel); border:1px solid var(--bd2); border-radius:var(--radius); box-shadow:var(--shadow-sm); overflow:hidden; }
.panel-head { display:flex; align-items:center; gap:11px; padding:15px 20px; border-bottom:1px solid var(--bd2); }
.panel-head h2 { margin:0; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:1.1px; color:var(--dim); }
.panel-sub { padding:10px 20px 0; font-size:12px; color:var(--muted); }
.badge { font-size:11px; font-weight:700; padding:2px 10px; border-radius:999px; background:var(--elev); color:var(--dim); border:1px solid var(--bd2); }

/* Pill (durum) */
.pill { display:inline-flex; align-items:center; gap:7px; padding:5px 12px; border-radius:999px; font-size:11.5px; font-weight:700; letter-spacing:.5px; border:1px solid var(--bd); }
.pill .dot { width:8px; height:8px; border-radius:50%; background:var(--muted); }
.pill.running { color:var(--pos); border-color:rgba(30,203,139,.4); background:var(--pos-bg); }
.pill.running .dot { background:var(--pos); box-shadow:0 0 0 0 rgba(30,203,139,.6); animation:pulse 1.8s infinite; }
.pill.stopped { color:var(--dim); background:rgba(255,255,255,.03); }
.pill.stopped .dot { background:var(--neg); }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(30,203,139,.5);} 70%{box-shadow:0 0 0 7px rgba(30,203,139,0);} 100%{box-shadow:0 0 0 0 rgba(30,203,139,0);} }

/* Butonlar */
.btn { display:inline-flex; align-items:center; gap:7px; border:1px solid var(--bd3); background:var(--panel2); color:var(--fg);
  border-radius:9px; padding:9px 15px; font-size:12.5px; font-weight:700; letter-spacing:.3px; cursor:pointer; transition:.13s; white-space:nowrap; }
.btn:hover { border-color:#3c4654; background:var(--elev); transform:translateY(-1px); }
.btn:active { transform:translateY(0); }
.btn:disabled { opacity:.5; cursor:default; transform:none; }
.btn.primary { background:linear-gradient(180deg,var(--accent),var(--accent-d)); border-color:var(--accent-d); color:#fff; box-shadow:0 4px 14px rgba(76,141,255,.28); }
.btn.primary:hover { filter:brightness(1.06); }
.btn.danger { background:transparent; border-color:rgba(240,73,90,.45); color:var(--neg); }
.btn.danger:hover { background:var(--neg-bg); border-color:var(--neg); color:var(--neg); }
.btn.ghost { background:transparent; color:var(--dim); border-color:var(--bd2); }
.btn.ghost:hover { color:var(--fg); border-color:var(--bd3); background:var(--panel); }
.btn.sm { padding:6px 11px; font-size:11.5px; }

/* Toolbar / form alanları */
.toolbar { padding:18px 20px; }
.tb-row { display:flex; align-items:flex-end; gap:14px; flex-wrap:wrap; }
.tb-actions { display:flex; align-items:center; gap:9px; margin-left:auto; flex-wrap:wrap; }
.sep { width:1px; height:28px; background:var(--bd2); margin:0 3px; }
.field { display:flex; flex-direction:column; gap:6px; }
.field label { font-size:10px; text-transform:uppercase; letter-spacing:.8px; color:var(--muted); }
select, input[type=text], input[type=number], input[type=password] {
  background:var(--bg2); color:var(--fg); border:1px solid var(--bd); border-radius:9px;
  padding:9px 12px; font-size:13px; outline:none; transition:.13s; font-family:inherit;
}
input[type=number] { width:130px; }
select:focus, input:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-bg); }
.toolbar select, .toolbar input[type=text] { min-width:180px; }

/* Metrik kartları */
.cards { display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:15px; }
.card { background:linear-gradient(180deg, var(--panel2), var(--panel)); border:1px solid var(--bd2);
  border-radius:var(--radius); padding:16px 18px; transition:.14s; }
.card:hover { border-color:var(--bd3); }
.card-label { font-size:10.5px; text-transform:uppercase; letter-spacing:.9px; color:var(--muted); margin-bottom:8px; }
.card .value { font-size:24px; font-weight:800; letter-spacing:.2px; font-family:var(--mono); }
.card-sub { margin-top:6px; font-size:11.5px; color:var(--muted); }

/* İçerik grid */
.grid { display:grid; grid-template-columns:1.6fr 1fr; gap:20px; align-items:start; }
.col-main, .col-side { display:flex; flex-direction:column; gap:20px; min-width:0; }
@media (max-width:980px) { .grid { grid-template-columns:1fr; } }

/* Tablolar */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
table.tbl { font-size:13px; }
th, td { text-align:left; padding:12px 16px; border-bottom:1px solid var(--bd2); font-size:13px; }
th { font-size:10.5px; text-transform:uppercase; letter-spacing:.7px; color:var(--muted); font-weight:700; background:var(--panel); }
table.tbl th { position:sticky; top:0; }
th.r, th.right, td.right { text-align:right; }
td.num { text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; }
tbody tr { transition:background .1s; }
tbody tr:hover { background:rgba(255,255,255,.025); }
tbody tr:last-child td { border-bottom:0; }
td.sym { font-weight:700; letter-spacing:.3px; }
td.reasons { white-space:normal; color:var(--dim); font-size:12px; max-width:320px; }
.empty { padding:32px 18px; text-align:center; color:var(--muted); font-size:13px; }

/* Etiketler */
.tag { display:inline-block; padding:2px 9px; border-radius:7px; font-size:11px; font-weight:700; letter-spacing:.4px; }
.tag.on, .tag.buy { color:var(--pos); background:var(--pos-bg); border:1px solid rgba(30,203,139,.35); }
.tag.sell { color:var(--neg); background:var(--neg-bg); border:1px solid rgba(240,73,90,.35); }
.tag.nobuy { color:var(--muted); background:rgba(255,255,255,.04); border:1px solid var(--bd2); }
.mode-tag { font-size:10.5px; padding:2px 8px; border-radius:7px; background:var(--elev); border:1px solid var(--bd2); color:var(--dim); text-transform:uppercase; letter-spacing:.5px; }
.mode-tag.live { color:var(--neg); border-color:rgba(240,73,90,.4); background:var(--neg-bg); }
.mode-tag.testnet { color:var(--warn); border-color:rgba(246,181,69,.4); background:var(--warn-bg); }
.row-actions { display:flex; gap:6px; justify-content:flex-end; flex-wrap:wrap; }

/* Log */
.logbox { margin:0; padding:16px 18px; max-height:340px; height:auto; overflow:auto; font-family:var(--mono); font-size:11.5px;
  line-height:1.6; color:#aeb6c0; background:var(--bg2); white-space:pre-wrap; }

/* Spinner (.spinner ve .spin ikisi de) */
.spinner, .spin { display:inline-block; width:14px; height:14px; border:2px solid var(--bd3); border-top-color:var(--accent);
  border-radius:50%; animation:spin .7s linear infinite; vertical-align:-2px; }
@keyframes spin { to { transform:rotate(360deg); } }

/* Geçmiş / grafik */
.histstats { display:flex; flex-wrap:wrap; gap:11px; padding:16px 20px 6px; }
.histchip { display:flex; flex-direction:column; gap:3px; padding:9px 15px; background:var(--panel2); border:1px solid var(--bd2); border-radius:10px; min-width:100px; }
.histchip .hl { font-size:10px; text-transform:uppercase; letter-spacing:.7px; color:var(--muted); }
.histchip .hv { font-size:18px; font-weight:700; font-family:var(--mono); }
.chartwrap { padding:14px 20px 6px; }
.chartwrap canvas { width:100%; display:block; }

/* Uyarı şeritleri */
.errstrip { display:none; width:100%; max-width:1320px; margin:16px auto 0; padding:12px 18px; border-radius:10px;
  color:var(--neg); background:var(--neg-bg); border:1px solid rgba(240,73,90,.4); font-size:13px; }
.errstrip.show { display:block; }
.livewarn { display:none; margin-top:14px; padding:11px 15px; border-radius:9px; font-size:13px; font-weight:600;
  color:var(--warn); background:var(--warn-bg); border:1px solid rgba(246,181,69,.35); }
.livewarn.show { display:block; }
.balanceout { margin-top:10px; font-family:var(--mono); font-size:12.5px; color:var(--dim); min-height:1em; }
.note { padding:11px 20px; font-size:11.5px; color:var(--muted); line-height:1.6; }

/* Modal */
.modal-bg { position:fixed; inset:0; background:rgba(0,0,0,.66); backdrop-filter:blur(3px); display:flex; align-items:flex-start; justify-content:center; padding:48px 16px; z-index:50; overflow:auto; }
.modal { background:var(--panel); border:1px solid var(--bd); border-radius:var(--radius); box-shadow:var(--shadow); width:660px; max-width:100%; padding:24px; animation:modalin .18s ease; }
@keyframes modalin { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }
.modal h3 { margin:0 0 18px; font-size:17px; font-weight:700; }
.formgrid { display:grid; grid-template-columns:1fr 1fr; gap:13px 16px; }
.formgrid label { display:flex; flex-direction:column; gap:6px; font-size:10.5px; text-transform:uppercase; letter-spacing:.6px; color:var(--muted); }
.formgrid label.full { grid-column:1 / -1; }
.formgrid label.chk { flex-direction:row; align-items:center; gap:8px; text-transform:none; letter-spacing:0; color:var(--fg); font-size:13px; }
.modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
.err { color:var(--neg); font-size:12.5px; margin-top:10px; min-height:16px; }
.keybox { grid-column:1 / -1; border-top:1px solid var(--bd2); padding-top:14px; margin-top:2px; display:grid; grid-template-columns:1fr 1fr; gap:13px 16px; }
.keybox .note { grid-column:1/-1; padding:0; font-size:11px; color:var(--muted); text-transform:none; letter-spacing:0; }

/* Toast */
.toast { position:fixed; left:50%; bottom:26px; transform:translate(-50%, 20px); opacity:0; pointer-events:none;
  background:var(--elev); color:var(--fg); border:1px solid var(--bd); border-left:3px solid var(--accent);
  padding:13px 19px; border-radius:11px; font-size:13px; box-shadow:var(--shadow); transition:.22s; max-width:88vw; z-index:60; }
.toast.show { opacity:1; transform:translate(-50%, 0); }
.toast.ok { border-left-color:var(--pos); }
.toast.err { border-left-color:var(--neg); }

/* Mono yardımcı (bucket vb.) */
.bucket { font-family:var(--mono); font-size:11.5px; }

/* Strateji tipi açıklaması (bot ekleme modalı) */
.type-info { grid-column:1 / -1; padding:11px 13px; border-radius:10px; font-size:12px; line-height:1.55;
  color:var(--dim); background:var(--accent-bg); border:1px solid rgba(76,141,255,.25); text-transform:none; letter-spacing:0; }
.type-info b { color:var(--fg); }
.type-info.risk { color:#f6c98a; background:var(--neg-bg); border-color:rgba(240,73,90,.3); }

/* Çoklu-seçim coin picker (yasaklı coinler) */
.chip-picker { display:flex; flex-wrap:wrap; gap:6px; max-height:132px; overflow:auto; padding:10px;
  background:var(--bg2); border:1px solid var(--bd); border-radius:9px; }
.chip-picker .chip { cursor:pointer; user-select:none; padding:4px 10px; border-radius:999px; font-size:11.5px;
  font-weight:600; font-family:var(--mono); color:var(--dim); background:var(--panel2); border:1px solid var(--bd2); transition:.1s; }
.chip-picker .chip:hover { border-color:var(--bd3); color:var(--fg); }
.chip-picker .chip.selected { color:var(--neg); background:var(--neg-bg); border-color:rgba(240,73,90,.5); }
.chip-picker .chip.selected::before { content:"✕ "; font-size:10px; }
/* "dahil et" varyantı (ör. backtest sembol seçimi): seçili = yeşil ✓ */
.chip-picker.include .chip.selected { color:var(--pos); background:var(--pos-bg); border-color:rgba(30,203,139,.5); }
.chip-picker.include .chip.selected::before { content:"✓ "; }
.picker-empty { color:var(--muted); font-size:11.5px; padding:6px; }

/* Dil seçici (sidebar) */
.lang-sel { width:100%; margin-bottom:8px; padding:6px 8px; font-size:12px; background:var(--panel2,#161b22); color:var(--fg,#e6edf3); border:1px solid var(--bd,#2a313c); border-radius:8px; cursor:pointer; }
/* RTL (Arapça) */
html[dir="rtl"] .sidebar { direction:rtl; }
html[dir="rtl"] .nav-item svg { margin-left:8px; margin-right:0; }
html[dir="rtl"] .table-wrap, html[dir="rtl"] .tbl { direction:rtl; }
html[dir="rtl"] .tbl th.r, html[dir="rtl"] .tbl td.r { text-align:left; }
