﻿/* static/css/analyses.css
   Flux Montréal — Analyses (page dédiée) — 2026 PRO
   - UI clean, cohérente avec la page principale
   - Tooltip ApexCharts dark (#283242)
   - Boutons période: fond #274F75 + actif premium (pas de blanc)
*/

:root{
  --a-bg:#0b1220;
  --a-border:rgba(148,163,184,.18);
  --a-text:#e8eef6;
  --a-muted:rgba(232,238,246,.72);

  /* Surfaces */
  --a-surface-1:rgba(30,41,59,.55);
  --a-surface-2:rgba(2,6,23,.40);

  /* Popups / tooltip */
  --a-pop:#283242;
  --a-pop-border:rgba(255,255,255,.10);

  /* Accent Flux (bleu propre, pas flashy) */
  --a-accent:#2DA2E0;

  /* Boutons période */
  --a-range-fill:#274F75;          /* ✅ demandé: intérieur boutons */
  --a-range-border:rgba(39,79,117,.80);
  --a-range-text:rgba(232,238,246,.92);

  /* Bouton actif */
  --a-range-active-bg:rgba(45,162,224,.22);
  --a-range-active-border:rgba(45,162,224,.55);
  --a-range-active-text:rgba(232,238,246,.98);

  --a-shadow:0 22px 60px rgba(0,0,0,.55);
  --a-shadow2:0 18px 46px rgba(0,0,0,.45);

  /* Focus ring accessible */
  --a-focus:0 0 0 3px rgba(45,162,224,.22);
}

html, body{ height:100%; }

body{
  margin:0;
  font-family:Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 20% -10%, rgba(45,162,224,.10), transparent 55%),
    radial-gradient(1000px 600px at 90% 0%, rgba(96,165,250,.10), transparent 50%),
    radial-gradient(900px 650px at 40% 115%, rgba(239,68,68,.08), transparent 55%),
    var(--a-bg);
  color:var(--a-text);
  overflow-x:hidden;
}

/* =========================================================
   Topbar
   ========================================================= */
.a-topbar{
  position:sticky;
  top:0;
  z-index:1000;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(15,23,42,.82), rgba(15,23,42,.55));
  border-bottom:1px solid var(--a-border);
}

.a-topbar-inner{
  max-width:1180px;
  margin:0 auto;
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

.a-brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:var(--a-text);
  min-width:0;
}

.a-brand img{
  width:34px;
  height:34px;
  border-radius:10px;
  box-shadow:0 10px 26px rgba(0,0,0,.45);
}

.a-brand-title{
  display:flex;
  flex-direction:column;
  line-height:1.1;
  min-width:0;
}

.a-brand-title strong{
  font-weight:900;
  letter-spacing:.02em;
  font-size:14px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.a-brand-title span{
  font-size:12px;
  color:var(--a-muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.a-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex:0 0 auto;
}

.a-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 11px;
  border-radius:999px;
  border:1px solid var(--a-border);
  background:rgba(2,6,23,.35);
  color:var(--a-text);
  text-decoration:none;
  font-size:13px;
  font-weight:800;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.a-pill:hover{
  transform: translateY(-1px);
  background:rgba(2,6,23,.48);
  border-color:rgba(148,163,184,.28);
}

.a-pill i{ font-size:16px; color:rgba(229,231,235,.85); }

/* =========================================================
   Layout + Card
   ========================================================= */
.a-wrap{
  max-width:1180px;
  margin:0 auto;
  padding:22px 16px 60px;
}

.a-card{
  border:1px solid var(--a-border);
  background:linear-gradient(180deg, var(--a-surface-1), var(--a-surface-2));
  border-radius:18px;
  box-shadow:var(--a-shadow);
  overflow:hidden;
}

.a-card-pad{ padding:18px; }

.a-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
  flex-wrap:wrap;
}

.a-title{
  margin:0;
  font-size:15px;
  font-weight:900;
  letter-spacing:.06em;
  text-transform:uppercase;
  color:rgba(232,238,246,.86);
}

.a-note{
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  color: rgba(232,238,246,.68);
}
.a-note strong{
  color: rgba(232,238,246,.90);
}

/* =========================================================
   Controls row (dropdown + périodes)
   ========================================================= */
.a-controls{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  margin-bottom:10px;
}

/* Sélecteur entreprise — largeur maîtrisée */
.a-netwrap{
  flex:0 0 auto;
  width:360px;
  max-width:360px;
  min-width:360px;
}

@media (max-width: 520px){
  .a-netwrap{
    width:100%;
    min-width:0;
    max-width:100%;
  }
}

.a-netwrap .hm-city-btn{
  width:100%;
  justify-content:space-between;
  border-radius:12px;
  border:1px solid rgba(148,163,184,.20);
  background:rgba(2,6,23,.35);
  color:rgba(232,238,246,.92);
  font-weight:900;
  padding:10px 14px;
  transition: border-color .12s ease, background .12s ease;
}

.a-netwrap .hm-city-btn:hover{
  background:rgba(2,6,23,.48);
  border-color:rgba(148,163,184,.28);
}

.a-netwrap .hm-city-btn:focus{
  outline: none;
  box-shadow: var(--a-focus);
}

.a-netwrap .hm-city-menu{
  width:100%;
  min-width:100%;
  max-width:100%;
  background: var(--a-pop);
  border:1px solid var(--a-pop-border);
  box-shadow: 0 18px 46px rgba(0,0,0,.55);
  border-radius:12px;
  padding:6px;
}

.a-netwrap .hm-city-menu .dropdown-item{
  color:rgba(232,238,246,.88);
  border-radius:10px;
  padding:9px 10px;
  font-weight:900;
}

.a-netwrap .hm-city-menu .dropdown-item:hover{
  background: rgba(255,255,255,.06);
}

.a-netwrap .hm-city-menu .dropdown-item.active{
  background: rgba(45,162,224,.16);
  color:#e8eef6;
}

#aNetworkLabel,
#anNetworkLabel{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:100%;
}

