/* ═══════════════════════════════════════════════════════════════════════
   base.css  — Page 1: Login Screen + App Shell
   Covers: login overlay, topbar, tabs, symbol bar, content, status bar
   Both light (corporate / Pakistan Green) and dark (night / neon green)
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Base typography ─────────────────────────────────────────────────── */
body {
  font-size: 13px;
  font-weight: 450;      /* variable font intermediate weight — bolder than 400 */
  color: var(--white);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;  /* numbers stay aligned in tables */
}

/* ── LOGIN OVERLAY ───────────────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 48px 52px;
  width: 90%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: fadeIn .3s ease;
}

.login-brand {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--dimmer);
  margin-bottom: 10px;
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 32px;
  letter-spacing: -.02em;
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg1);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--mono);
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color .2s, background .2s;
}
.login-input:focus {
  border-color: var(--green);
  background: var(--surface);
}
.login-input::placeholder { color: var(--dimmer); }

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .15em;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.login-btn:hover   { opacity: .88; }
.login-btn:active  { transform: scale(.99); }
.login-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Light mode: green outline on card */
[data-theme="corporate"] .login-card {
  border-color: var(--green);
  border-width: 1px;
}
[data-theme="corporate"] .login-input:focus {
  box-shadow: 0 0 0 3px var(--green-bg);
}

/* Dark mode: subtle glow */
[data-theme="night"] .login-btn {
  box-shadow: 0 4px 20px rgba(0, 223, 122, 0.3);
}

.login-error {
  margin-top: 10px;
  font-size: 12px;
  color: var(--red);
  min-height: 18px;
}

/* ── APP WRAPPER ─────────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* ── TOPBAR ──────────────────────────────────────────────────────────── */
.ct-topbar {
  display: flex;
  align-items: stretch;
  height: 48px;
  padding: 0 12px 0 16px;
  flex-shrink: 0;
  z-index: 100;
  gap: 0;
  /* Light mode: warm green bar — softer than solid black-green */
  background: var(--green);
  border-bottom: 2px solid rgba(0,0,0,.08);
}

/* Dark mode: dark slate nav — overrides main.css #topbar { background: var(--green) } */
[data-theme="night"] .ct-topbar,
[data-theme="night"] #topbar {
  background: #0f1624;
  border-bottom: 2px solid var(--green);
}

/* Brand chip */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-right: 16px;
  margin-right: 4px;
  flex-shrink: 0;
  /* Light: white text on green bg */
  color: #fff;
  border-right: 1px solid rgba(255,255,255,.2);
}

/* Dark: green text on dark bg */
[data-theme="night"] .brand {
  color: var(--green);
  border-right: 1px solid var(--border);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: rgba(255,255,255,.75);
  border-radius: 50%;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
/* Dark mode: keep bright green dot */
[data-theme="night"] .pulse-dot {
  background: #7fff9a;
  box-shadow: 0 0 8px rgba(127,255,154,.5);
}

/* ── TABS ────────────────────────────────────────────────────────────── */
.ct-tabs {
  display: flex;
  align-items: stretch;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.ct-tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  flex-shrink: 0;
  height: 100%;
  /* Light: white text (on green bg) */
  color: rgba(255,255,255,.6);
}
.tab:hover  { color: rgba(255,255,255,.9); }
.tab.active { color: #fff; border-bottom-color: rgba(255,255,255,.9); font-weight: 700; }

/* Dark: gray text on dark bg, green underline */
[data-theme="night"] .tab        { color: var(--dim); }
[data-theme="night"] .tab:hover  { color: var(--white); }
[data-theme="night"] .tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 700; }

/* ── TOPBAR RIGHT ────────────────────────────────────────────────────── */
.ct-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-left: 12px;
}

#clock {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  white-space: nowrap;
  color: rgba(255,255,255,.75);
}
[data-theme="night"] #clock { color: var(--dim); }

#theme-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  /* Light: white on green */
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
}
#theme-toggle:hover { background: rgba(255,255,255,.28); }
/* Dark: use border + muted */
[data-theme="night"] #theme-toggle {
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--dim);
}
[data-theme="night"] #theme-toggle:hover {
  border-color: var(--green);
  color: var(--green);
}
.theme-icon { font-size: 12px; }

#user-badge { display: flex; align-items: center; }

/* ── SYMBOL BAR ──────────────────────────────────────────────────────── */
.ct-symbol-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.ct-symbol-bar::-webkit-scrollbar { display: none; }

