/* ═══════════════════════════════════════════
   BIST30 Trading Terminal — Dark Theme
   ═══════════════════════════════════════════ */

/* ── Reset / Base ── */
* { box-sizing: border-box; }

body, html {
  background-color: #0d1117;
  color: #e6edf3;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  margin: 0;
  padding: 0;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #161b22; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ═══════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════ */

#app-container {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
  width: 220px;
  min-width: 220px;
  background: #161b22;
  border-right: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

#sidebar-logo {
  padding: 20px 16px 18px 16px;
  border-bottom: 1px solid #30363d;
}

#sidebar-logo .logo-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #58a6ff;
  letter-spacing: -0.02em;
}

#sidebar-logo .logo-sub {
  font-size: 0.72rem;
  color: #8b949e;
  margin-top: 3px;
}

#nav-section-label {
  padding: 14px 16px 6px 16px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 0.85rem;
  color: #8b949e;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.12s ease;
  text-decoration: none;
  border-radius: 0;
  background: transparent;
  border-top: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  text-align: left;
}

.nav-link:hover {
  background: #21262d;
  color: #e6edf3;
  border-left-color: #30363d;
}

.nav-link.active {
  background: #1f6feb18;
  color: #58a6ff;
  border-left-color: #1f6feb;
  font-weight: 600;
}

.nav-icon { font-size: 1rem; width: 18px; text-align: center; }

#sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid #30363d;
  font-size: 0.72rem;
  color: #8b949e;
  line-height: 1.7;
}

.status-dot { color: #3fb950; }

/* ── Main content ── */
#main-content {
  margin-left: 220px;
  flex: 1;
  padding: 24px 28px;
  min-height: 100vh;
  background: #0d1117;
}

/* ── Page header ── */
.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e6edf3;
  margin: 0 0 4px 0;
}

.page-subtitle {
  font-size: 0.78rem;
  color: #8b949e;
  margin: 0 0 20px 0;
}

/* ═══════════════════════════════════════════
   SECTION HEADERS
   ═══════════════════════════════════════════ */
.section-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding-bottom: 6px;
  border-bottom: 1px solid #30363d;
  margin: 0 0 12px 0;
}

/* ═══════════════════════════════════════════
   METRIC CARDS
   ═══════════════════════════════════════════ */
.metric-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 16px 20px;
  text-align: center;
  height: 100%;
}

