/* ═══════════════════════════════════════════════════════
   TOWERGATE CAPITAL — Powered by LunaNet AI
   Dashboard CSS v62
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600;700&display=swap');

/* ─── CSS Variables (Dark Mode Default) ─────────────── */
:root {
  --bg:       #07071a;
  --bg2:      #0c0c22;
  --bg3:      #0f0f2a;
  --border:   #1e1e3f;
  --border2:  #2a2a50;
  --text:     #e2e8f0;
  --text2:    #9ca3af;
  --text3:    #4b5563;
  --accent:   #5b82e0;
  --tg-blue:  #5b9bd5;
  --tg-navy:  #0e1628;
  --pos:      #4ade80;
  --neg:      #f87171;
  --warn:     #fbbf24;
  --sidebar-w: 224px;
  --radius:   12px;
  --shadow:   0 4px 24px rgba(0,0,0,0.4);
}

/* ─── Light Mode Overrides ───────────────────────────── */
body.light {
  --bg:      #f0f2f8;
  --bg2:     #ffffff;
  --bg3:     #e8ebf4;
  --border:  #d4d8ec;
  --border2: #bcc2dc;
  --text:    #0e1628;
  --text2:   #3d4a6b;
  --text3:   #7b85a3;
  --accent:  #2d5ba8;
  --tg-blue: #2d5ba8;
  --shadow:  0 2px 16px rgba(0,0,0,0.07);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
}

/* ─── App Layout ─────────────────────────────────────── */
#app { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--tg-navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  border-right: 1px solid rgba(91,155,213,0.12);
}

body.light .sidebar {
  background: #0e1628;
  border-right: 1px solid rgba(91,155,213,0.2);
}

.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(91,155,213,0.12);
  text-align: center;
}

.sidebar-logo img {
  width: 164px;
  height: auto;
  display: block;
  margin: 0 auto 8px;
}

.sidebar-sub {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--tg-blue);
  opacity: 0.7;
}

.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  user-select: none;
}

.nav-item svg {
  width: 15px; height: 15px;
  fill: currentColor;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(91,155,213,0.08);
}

.nav-item.active {
  color: #fff;
  background: rgba(91,155,213,0.14);
  border-left-color: var(--tg-blue);
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(91,155,213,0.12);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b9bd5, #2d5ba8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-name  { font-size: 12px; font-weight: 600; color: #fff; }
.user-role  { font-size: 10px; color: rgba(255,255,255,0.35); }

.logout-btn {
  width: 100%;
  padding: 7px;
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: 6px;
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.logout-btn:hover { background: rgba(248,113,113,0.18); }

/* ─── Main ───────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ─── Topbar ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.25s;
}

.topbar-left  { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
}

.exchange-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
}

.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-green  { background: var(--pos); box-shadow: 0 0 6px rgba(74,222,128,0.6); }
.dot-yellow { background: var(--warn); }
.dot-red    { background: var(--neg); }
.dot-grey   { background: var(--text3); }

.last-update { font-size: 11px; color: var(--text3); }

.refresh-btn {
  padding: 6px 14px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.refresh-btn:hover { color: var(--text); border-color: var(--tg-blue); }

/* ─── Hero Cards ─────────────────────────────────────── */
.hero-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
}

.hero-card {
  padding: 16px 18px;
  border-right: 1px solid rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}
.hero-card:last-child { border-right: none; }

body.light .hero-card { border-right-color: rgba(0,0,0,0.06); }

.hero-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 5px;
}

.hero-value {
  font-size: 21px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 4px;
}

.hero-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

.hero-pct {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
}
.pct-pos { background: rgba(74,222,128,0.18); color: var(--pos); }
.pct-neg { background: rgba(248,113,113,0.18); color: var(--neg); }

/* Hero card gradients */
.hero-purple  { background: linear-gradient(135deg, #2d1b69 0%, #1a0e45 100%); }
.hero-dark    { background: linear-gradient(135deg, #1a1a2e 0%, #0d0d1f 100%); }
.hero-teal    { background: linear-gradient(135deg, #0d4f4f 0%, #062c2c 100%); }
.hero-green   { background: linear-gradient(135deg, #14532d 0%, #092919 100%); }
.hero-blue    { background: linear-gradient(135deg, #0e1628 0%, #071020 100%); }
.hero-orange  { background: linear-gradient(135deg, #78350f 0%, #3d1905 100%); }
.hero-indigo  { background: linear-gradient(135deg, #312e81 0%, #1a1860 100%); }
.hero-emerald { background: linear-gradient(135deg, #065f46 0%, #022c22 100%); }

/* ─── Tab Content ────────────────────────────────────── */
.tab-content       { flex: 1; padding: 22px 28px; }
.tab-content.hidden { display: none; }

/* ─── Cards ──────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: background 0.25s, border-color 0.25s;
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

/* ─── Tables ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead tr { border-bottom: 2px solid var(--border2); }

th {
  padding: 8px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text3);
  white-space: nowrap;
}

td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg3); }

/* ─── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
}

.btn-primary {
  background: linear-gradient(135deg, #5b9bd5, #2d5ba8);
  color: #fff;
  box-shadow: 0 2px 10px rgba(91,155,213,0.3);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-danger {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.25);
  color: var(--neg);
}
.btn-danger:hover { background: rgba(248,113,113,0.2); }

.btn-ghost {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--tg-blue); }

/* ─── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-grey  { background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }
.badge-blue  { background: rgba(91,155,213,0.12); color: var(--tg-blue); border: 1px solid rgba(91,155,213,0.25); }
.badge-green { background: rgba(74,222,128,0.1); color: var(--pos); }

.bot-running {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(74,222,128,0.1);
  color: var(--pos);
  border: 1px solid rgba(74,222,128,0.22);
}

/* ─── Investor Cards ─────────────────────────────────── */
.inv-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.inv-name {
  font-family: 'Playfair Display', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.inv-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.inv-stat {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.inv-stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  margin-bottom: 4px;
}

.inv-stat-value { font-size: 15px; font-weight: 700; color: var(--text); }
.inv-stat-sub   { font-size: 11px; color: var(--text3); margin-top: 2px; }

.pnl-pos { color: var(--pos) !important; }
.pnl-neg { color: var(--neg) !important; }

/* ─── Regime Badges ──────────────────────────────────── */
.regime-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.regime-bullish { background: rgba(74,222,128,0.1);  color: var(--pos);  border: 1px solid rgba(74,222,128,0.25); }
.regime-bearish { background: rgba(248,113,113,0.1); color: var(--neg);  border: 1px solid rgba(248,113,113,0.25); }
.regime-neutral { background: rgba(251,191,36,0.1);  color: var(--warn); border: 1px solid rgba(251,191,36,0.25); }

/* ─── Loading / Error ────────────────────────────────── */
.loading {
  padding: 48px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}

/* ─── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 1100px) {
  .hero-cards { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 860px) {
  .hero-cards { grid-template-columns: repeat(2, 1fr); }
  :root { --sidebar-w: 56px; }
  .nav-item span, .sidebar-logo img, .sidebar-sub, .user-info, .logout-btn { display: none; }
  .sidebar-logo { padding: 14px 8px; }
  .nav-item { padding: 12px; justify-content: center; }
}
