/* ──────────────────────────────────────────────
   Delta Exchange India Trading Bot — Dark Theme
   ────────────────────────────────────────────── */

:root {
  --bg-base:     #0d0f14;
  --bg-card:     #151820;
  --bg-input:    #1c1f2a;
  --bg-hover:    #1e2233;
  --border:      #2a2e3d;
  --text-primary:#e8eaf6;
  --text-muted:  #757fa3;
  --accent:      #5c7cfa;
  --accent-hover:#4a6df7;
  --green:       #43d98d;
  --red:         #f05d5d;
  --amber:       #f5c518;
  --chip-idle:   #2a2e3d;
  --chip-active: #1a2f2a;
  --chip-done:   #1a2040;
  --mono:        #a8d8ea;
  --font:        'Segoe UI', system-ui, sans-serif;
  --radius:      8px;
  --shadow:      0 2px 16px rgba(0,0,0,0.45);
}

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

body { font-family: var(--font); background: var(--bg-base); color: var(--text-primary); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }

/* ── Login ── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card  { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
               padding: 40px 36px; width: 360px; box-shadow: var(--shadow); }
.login-logo  { text-align: center; margin-bottom: 28px; }
.logo-delta  { font-size: 2.6rem; color: var(--accent); font-weight: 800; }
.login-title { font-size: 1.25rem; font-weight: 700; margin-top: 6px; }
.login-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }
.form-group  { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.82rem; }
.form-group input { width: 100%; background: var(--bg-input); border: 1px solid var(--border);
                    border-radius: var(--radius); padding: 10px 14px; color: var(--text-primary);
                    font-size: 0.95rem; outline: none; transition: border .2s; }
.form-group input:focus { border-color: var(--accent); }
.error-msg   { color: var(--red); font-size: 0.82rem; margin-bottom: 12px; }

/* ── Buttons ── */
.btn { cursor: pointer; font-family: var(--font); border: none; border-radius: var(--radius);
       padding: 9px 18px; font-size: 0.88rem; font-weight: 600; transition: background .2s, opacity .2s; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #d94a4a; }
.btn-outline  { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--bg-hover); }
.btn-full { width: 100%; padding: 11px; font-size: 1rem; }
.btn-sm   { padding: 6px 14px; font-size: 0.82rem; }
.mt8 { margin-top: 8px; }

