/* ============================================================
   EduMarkets — Base CSS: Variables, Typography, Grid
   ============================================================ */

/* Inter font loaded via <link> in index.html — no @import needed */

/* ── Colour tokens ── */
:root {
  /* Brand */
  --color-brand:        #1B3A5C;
  --color-accent:       #2E6DA4;
  --color-accent-light: #4B9FD4;
  --color-light:        #D5E8F0;
  --sidebar-accent:     #14b8a6;
  --sidebar-accent-dim: rgba(20, 184, 166, 0.45);

  /* Dark mode (default) */
  --bg:          #0B0B0C;
  --bg-surface:  #111214;
  --bg-elevated: #18191d;
  --bg-input:    #1c1e23;
  --border:      #252830;
  --border-subtle: #1a1c22;
  --text:        #e8eaf0;
  --text-secondary: #8b8fa8;
  --text-muted:  #555a70;

  /* Semantic */
  --neutral:     #94a3b8;
  --positive:    #22c55e;
  --negative:    #ef4444;
  --warning:     #f59e0b;
  --info:        #3b82f6;
  --positive-bg: rgba(34, 197, 94, 0.08);
  --negative-bg: rgba(239, 68, 68, 0.08);
  --info-bg:     rgba(59, 130, 246, 0.08);

  /* Typography */
  --font:        'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;

  /* Radius */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   16px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.6);

  /* Transitions */
  --transition: 160ms ease;

  /* Params sidebar width */
  --sidebar-width: 340px;
  /* Left gutter before the sidebar */
  --workspace-gutter: 28px;
}

/* ── Light mode ── */
[data-theme="light"] {
  --bg:          #f0f2f7;
  --bg-surface:  #ffffff;
  --bg-elevated: #f8f9fc;
  --bg-input:    #f4f6fa;
  --border:      #dde1ec;
  --border-subtle: #e8ebf4;
  --text:        #1B3A5C;
  --text-secondary: #4a5568;
  --text-muted:  #8898aa;
  --shadow-sm:  0 1px 3px rgba(27,58,92,0.08);
  --shadow-md:  0 4px 12px rgba(27,58,92,0.12);
  --sidebar-accent:     #0d9488;
  --sidebar-accent-dim: rgba(13, 148, 136, 0.50);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; font-weight: 600; line-height: 1.3;  }
h3 { font-size: 1.1rem;  font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
p  { font-size: 1rem;    color: var(--text-secondary); }
a  { color: var(--color-accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Workspace: sidebar + content, fills remaining height */
.workspace {
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  padding-left: var(--workspace-gutter);
}

.workspace-content {
  flex: 1;
  overflow-y: scroll;
  min-width: 0;
}

.tab-content-area {
  padding: 28px 28px 48px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── Utility ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex    { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.mt-2   { margin-top: 8px; }
.mt-4   { margin-top: 16px; }
.mt-6   { margin-top: 24px; }
.mb-4   { margin-bottom: 16px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.8rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ── Toast Notifications ── */
.em-toast-container {
  position: fixed;
  top: 72px;
  right: 16px;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.em-toast {
  pointer-events: auto;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: var(--font);
  max-width: 420px;
  cursor: pointer;
  animation: toast-in 0.3s ease;
  box-shadow: var(--shadow-md);
}
.em-toast-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}
.em-toast-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #34d399;
}
.em-toast-info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}
.em-toast-exit {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.3s, transform 0.3s;
}
[data-theme="light"] .em-toast-error {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}
[data-theme="light"] .em-toast-success {
  background: rgba(34, 197, 94, 0.08);
  color: #059669;
}
[data-theme="light"] .em-toast-info {
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
