/* ============================================================
   RSS VEILLE IA — style.css
   Charte "Ghost" — Mode sombre profond
   ============================================================ */

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

/* =========================
   VARIABLES
   ========================= */
:root {
  --bg:     #0f172a;
  --bg2:    #1e293b;
  --bg3:    #263145;
  --border: #334155;
  --text:   #e2e8f0;
  --muted:  #94a3b8;
  --accent: #38bdf8;
  --green:  #34d399;
  --amber:  #fbbf24;
  --red:    #f87171;
  --purple: #a78bfa;

  /* Bordures sémantiques catégories */
  --cat-alerte:   #ef4444;
  --cat-tech:     #3b82f6;
  --cat-lab:      #a78bfa;
  --cat-regl:     #f59e0b;
  --cat-logiciel: #10b981;

  --mono: 'JetBrains Mono', monospace;
  --sans: 'DM Sans', sans-serif;
}

/* =========================
   RESET & BASE
   ========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
  letter-spacing: 0.01em;
}

/* =========================
   HEADER
   ========================= */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.logo span { color: var(--muted); }

.header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* =========================
   STATUS DOT
   ========================= */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  transition: all 0.3s;
}

.status-dot.loading {
  animation: pulse 1s ease-in-out infinite;
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* =========================
   BOUTONS
   ========================= */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.06);
}

.icon-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
}

@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn.spinning { animation: spin 1s linear infinite; }

/* =========================
   STATS BAR
   ========================= */
.stats-bar {
  display: flex;
  gap: 20px;
  padding: 12px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-val {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

.stat-key {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

/* =========================
   NAVIGATION
   ========================= */
.nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tab {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-badge {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
}

/* =========================
   LAYOUT PRINCIPAL
   ========================= */
.main {
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.view { display: none; }
.view.active { display: block; }

.section-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* =========================
   ARTICLES
   ========================= */
.article-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}

.article-card:hover { border-color: var(--muted); }

/* Corps principal de la carte */
.article-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.article-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

/* Titre à gauche */
.article-title-row .article-title {
  flex: 1;
  min-width: 0;
  order: 1;
}

/* Boutons à droite, côte à côte */
.article-title-row .article-actions {
  order: 2;
  display: flex;
  flex-direction: row;  /* ← force le côte à côte */
  gap: 4px;
  flex-shrink: 0;
  padding-top: 2px;
}
/* Score */
.article-score {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  min-width: 34px;
  text-align: center;
  padding: 4px 0;
  border-radius: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.score-high { color: var(--red);    border-color: var(--red); }
.score-med  { color: var(--amber);  border-color: var(--amber); }
.score-low  { color: var(--muted);  border-color: var(--border); }

/* Contenu article */
.article-content { flex: 1; min-width: 0; }

.article-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  display: block;
  line-height: 1.5;
  flex: 1;
  min-width: 0;
}

.article-title:hover { color: var(--accent); }

.article-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* Boutons actions article */
.article-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.article-action-btn:hover  { background: var(--bg3); }
.fav-btn:hover  { border-color: var(--amber); color: var(--amber); }
.del-btn:hover  { border-color: var(--red);   color: var(--red); }

.article-read-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  transition: all 0.15s;
}

.article-read-btn:hover {
  border-color: var(--green);
  color: var(--green);
  background: rgba(52, 211, 153, 0.05);
}

.load-more-btn {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.load-more-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =========================
   BOUTONS TRI (Ghost style)
   ========================= */
.sort-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sort-btn {
  height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.sort-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.06);
}

.sort-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
}

/* =========================
   SYNTHÈSES — STRUCTURE
   ========================= */
.synthesis-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

/* Couleurs sémantiques par catégorie */
.cat-alertes   { border-left-color: var(--cat-alerte); }
.cat-tech      { border-left-color: var(--cat-tech); }
.cat-lab       { border-left-color: var(--cat-lab); }
.cat-regl      { border-left-color: var(--cat-regl); }
.cat-logiciels { border-left-color: var(--cat-logiciel); }

.synthesis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.synthesis-label {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--accent);
}

.synthesis-actions {
  display: flex;
  gap: 6px;
}

.synthesis-body {
  font-size: 14px;
  line-height: 1.75;
  color: #cbd5e1;
}

.synthesis-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin: 0 auto 0 10px;
}

/* =========================
   BLOCS INTERNES SYNTHÈSES
   (bordures sémantiques, sans backgrounds colorés)
   ========================= */
.alert-block {
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: transparent;
  border-left: 3px solid var(--border);
}

.alert-resume    { border-left-color: var(--cat-alerte); }
.alert-impact    { border-left-color: var(--amber); }
.alert-indicateurs { border-left-color: var(--purple); }
.alert-actions   { border-left-color: var(--green); }

.alert-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.alert-content {
  font-size: 13px;
  line-height: 1.7;
  color: #cbd5e1;
}

/* =========================
   BOUTONS SYNTHÈSES
   ========================= */
.syn-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  transition: all 0.15s;
}

.syn-btn:hover         { background: var(--bg3); }
.syn-btn-read:hover    { border-color: var(--green);  color: var(--green); }
.syn-btn-share:hover   { border-color: var(--accent); color: var(--accent); }
.syn-btn-del:hover     { border-color: var(--red);    color: var(--red); }

/* =========================
   SOURCES SYNTHÈSES
   ========================= */
.synthesis-sources {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.src-label  { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-right: 6px; }
.src-link   { color: var(--accent); text-decoration: none; font-size: 12px; margin-right: 4px; }
.src-link:hover { text-decoration: underline; }
.src-domain { color: var(--muted); font-size: 11px; font-family: var(--mono); }

/* =========================
   MARKDOWN RENDU
   ========================= */
.syn-h2 { font-size: 15px; font-weight: 700; color: var(--accent); margin: 14px 0 6px; }
.syn-h3 { font-size: 13px; font-weight: 700; color: var(--text);   margin: 10px 0 4px; }
.syn-h4 { font-size: 12px; font-weight: 600; color: var(--muted);  margin: 8px 0 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.syn-hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

.syn-list {
  margin: 8px 0 8px 16px;
  padding: 0;
  list-style: none;
}

.syn-list li {
  font-size: 14px;
  line-height: 1.7;
  color: #cbd5e1;
  margin-bottom: 6px;
  padding-left: 12px;
  position: relative;
}

.syn-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 11px;
  top: 3px;
}

/* =========================
   SANTÉ DES FLUX
   ========================= */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.health-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.h-ok    { background: var(--green); box-shadow: 0 0 5px var(--green); }
.h-stale { background: var(--amber); }
.h-error { background: var(--red);   box-shadow: 0 0 5px var(--red); }

.health-name {
  font-size: 12px;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================
   TOAST
   ========================= */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.bloc-number {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
}

.bloc-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.src-date {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
}
