/* ============================================================
   RateWatch — Styles (Finance Light, fond blanc)
   ============================================================ */

:root {
  --bg:           #ffffff;
  --bg-secondary: #f4f6f9;
  --bg-card:      #fafafa;
  --border:       #e2e6ed;
  --text:         #1a1f2e;
  --text-muted:   #6b7280;
  --text-faint:   #9ca3af;
  --primary:      #1a6dc5;
  --primary-hover:#155aa3;
  --primary-light:#e8f0fb;
  --success:      #166534;
  --success-bg:   #f0fdf4;
  --error:        #991b1b;
  --error-bg:     #fef2f2;
  --neutral:      #6b7280;
  --sidebar-w:    240px;
  --radius:       8px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:    0 4px 12px rgba(0,0,0,.08);
  --transition:   160ms cubic-bezier(.16,1,.3,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

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

#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
#topbar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
#page-content { padding: 28px 32px; max-width: 1200px; }

/* ── Sidebar brand ── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-text h2 { font-size: 15px; font-weight: 700; color: var(--text); }
.brand-text p  { font-size: 11px; color: var(--text-muted); }

/* ── Nav ── */
nav { padding: 12px 8px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
}
.nav-item:hover { background: var(--border); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Sidebar user footer ── */
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 4px;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-info strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info span { font-size: 11px; color: var(--text-muted); }
.btn-logout {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--text-muted); font-size: 13px;
  transition: background var(--transition), color var(--transition);
}
.btn-logout:hover { background: var(--error-bg); color: var(--error); }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 16px 20px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
  border: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-icon { padding: 6px; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Form elements ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  height: 38px;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,109,197,.12); }
.form-input.has-icon { padding-left: 36px; }
.input-wrapper { position: relative; }
.input-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); width: 16px; height: 16px; pointer-events: none; }

/* ── Alerts ── */
.alert { display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #fecaca; }
.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }

/* ── Page header ── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.page-header p  { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ── Summary bar ── */
.summary-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.summary-card { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); }
.summary-card.up   { background: var(--success-bg); border-color: #bbf7d0; }
.summary-card.down { background: var(--error-bg);   border-color: #fecaca; }
.summary-card.flat { background: var(--bg-secondary); }
.summary-card svg  { width: 18px; height: 18px; flex-shrink: 0; }
.summary-card .val { font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.summary-card .lbl { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.up .val   { color: var(--success); } .up svg   { color: var(--success); }
.down .val { color: var(--error);   } .down svg { color: var(--error); }
.flat .val { color: var(--neutral); } .flat svg { color: var(--neutral); }

/* ── Section title ── */
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
  margin-bottom: 12px;
}
.section-title::after { content:''; flex: 1; height: 1px; background: var(--border); }

/* ── Rate grid ── */
.rate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 28px; }

/* ── Rate card ── */
.rate-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.rate-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.rate-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.rate-meta { display: flex; align-items: center; gap: 6px; }
.rate-flag { font-size: 17px; line-height: 1; }
.rate-short { font-size: 12px; font-weight: 700; color: var(--primary); font-family: 'JetBrains Mono', monospace; letter-spacing: .03em; }
.rate-tenor {
  font-size: 10px; font-weight: 600; padding: 1px 6px;
  border-radius: 4px; border: 1px solid var(--border);
  color: var(--text-muted); background: var(--bg-secondary);
  margin-left: 2px;
}
.rate-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px;
}
.rate-badge.up   { background: var(--success-bg); color: var(--success); }
.rate-badge.down { background: var(--error-bg);   color: var(--error); }
.rate-badge.flat { background: var(--bg-secondary); color: var(--neutral); }
.rate-badge svg  { width: 11px; height: 11px; }
.rate-value { margin-bottom: 8px; }
.rate-value .num  { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); letter-spacing: -.02em; }
.rate-value .unit { font-size: 13px; color: var(--text-muted); margin-left: 2px; }
.rate-change { display: flex; justify-content: space-between; font-size: 11.5px; font-variant-numeric: tabular-nums; font-family: 'JetBrains Mono', monospace; }
.rate-change .delta.up   { color: var(--success); }
.rate-change .delta.down { color: var(--error); }
.rate-change .delta.flat { color: var(--neutral); }
.rate-change .prev { color: var(--text-faint); }
.rate-desc { font-size: 11.5px; color: var(--text-muted); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Disclaimer ── */
.disclaimer { font-size: 11px; color: var(--text-faint); text-align: center; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 8px; }

/* ── URL form ── */
.url-form-card { margin-bottom: 24px; }
.url-form-row { display: flex; gap: 8px; }
.url-form-row .form-input { flex: 1; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.suggestion-pill {
  font-size: 11.5px; padding: 3px 10px;
  border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-secondary); color: var(--text-muted);
  cursor: pointer; transition: border-color var(--transition), color var(--transition);
}
.suggestion-pill:hover { border-color: var(--primary); color: var(--primary); }

/* ── Summary card ── */
.summary-item { margin-bottom: 12px; }
.summary-item .card-body { display: flex; flex-direction: column; gap: 8px; }
.summary-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.summary-title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; }
.summary-url { font-size: 11px; color: var(--text-faint); font-family: monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px; }
.summary-text { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.sentiment-pill {
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  white-space: nowrap;
}
.sentiment-pill.bullish { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.sentiment-pill.bearish { background: var(--error-bg);   color: var(--error);   border: 1px solid #fecaca; }
.sentiment-pill.neutral { background: var(--bg-secondary); color: var(--neutral); border: 1px solid var(--border); }
.summary-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.key-points-toggle { font-size: 12px; color: var(--primary); font-weight: 500; display: flex; align-items: center; gap: 4px; cursor: pointer; background: none; border: none; }
.key-points-toggle:hover { opacity: .75; }
.key-points-list { padding: 8px 0 4px 12px; border-left: 2px solid var(--primary-light); }
.key-points-list li { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 4px; list-style: none; }
.time-ago { font-size: 11px; color: var(--text-faint); }

/* ── Empty state ── */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 60px 20px; }
.empty-state svg { width: 40px; height: 40px; color: var(--text-faint); margin-bottom: 14px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; color: var(--text-muted); max-width: 280px; }

/* ── Auth page ── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  padding: 20px;
}
.auth-box { width: 100%; max-width: 380px; }
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand h1 { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 12px; }
.auth-brand p  { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.auth-card .card-body { padding: 28px; }
.auth-footer { text-align: center; margin-top: 16px; font-size: 11.5px; color: var(--text-faint); display: flex; align-items: center; justify-content: center; gap: 5px; }
.auth-pills  { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; }
.auth-pill   { font-size: 11px; padding: 3px 10px; border-radius: 20px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); }

/* ── Profile ── */
.profile-user-card { display: flex; align-items: center; gap: 16px; padding: 20px; margin-bottom: 20px; }
.profile-avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0; }
.profile-meta h2  { font-size: 16px; font-weight: 700; }
.profile-meta p   { font-size: 13px; color: var(--text-muted); }
.profile-meta .role-badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 20px; border: 1px solid var(--primary-light); color: var(--primary); background: var(--primary-light); margin-top: 4px; font-weight: 600; }
.info-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-row span:first-child { color: var(--text-muted); }
.info-row span:last-child  { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; color: var(--text); }