/* Light mode: warm green accent border, slightly lighter */
[data-theme="corporate"] .ct-symbol-bar {
  border-bottom: 2px solid rgba(45, 106, 79, 0.4);
  background: var(--surface);
  border-top: none;
}

.bar-label {
  font-family: var(--mono);
  color: var(--dimmer);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

#symbol-select {
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--white);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  outline: none;
  border-radius: 4px;
  flex-shrink: 0;
}
#symbol-select:focus { border-color: var(--green); }
#symbol-select option { background: var(--bg1); color: var(--white); }

.divider {
  width: 1px;
  height: 18px;
  background: var(--border2);
  margin: 0 2px;
  flex-shrink: 0;
}

#quick-pills { display: flex; gap: 5px; }

.pill {
  padding: 2px 10px;
  border: 1px solid var(--border2);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  letter-spacing: .04em;
  background: var(--surface);
  border-radius: 4px;
}
.pill:hover {
  border-color: var(--green);
  color: var(--white);
}
.pill.active {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-bg);
  font-weight: 700;
}

/* ── CONTENT AREA ────────────────────────────────────────────────────── */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg);
  min-height: 0;
}
#content::-webkit-scrollbar { width: 4px; }
#content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.panel        { display: none; }
.panel.active { display: block; animation: fadeIn .15s ease; padding-bottom: 0; }


/* ── Page footer — bottom of scrollable content area ─────────────── */
#content-footer {
  margin-top: 52px;
  padding: 20px 0 30px;
  border-top: 1px solid var(--border);
  text-align: center;
  display: block;
}
#content-footer-inner {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.footer-quote {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.footer-line {
  color: var(--green);
  opacity: .4;
  font-size: 12px;
}

/* ── STATUS BAR ──────────────────────────────────────────────────────── */
#status-bar {
  position: relative;
  height: 26px;
  border-top: 1px solid var(--green-lt);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  flex-shrink: 0;
  z-index: 50;
  /* Light: Pakistan Green solid */
  background: var(--green);
  color: rgba(255,255,255,.6);
}
/* Dark: match navbar — dark slate with subtle separator */
[data-theme="night"] #status-bar {
  background: #0f1624;
  border-top: 1px solid var(--border);
  color: var(--dim);
}
[data-theme="night"] #sb-price { color: var(--green) !important; }
[data-theme="night"] #sb-direction { color: var(--white); }

.sb-item  { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.sb-dot   { width: 5px; height: 5px; border-radius: 50%; background: #7fff9a; }
.sb-dot.off   { background: #ff6060; }
.sb-dot.pulse { background: #ffff80; animation: pulse 1.5s infinite; }
.spacer   { flex: 1; }
#sb-price { color: #fff; font-weight: 700; }
#sb-direction { color: rgba(255,255,255,.75); }

/* ── SHARED UTILITIES ────────────────────────────────────────────────── */
.pos   { color: var(--green) !important; }
.neg   { color: var(--red)   !important; }
.amber { color: var(--amber) !important; }
.dim   { color: var(--dim); }

.section-title {
  color: var(--dimmer);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.section-title span { color: var(--green); }

.no-data { text-align: center; color: var(--dim); padding: 40px; font-size: 12px; letter-spacing: .1em; }
.no-data strong { display: block; color: var(--green); margin-bottom: 8px; font-size: 14px; }

.tag { display: inline-block; padding: 2px 8px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; border-radius: 2px; }
.tag.long    { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.tag.short   { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red); }
.tag.notrade { background: var(--bg2);       color: var(--dim);   border: 1px solid var(--border2); }

.cell-grid { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); }
.cell      { background: var(--surface); padding: 11px 13px; }
.cell .c-lbl { color: var(--dim); font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
.cell .c-val { font-size: 15px; font-weight: 600; color: var(--white); font-family: var(--mono); }
.cell .c-sub { font-size: 11px; color: var(--dim); margin-top: 2px; font-weight: 500; }

.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
  background-size: 200%;
  animation: shimmer 1.5s infinite;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────── */
/* Tablet: hide clock in topbar */
@media (max-width: 768px) {
  #clock { display: none; }
  .theme-label { display: none; }
  .tab { padding: 0 12px; font-size: 10px; }
  .brand { display: none; }
  .ct-topbar { padding: 0 8px; }
}

/* Mobile */
@media (max-width: 480px) {
  #content { padding: 8px; }
  .ct-symbol-bar { padding: 0 8px; }
  #status-bar { gap: 8px; font-size: 9px; padding: 0 8px; }
  .sb-item:nth-child(3), .sb-item:nth-child(4) { display: none; }
}
