/* ============================================================
   Investment Assistant — Feuille de style principale
   Thème : Dark Finance — Luxe minimaliste
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=IBM+Plex+Mono:wght@400;600&family=Inter:wght@300;400;500;600&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:           #0a0e17;
  --bg2:          #111827;
  --bg3:          #1a2235;
  --border:       #1e293b;
  --border-light: #263347;
  --text:         #e2e8f0;
  --text-muted:   #64748b;
  --text-dim:     #94a3b8;
  --accent:       #3b82f6;
  --accent-glow:  rgba(59,130,246,0.15);
  --green:        #10b981;
  --green-dim:    rgba(16,185,129,0.12);
  --red:          #ef4444;
  --red-dim:      rgba(239,68,68,0.12);
  --yellow:       #f59e0b;
  --yellow-dim:   rgba(245,158,11,0.12);
  --gold:         #d4af37;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;
  --sidebar-w:    240px;
  --header-h:     64px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, .btn { cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }
img { max-width: 100%; }

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

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 0.02em;
}
.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section-title {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 400;
  transition: all .2s;
  position: relative;
}
.nav-item:hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav-item.active {
  color: var(--accent);
  background: var(--accent-glow);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.market-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.market-status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

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

.topbar {
  height: var(--header-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-style: italic;
  color: var(--text);
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.notif-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 16px;
  transition: all .2s;
}
.notif-btn:hover { border-color: var(--accent); color: var(--accent); }
.notif-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg2);
}

.main-content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.card-body { padding: 20px; }

/* ── Index cards ─────────────────────────────────────────────── */
.indices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.index-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s;
}
.index-card:hover { border-color: var(--border-light); }
.index-card .index-name { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.index-card .index-price { font-family: var(--font-mono); font-size: 22px; font-weight: 600; margin: 6px 0 2px; }
.index-card .index-change { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.index-card.positive { border-top: 2px solid var(--green); }
.index-card.negative { border-top: 2px solid var(--red); }
.index-card .index-stripe {
  position: absolute;
  right: -10px; bottom: -10px;
  width: 60px; height: 60px;
  border-radius: 50%;
  opacity: 0.06;
}
.positive .index-stripe { background: var(--green); }
.negative .index-stripe { background: var(--red); }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border-light); }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
.mono { font-family: var(--font-mono); }

/* ── Colors ─────────────────────────────────────────────────── */
.text-green { color: var(--green); }
.text-red   { color: var(--red);   }
.text-yellow { color: var(--yellow); }
.text-gold  { color: var(--gold);  }
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.badge-green  { background: var(--green-dim);  color: var(--green);  }
.badge-red    { background: var(--red-dim);    color: var(--red);    }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-blue   { background: var(--accent-glow); color: var(--accent); }
.badge-gray   { background: rgba(100,116,139,.15); color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-danger    { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-ghost     { background: transparent; color: var(--text-dim); border: 1px solid var(--border-light); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-dim); margin-bottom: 6px; letter-spacing: 0.04em; text-transform: uppercase; }
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }

/* ── Alerts/Flash ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
}
.alert-success { background: var(--green-dim);  border-color: rgba(16,185,129,.3); color: var(--green); }
.alert-warning { background: var(--yellow-dim); border-color: rgba(245,158,11,.3); color: var(--yellow); }
.alert-danger  { background: var(--red-dim);    border-color: rgba(239,68,68,.3);  color: var(--red); }
.alert-info    { background: var(--accent-glow);border-color: rgba(59,130,246,.3); color: var(--accent); }

/* ── Scoring / Stars ─────────────────────────────────────────── */
.score-bar-wrap { display: flex; align-items: center; gap: 10px; }
.score-bar {
  flex: 1;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--yellow) 50%, var(--green) 100%);
  background-size: 200% 100%;
  background-position: calc(100% - var(--pct, 50%) * 1%);
  transition: width .6s ease;
}
.score-value { font-family: var(--font-mono); font-size: 12px; font-weight: 600; width: 32px; text-align: right; }
.stars { color: var(--gold); font-size: 14px; letter-spacing: 1px; }

/* ── Circular score ──────────────────────────────────────────── */
.score-circle {
  position: relative;
  width: 64px; height: 64px;
  flex-shrink: 0;
}
.score-circle svg { transform: rotate(-90deg); }
.score-circle .score-bg { fill: none; stroke: var(--bg3); stroke-width: 5; }
.score-circle .score-fg { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.score-circle .score-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}

/* ── Chart container ─────────────────────────────────────────── */
.chart-container { position: relative; height: 220px; }

/* ── Page headers ─────────────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-style: italic;
  color: var(--text);
  line-height: 1.2;
}
.page-header p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── Grid layouts ─────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

/* ── Portfolio summary cards ─────────────────────────────────── */
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.stat-value { font-family: var(--font-mono); font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat-sub   { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-title { font-family: var(--font-display); font-size: 22px; margin-bottom: 20px; }

/* ── Ticker chip ─────────────────────────────────────────────── */
.ticker-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: var(--bg3);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: 0.05em;
}

/* ── Sentiment badge ─────────────────────────────────────────── */
.sentiment-pos { color: var(--green); }
.sentiment-neu { color: var(--yellow); }
.sentiment-neg { color: var(--red); }

/* ── Journal entry ─────────────────────────────────────────── */
.journal-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg2);
  transition: border-color .2s;
}
.journal-entry:hover { border-color: var(--border-light); }
.journal-date { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.journal-title { font-size: 15px; font-weight: 600; margin: 6px 0 4px; }
.journal-content { font-size: 13px; color: var(--text-dim); line-height: 1.7; }
.journal-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.journal-tag { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--bg3); color: var(--text-muted); }

/* ── Notification item ─────────────────────────────────────── */
.notif-item {
  display: flex;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.notif-item:hover { background: var(--bg3); }
.notif-item.unread { background: rgba(59,130,246,0.04); }
.notif-icon { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.notif-msg  { font-size: 13px; flex: 1; }
.notif-time { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 3px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .indices-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .3s ease forwards; }