.metric-card .mc-label {
  font-size: 0.68rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.metric-card .mc-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.metric-card .mc-sub {
  font-size: 0.72rem;
  color: #8b949e;
  margin-top: 5px;
}

.mc-green  { color: #3fb950; }
.mc-blue   { color: #58a6ff; }
.mc-yellow { color: #d29922; }
.mc-red    { color: #f85149; }
.mc-white  { color: #e6edf3; }

/* ═══════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-guclu-al { background: #238636; color: #fff; }
.badge-al       { background: #1f6feb; color: #fff; }
.badge-izle     { background: #9e6a03; color: #fff; }
.badge-kacin    { background: #da3633; color: #fff; }
.badge-poz      { background: #238636; color: #fff; }
.badge-neg      { background: #da3633; color: #fff; }
.badge-karma    { background: #6e40c9; color: #fff; }
.badge-ntr      { background: #30363d; color: #8b949e; }
.badge-passed   { background: #1a3f1a; color: #3fb950; }
.badge-blocked  { background: #3f1a1a; color: #f85149; }

/* ═══════════════════════════════════════════
   PANEL
   ═══════════════════════════════════════════ */
.panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.panel-danger {
  border-color: #da3633;
}

/* ═══════════════════════════════════════════
   TABLES (DataTable override)
   ═══════════════════════════════════════════ */
.dash-table-container .dash-spreadsheet-container {
  border: 1px solid #30363d !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
  background-color: #21262d !important;
  color: #8b949e !important;
  font-size: 0.72rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  border-bottom: 1px solid #30363d !important;
  border-right: 1px solid #30363d !important;
  font-weight: 700 !important;
  padding: 8px 10px !important;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner td {
  background-color: #161b22 !important;
  color: #e6edf3 !important;
  font-size: 0.82rem !important;
  border-bottom: 1px solid #21262d !important;
  border-right: 1px solid #21262d !important;
  padding: 7px 10px !important;
}

.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner tr:hover td {
  background-color: #1c2128 !important;
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn-primary-dark {
  background: #1f6feb;
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-primary-dark:hover { background: #388bfd; }

.btn-danger-dark {
  background: #da3633;
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  letter-spacing: 0.04em;
  transition: background 0.12s;
}
.btn-danger-dark:hover { background: #f85149; }

.btn-warning-dark {
  background: #9e6a03;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: background 0.12s;
}
.btn-warning-dark:hover { background: #d29922; }

.btn-ghost {
  background: transparent;
  color: #8b949e;
  border: 1px solid #30363d;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 0.83rem;
  cursor: pointer;
  transition: all 0.12s;
}
.btn-ghost:hover { background: #21262d; color: #e6edf3; }

/* ═══════════════════════════════════════════
   SIGNAL TABLE ROW COLORS
   ═══════════════════════════════════════════ */
.row-guclu-al td { border-left: 3px solid #3fb950 !important; }
.row-al       td { border-left: 3px solid #1f6feb !important; }
.row-izle     td { border-left: 3px solid #d29922 !important; }
.row-kacin    td { border-left: 3px solid #da3633 !important; }

/* ═══════════════════════════════════════════
   PIPELINE STEPS
   ═══════════════════════════════════════════ */
.pipeline-step {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 0.82rem;
}

.pipeline-step.ok   { background: #1a3f1a; }
.pipeline-step.run  { background: #1a2b40; }
.pipeline-step.wait { background: #21262d; color: #8b949e; }
.pipeline-step.err  { background: #3f1a1a; }

/* ═══════════════════════════════════════════
   KILL SWITCH
   ═══════════════════════════════════════════ */
#kill-switch-panel {
  border: 2px solid #30363d;
  border-radius: 10px;
  padding: 18px;
  background: #161b22;
}

#kill-switch-panel.armed {
  border-color: #da3633;
  box-shadow: 0 0 20px #da363340;
}

/* ═══════════════════════════════════════════
   KAP FEED
   ═══════════════════════════════════════════ */
.kap-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #21262d;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.1s;
}

.kap-row:hover { background: #1c2128; }

.kap-time  { color: #8b949e; font-variant-numeric: tabular-nums; min-width: 44px; }
.kap-ticker{ font-weight: 700; min-width: 56px; color: #58a6ff; }
.kap-title { flex: 1; }

/* ═══════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════ */
.progress-track {
  background: #21262d;
  border-radius: 4px;
  height: 8px;
  width: 100%;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: #1f6feb;
  transition: width 0.3s ease;
}

.progress-fill.green  { background: #3fb950; }
.progress-fill.yellow { background: #d29922; }
.progress-fill.red    { background: #da3633; }

/* ═══════════════════════════════════════════
   CRITERION ROW
   ═══════════════════════════════════════════ */
.criterion-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #21262d;
  font-size: 0.82rem;
}

.criterion-ok   { color: #3fb950; }
.criterion-fail { color: #f85149; }

/* ═══════════════════════════════════════════
   KV (key-value) ROW
   ═══════════════════════════════════════════ */
.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #21262d;
  font-size: 0.82rem;
}

.kv-key   { color: #8b949e; }
.kv-value { font-weight: 600; color: #e6edf3; }
.kv-green { color: #3fb950 !important; }
.kv-red   { color: #f85149 !important; }
.kv-blue  { color: #58a6ff !important; }
.kv-yellow{ color: #d29922 !important; }

/* ═══════════════════════════════════════════
   TABS (dcc.Tabs override)
   ═══════════════════════════════════════════ */
.custom-tabs .tab {
  background: #161b22 !important;
  color: #8b949e !important;
  border: 1px solid #30363d !important;
  border-bottom: none !important;
  padding: 8px 16px !important;
  font-size: 0.83rem !important;
  border-radius: 6px 6px 0 0 !important;
}

.custom-tabs .tab--selected {
  background: #21262d !important;
  color: #e6edf3 !important;
  border-bottom: 2px solid #1f6feb !important;
}

.custom-tab-content {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 0 8px 8px 8px;
  padding: 16px;
}

/* ═══════════════════════════════════════════
   INPUTS (dcc.Input, dcc.Dropdown etc.)
   ═══════════════════════════════════════════ */
.dark-input input, .dark-input textarea {
  background: #21262d !important;
  color: #e6edf3 !important;
  border: 1px solid #30363d !important;
  border-radius: 6px !important;
  font-size: 0.83rem !important;
}

.Select-control {
  background: #21262d !important;
  border: 1px solid #30363d !important;
  color: #e6edf3 !important;
}

.Select-menu-outer { background: #21262d !important; border: 1px solid #30363d !important; }
.Select-option      { background: #21262d !important; color: #e6edf3 !important; }
.Select-option:hover{ background: #1f6feb !important; }
.Select-value-label { color: #e6edf3 !important; }

/* ═══════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════ */
.divider {
  border: none;
  border-top: 1px solid #30363d;
  margin: 18px 0;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
  #sidebar { display: none; }
  #main-content { margin-left: 0; }
}