.a-range{
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:flex-end;
  flex:0 0 auto;
  flex-wrap:wrap;
}

/* =========================================================
   Boutons période — Flat + contour global #274F75
   ========================================================= */

.a-range .btn-group.a-range-group{
  border: 1px solid #274F75;   /* ✅ contour global */
  border-radius: 12px;
  overflow: hidden;
  background: #1E293B;
}

/* Tous les boutons */
.a-range-group .btn{
  border: none !important;     /* aucun contour individuel */
  background: #1E293B !important;
  color: rgba(232,238,246,.92) !important;
  font-weight: 900;
  letter-spacing: .01em;
  box-shadow: none !important;
  transition: background .15s ease;
}

/* Hover */
.a-range-group .btn:hover{
  background: #243247 !important;
}

/* Bouton sélectionné */
.a-range-group .btn.btn-light,
.a-range-group .btn.active{
  background: #274F75 !important;   /* ✅ sélection */
  color: #e8eef6 !important;
}

/* Focus clavier discret */
.a-range-group .btn:focus{
  outline: none !important;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.12);
}


/* =========================================================
   Chart container
   ========================================================= */
.a-chart-wrap{
  position:relative;
  height:540px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,.14);
  background:
    radial-gradient(900px 280px at 20% 0%, rgba(45,162,224,.08), transparent 55%),
    rgba(2,6,23,.30);
  overflow:hidden;
  box-shadow: var(--a-shadow2);
}

/* Loader / Error overlays */
.a-overlay{
  position:absolute;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  background:rgba(2,6,23,.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index:10;
  text-align:center;
}

.a-overlay.show{ display:flex; }

.a-overlay .box{
  border:1px solid rgba(148,163,184,.18);
  background:rgba(2,6,23,.55);
  border-radius:16px;
  padding:14px 14px;
  max-width:680px;
  box-shadow:0 22px 60px rgba(0,0,0,.55);
}

.a-overlay .t{
  font-weight:900;
  letter-spacing:.04em;
  margin:0 0 6px;
  font-size:13px;
  text-transform:uppercase;
  color:rgba(232,238,246,.88);
}

.a-overlay .m{
  margin:0;
  font-size:13px;
  color:rgba(232,238,246,.72);
  line-height:1.5;
}

/* =========================================================
   ApexCharts tooltip — Dark (centré)
   ========================================================= */
.apexcharts-tooltip,
.apexcharts-xaxistooltip,
.apexcharts-yaxistooltip{
  background: var(--a-pop) !important;
  color: rgba(232,238,246,.92) !important;
  border: 1px solid var(--a-pop-border) !important;
  box-shadow: 0 18px 46px rgba(0,0,0,.55) !important;
  border-radius: 12px !important;
}

.apexcharts-tooltip-title{
  background: rgba(255,255,255,.05) !important;
  border-bottom: 1px solid rgba(255,255,255,.08) !important;
  color: rgba(232,238,246,.88) !important;
  font-weight: 900 !important;
  text-align:center !important;
  justify-content:center !important;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 992px){
  .a-chart-wrap{ height:420px; }
  .a-netwrap{ min-width: 100%; }
  .a-range{ justify-content:flex-start; }
}

@media (max-width: 520px){
  .a-chart-wrap{ height:380px; }
}

/* ✅ Graphique 2 — range à gauche en mobile (comme Graphique 1) */
@media (max-width: 992px){
  .a-controls-stmtypes{
    justify-content: flex-start !important;
  }
}

/* =========================================================
   Graphique 2 — header aligné modèle Graphique 1
   Desktop: titre + note à gauche / boutons à droite
   Mobile: tout empilé proprement (sans écraser le titre)
   ========================================================= */

.a-head-stmtypes{
  align-items:flex-start;        /* le titre & note partent du haut */
}

.a-head-stmtypes .a-head-left{
  flex:1 1 auto;
  min-width:0;                   /* évite overflow/écrasement */
}

.a-range-stmtypes{
  flex:0 0 auto;
  margin-top:2px;                /* micro alignement vertical */
}

/* Mobile/tablette: stack comme Graphique 1 */
@media (max-width: 992px){
  .a-head-stmtypes{
    flex-direction:column;
    align-items:flex-start;
    gap:10px;
  }

  .a-range-stmtypes{
    width:100%;
  }

  .a-range-stmtypes .a-range-group{
    justify-content:flex-start;
  }

  /* IMPORTANT: on laisse la note wrap sur mobile */
  .a-head-stmtypes .a-note{
    white-space:normal;
  }
}
