/* ============================================================
   APPARENCE DU TABLEAU DE BORD — v1
   ------------------------------------------------------------
   Design epure. Vert = ca monte, Rouge = ca baisse.
   Le reste reste sobre (gris/blanc) pour ne pas distraire.
   ============================================================ */

/* --- Variables de couleurs : on les definit une fois, on les reutilise --- */
:root {
  --fond: #0f1115;          /* fond sombre, reposant pour les yeux */
  --carte: #1a1d24;         /* fond des blocs */
  --texte: #e6e6e6;         /* texte principal */
  --texte-doux: #9aa0aa;    /* texte secondaire (gris) */
  --bordure: #2a2e37;
  --vert: #16c784;          /* hausse */
  --rouge: #ea3943;         /* baisse */
  --accent: #f0b90b;        /* jaune (avertissement) */
}

/* --- Thème CLAIR : on remplace juste les couleurs de fond/texte ---
   (le vert, le rouge et le jaune d'accent restent identiques dans les 2 thèmes) */
body.theme-clair {
  --fond: #f4f6f9;
  --carte: #ffffff;
  --texte: #1a1d24;
  --texte-doux: #5b636e;
  --bordure: #e2e6ec;
}

/* --- Reglages generaux --- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.5;
}

/* --- Bandeau d'avertissement --- */
.avertissement {
  background: rgba(240, 185, 11, 0.12);
  border-bottom: 2px solid var(--accent);
  color: #f5d76e;
  padding: 12px 20px;
  text-align: center;
  font-size: 0.9rem;
}

/* --- En-tete --- */
.entete {
  text-align: center;
  padding: 28px 20px 12px;
}
.entete h1 { margin: 0 0 4px; font-size: 1.8rem; }
.sous-titre { color: var(--texte-doux); margin: 0; }
.statut { color: var(--texte-doux); font-size: 0.85rem; margin-top: 8px; }

/* --- Conteneur du tableau (permet de scroller horizontalement sur mobile) --- */
.tableau-conteneur {
  max-width: 1000px;
  margin: 20px auto;
  padding: 0 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--carte);
  border-radius: 12px;
  overflow: hidden;
}

th, td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--bordure);
  white-space: nowrap;
}