/* ── Skeleton ── */
@keyframes shimmer { 0%{background-position:-200% 0} 100%{background-position:200% 0} }
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-secondary) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
  #main { margin-left: 0; }
  #topbar { display: flex; }
  #page-content { padding: 20px 16px; }
  .rate-grid { grid-template-columns: 1fr 1fr; }
  .summary-bar { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .overlay { display: block; }
  .url-form-row { flex-direction: column; }
}
@media (max-width: 480px) {
  .rate-grid { grid-template-columns: 1fr; }
  .summary-bar { grid-template-columns: 1fr; }
}

/* ── Overlay mobile ── */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }

/* ── Attribution ── */
.attribution { text-align: center; font-size: 11px; color: var(--text-faint); padding: 10px; }
.attribution a { color: var(--text-faint); }
.attribution a:hover { color: var(--primary); }


/* Animation rotation bouton Actualiser */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Revue de presse — contenu HTML ── */
.press-html-content { color: var(--text-primary); }
.press-html-content h1,.press-html-content h2,.press-html-content h3 {
  font-size:15px; font-weight:700; color:var(--text-primary); margin:14px 0 6px;
}
.press-html-content h4,.press-html-content h5 {
  font-size:13.5px; font-weight:600; margin:10px 0 4px;
}
.press-html-content p  { margin:0 0 10px; line-height:1.7; }
.press-html-content ul,.press-html-content ol { padding-left:20px; margin:0 0 10px; }
.press-html-content li { margin-bottom:4px; line-height:1.6; }
.press-html-content a  {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.press-html-content a:hover { color: var(--primary-dark, #1558a0); }
.press-html-content strong,.press-html-content b { font-weight:700; }
.press-html-content em,.press-html-content i { font-style:italic; }
.press-html-content blockquote {
  border-left:3px solid var(--border); padding-left:12px;
  color:var(--text-muted); margin:10px 0;
}
.press-html-content hr { border:none; border-top:1px solid var(--border); margin:12px 0; }