/* ── Topbar ── */
.topbar { position: sticky; top: 0; z-index: 100;
          display: flex; align-items: center; justify-content: space-between;
          background: var(--bg-card); border-bottom: 1px solid var(--border);
          padding: 0 20px; height: 54px; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 1.05rem; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* ── Mode Badge ── */
.mode-badge { font-size: 0.78rem; font-weight: 700; padding: 5px 12px; border-radius: 20px;
              letter-spacing: .05em; }
.mode-sandbox { background: rgba(245, 197, 24, 0.15); color: var(--amber); border: 1px solid rgba(245,197,24,.35); }
.mode-live    { background: rgba(240, 93, 93, 0.18); color: var(--red);   border: 1px solid rgba(240,93,93,.4); }

/* ── Connection dot ── */
.conn-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-ok          { background: var(--green); }
.dot-connecting  { background: var(--amber); animation: blink 1.2s infinite; }
.dot-error       { background: var(--red); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Main Grid ── */
.main-grid { display: grid; grid-template-columns: repeat(2, 1fr);
             gap: 18px; padding: 20px; max-width: 1400px; margin: 0 auto; }
.wide-card { grid-column: 1 / -1; }

/* ── Card ── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 18px 20px; }
.card-title { font-size: 0.88rem; font-weight: 700; text-transform: uppercase;
              letter-spacing: .07em; color: var(--text-muted); margin-bottom: 14px; }

/* ── Info Table ── */
.info-table { width: 100%; border-collapse: collapse; }
.info-table tr td:first-child { color: var(--text-muted); width: 46%; padding: 5px 0; font-size: 0.83rem; }
.info-table tr td:last-child  { font-size: 0.93rem; }

/* ── Chips / States ── */
.chip { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.78rem; font-weight: 700; }
.chip-idle    { background: var(--chip-idle);   color: var(--text-muted); }
.chip-active  { background: var(--chip-active); color: var(--green); }
.chip-done    { background: var(--chip-done);   color: var(--accent); }
.chip-waiting { background: #1f2a1a; color: #9acf8c; }

/* ── Color helpers ── */
.mono       { font-family: 'Cascadia Code', 'Consolas', monospace; color: var(--mono); }
.color-sl   { color: var(--red); }
.color-tp   { color: var(--green); }
.pnl-positive { color: var(--green); font-weight: 700; }
.pnl-negative { color: var(--red); font-weight: 700; }
.pnl-zero     { color: var(--text-muted); }
.placeholder-text { color: var(--text-muted); font-size: 0.85rem; padding: 8px 0; text-align: center; }
.hidden { display: none !important; }

/* ── Toggle switch ── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 24px; transition: .3s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
                          background: #fff; top: 3px; left: 3px; transition: .3s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Bot / sandbox toggle rows ── */
.bot-toggle-row, .sandbox-toggle-row { display: flex; align-items: center; justify-content: space-between;
                                        margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.sandbox-label { font-size: 0.88rem; }

/* ── Settings inputs ── */
.settings-row { display: flex; align-items: center; justify-content: space-between;
                margin-bottom: 10px; gap: 8px; }
.settings-row label { color: var(--text-muted); font-size: 0.82rem; }
.inp-sm { width: 90px; background: var(--bg-input); border: 1px solid var(--border);
          border-radius: 6px; padding: 6px 10px; color: var(--text-primary); font-size: 0.9rem;
          outline: none; text-align: right; }
.inp-md { flex: 1; background: var(--bg-input); border: 1px solid var(--border);
          border-radius: 6px; padding: 6px 10px; color: var(--text-primary); font-size: 0.9rem;
          outline: none; min-width: 0; }
.inp-sm:focus, .inp-md:focus { border-color: var(--accent); }

.radio-group { display: flex; flex-direction: column; gap: 4px; }
.radio-group label { display: flex; align-items: center; gap: 6px; color: var(--text-primary);
                     font-size: 0.83rem; cursor: pointer; }

.api-section { margin-top: 12px; }
.api-section-title { font-size: 0.78rem; font-weight: 700; color: var(--text-muted);
                      text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.api-btn-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.save-msg    { font-size: 0.82rem; color: var(--green); }
.save-msg.error { color: var(--red); }

/* ── Live badge ── */
.live-badge { background: var(--green); color: #000; font-size: 0.65rem; font-weight: 800;
              padding: 2px 7px; border-radius: 10px; vertical-align: middle; margin-left: 6px; }

/* ── Trade History table ── */
.table-scroll { overflow-x: auto; }
.trade-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.trade-table th { color: var(--text-muted); font-weight: 600; text-align: left;
                  padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.trade-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.trade-table tr:last-child td { border-bottom: none; }
.trade-table tr:hover td { background: var(--bg-hover); }
.side-sell { color: var(--red); font-weight: 700; }
.side-buy  { color: var(--green); font-weight: 700; }

/* ── Pagination ── */
.pagination-row { display: flex; align-items: center; gap: 12px; margin-top: 12px;
                  justify-content: center; color: var(--text-muted); font-size: 0.82rem; }

/* ── Activity Log ── */
.activity-log { background: #0a0c11; border: 1px solid var(--border); border-radius: 6px;
                padding: 12px 14px; height: 220px; overflow-y: auto; font-family: 'Cascadia Code','Consolas',monospace;
                font-size: 0.78rem; color: #8fa8c2; line-height: 1.7; }
.activity-log::-webkit-scrollbar { width: 5px; }
.activity-log::-webkit-scrollbar-track { background: transparent; }
.activity-log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7);
                  display: flex; align-items: center; justify-content: center; z-index: 999; }
.modal-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
              padding: 32px 28px; max-width: 420px; width: 92%; }
.modal-box h3 { margin-bottom: 14px; font-size: 1.1rem; }
.modal-box p  { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 20px; }
.modal-buttons { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Settings card ── */
.settings-card { overflow: hidden; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .main-grid { grid-template-columns: 1fr; }
  .wide-card { grid-column: 1; }
}

/* ── Tab navigation ── */
.tab-nav {
  display: flex; gap: 0; background: var(--bg-card);
  border-bottom: 1px solid var(--border); padding: 0 20px;
}
.tab-btn {
  cursor: pointer; background: transparent; border: none; border-bottom: 3px solid transparent;
  color: var(--text-muted); font-family: var(--font); font-size: 0.88rem; font-weight: 600;
  padding: 12px 20px; transition: color .2s, border-color .2s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.tab-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Tab panels ── */
.tab-panel { display: block; }
.tab-panel.hidden { display: none !important; }

/* ── Settings page layout (single column, narrower) ── */
.settings-page {
  max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; padding: 20px;
}

/* ── Manual controls ── */
.manual-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 6px;
}
.manual-block {
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.manual-block-title {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
}
.manual-note {
  font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 4px;
}
.manual-msg {
  font-size: 0.78rem; color: var(--green); min-height: 16px; margin-top: 2px;
}
.manual-msg.error { color: var(--red); }
.manual-input-row {
  display: flex; align-items: center; gap: 6px;
}
.manual-input-row label { font-size: 0.78rem; color: var(--text-muted); width: 32px; flex-shrink: 0; }
.manual-input-row input { flex: 1; }
.side-btn-row { display: flex; gap: 8px; }
.side-btn-sell {
  flex: 1; background: rgba(240,93,93,.18); color: var(--red);
  border: 1px solid rgba(240,93,93,.45); border-radius: var(--radius);
  font-weight: 700; font-size: 0.9rem; padding: 9px 0; cursor: pointer; transition: background .2s;
}
.side-btn-sell:hover:not(:disabled) { background: rgba(240,93,93,.3); }
.side-btn-buy {
  flex: 1; background: rgba(67,217,141,.15); color: var(--green);
  border: 1px solid rgba(67,217,141,.4); border-radius: var(--radius);
  font-weight: 700; font-size: 0.9rem; padding: 9px 0; cursor: pointer; transition: background .2s;
}
.side-btn-buy:hover:not(:disabled) { background: rgba(67,217,141,.28); }
.side-btn-sell:disabled, .side-btn-buy:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 700px) {
  .manual-grid { grid-template-columns: 1fr; }
}