th {
  color: var(--texte-doux);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Aligne certaines colonnes a droite (les chiffres se lisent mieux ainsi) */
.droite { text-align: right; }

tbody tr:hover { background: rgba(127, 127, 127, 0.10); }
tbody tr:last-child td { border-bottom: none; }

/* --- Nom + logo de la crypto --- */
.crypto-cellule { display: flex; align-items: center; gap: 10px; }
.crypto-cellule img { width: 26px; height: 26px; }
.crypto-nom { font-weight: 600; }
.crypto-symbole { color: var(--texte-doux); text-transform: uppercase; font-size: 0.8rem; }

/* --- Couleurs des variations --- */
.hausse { color: var(--vert); }
.baisse { color: var(--rouge); }

.chargement, .erreur {
  text-align: center;
  color: var(--texte-doux);
  padding: 30px;
}
.erreur { color: var(--rouge); }

/* --- Colonne RSI (neutre, PAS de vert/rouge) --- */
.rsi-cellule .rsi-valeur { font-weight: 700; font-size: 1rem; }
.rsi-cellule .rsi-zone {
  display: block;
  font-size: 0.72rem;
  color: var(--texte-doux);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* --- Colonne moyennes mobiles --- */
.mm-cellule { font-size: 0.82rem; color: var(--texte-doux); }
.mm-cellule div { white-space: nowrap; }

/* --- Colonne contexte : petites étiquettes neutres (grises) --- */
.contexte-cellule { max-width: 240px; white-space: normal; }
.etiquette {
  display: inline-block;
  background: rgba(127, 127, 127, 0.14);
  border: 1px solid var(--bordure);
  color: var(--texte);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  margin: 2px 2px 2px 0;
}

/* --- Petit "…" pendant que les indicateurs se calculent --- */
.attente { color: var(--texte-doux); font-style: italic; }

/* --- Bloc sentiment (Fear & Greed) --- */
/* Couleur volontairement NEUTRE (jaune/gris), pour ne pas confondre
   avec le vert/rouge réservé aux variations de prix. */
.sentiment {
  max-width: 1000px;
  margin: 16px auto 0;
  padding: 16px 20px;
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  text-align: center;
}
.sentiment-titre {
  display: block;
  color: var(--texte-doux);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sentiment-corps { margin: 6px 0; }
.sentiment-valeur { font-size: 2.2rem; font-weight: 700; color: var(--accent); }
.sentiment-libelle {
  display: inline-block;
  margin-left: 10px;
  font-size: 1rem;
  color: var(--texte);
  vertical-align: middle;
}
.sentiment-echelle { color: var(--texte-doux); font-size: 0.75rem; }

/* --- Bannière des alertes déclenchées --- */
.bandeau-alertes {
  max-width: 1000px;
  margin: 16px auto 0;
  padding: 14px 18px;
  background: rgba(240, 185, 11, 0.14);
  border: 1px solid var(--accent);
  border-radius: 12px;
  color: #f5d76e;
}
.bandeau-alertes strong { color: #ffe89a; }
.bandeau-alertes ul { margin: 8px 0 0; padding-left: 20px; }
.bandeau-alertes li { margin: 4px 0; }

/* --- Ligne du tableau en alerte (surlignage neutre) --- */
tbody tr.en-alerte { background: rgba(240, 185, 11, 0.10); }
tbody tr.en-alerte td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* --- Panneau "Mes alertes" --- */
.panneau {
  max-width: 1000px;
  margin: 24px auto 0;
  padding: 20px;
}
.panneau h2 { margin: 0 0 6px; font-size: 1.2rem; }
.panneau-info { color: var(--texte-doux); font-size: 0.85rem; margin: 0 0 16px; }

.form-alerte {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.form-alerte label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--texte-doux);
}
.form-alerte select,
.form-alerte input {
  background: var(--carte);
  border: 1px solid var(--bordure);
  color: var(--texte);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
  min-width: 130px;
}
.form-alerte button {
  background: var(--accent);
  color: #1a1d24;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}
.form-alerte button:hover { filter: brightness(1.08); }

.liste-alertes { list-style: none; padding: 0; margin: 18px 0 0; }
.liste-alertes li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.liste-alertes .etat { color: var(--texte-doux); font-size: 0.8rem; }
.liste-alertes .active { color: var(--accent); font-weight: 600; }
.liste-alertes button {
  background: transparent;
  border: 1px solid var(--bordure);
  color: var(--texte-doux);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}
.liste-alertes button:hover { color: var(--rouge); border-color: var(--rouge); }
.liste-vide { color: var(--texte-doux); font-size: 0.85rem; font-style: italic; }

/* --- Pied de page --- */
.pied {
  text-align: center;
  color: var(--texte-doux);
  font-size: 0.8rem;
  padding: 24px 20px 40px;
}
.pied a { color: var(--texte-doux); }

/* --- Barre d'outils (thème, notifications, favoris) --- */
.barre-outils {
  max-width: 1000px;
  margin: 16px auto 0;
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.btn-outil {
  background: var(--carte);
  border: 1px solid var(--bordure);
  color: var(--texte);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-outil:hover { border-color: var(--accent); }
.filtre-favoris {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--texte-doux);
  font-size: 0.85rem;
  cursor: pointer;
}
.filtre-favoris input { cursor: pointer; }

/* --- Étoile "favori" dans la cellule crypto --- */
.etoile {
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--texte-doux);
  user-select: none;
  margin-right: 2px;
}
.etoile:hover { color: var(--accent); }
.etoile.active { color: var(--accent); }

/* --- Mini-graphique de tendance (sparkline) --- */
.sparkline { display: inline-block; vertical-align: middle; }

/* --- Avertissement RENFORCÉ (page radar memecoins) --- */
.avertissement-fort {
  background: rgba(234, 57, 67, 0.14);
  border-bottom: 2px solid var(--rouge);
  color: #ff9aa0;
}

/* --- Liens (retour tableau de bord + DexScreener) --- */
.lien-retour { color: var(--accent); text-decoration: none; font-size: 0.9rem; }
.lien-retour:hover { text-decoration: underline; }
.lien-dex { color: var(--texte-doux); text-decoration: none; white-space: nowrap; }
.lien-dex:hover { color: var(--accent); }

/* --- Badge de chaîne (Solana / Ethereum / Base) --- */
.badge-chaine {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.7rem;
  color: var(--texte-doux);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 1px 7px;
  vertical-align: middle;
}

/* --- Contrôle anti-arnaque : badges vert/rouge/gris --- */
.risque-cellule { white-space: normal; max-width: 320px; }
.badge {
  display: inline-block;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.72rem;
  margin: 2px 2px 2px 0;
  border: 1px solid transparent;
}
.badge-ok { background: rgba(22, 199, 132, 0.15); color: var(--vert); border-color: rgba(22, 199, 132, 0.4); }
.badge-danger { background: rgba(234, 57, 67, 0.15); color: var(--rouge); border-color: rgba(234, 57, 67, 0.4); }
.badge-attention { background: rgba(240, 185, 11, 0.15); color: var(--accent); border-color: rgba(240, 185, 11, 0.45); }
.badge-neutre { background: rgba(127, 127, 127, 0.14); color: var(--texte-doux); }

/* Ligne surlignée quand le score de risque est élevé */
tbody tr.ligne-danger { background: rgba(234, 57, 67, 0.07); }
tbody tr.ligne-danger td:first-child { box-shadow: inset 3px 0 0 var(--rouge); }
.btn-verif {
  background: var(--carte);
  border: 1px solid var(--bordure);
  color: var(--texte);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.8rem;
}
.btn-verif:hover { border-color: var(--accent); }

/* --- Bouton d'accès au radar depuis le tableau de bord --- */
.lien-radar {
  display: inline-block;
  margin-top: 8px;
  background: rgba(234, 57, 67, 0.12);
  border: 1px solid var(--rouge);
  color: #ff9aa0;
  border-radius: 20px;
  padding: 6px 16px;
  text-decoration: none;
  font-size: 0.9rem;
}
.lien-radar:hover { filter: brightness(1.1); }

/* --- Pied de page --- */
.pied {
  text-align: center;
  color: var(--texte-doux);
  font-size: 0.8rem;
  padding: 24px 20px 40px;
}
.pied a { color: var(--texte-doux); }

/* --- Adaptations pour petits ecrans (telephone) --- */
@media (max-width: 600px) {
  .entete h1 { font-size: 1.4rem; }
  th, td { padding: 10px 8px; font-size: 0.85rem; }
}
