/* =========================================================
   xProTrading — THEME.CSS (FINAL)
   ✅ Fond global propre (dark + light)
   ✅ Variables centralisées
   ✅ Accent bleu différent (dark vs light) — PRO SaaS
   ✅ Jours hors mois visibles mais discrets
   ✅ Safe-area iOS + anti scroll horizontal
   ========================================================= */

/* ===== 1) COULEURS PRINCIPALES (à ajuster si besoin) ===== */
:root{
  /* DARK – noir élégant (pas #000 pour éviter “bouché”) */
  --bg:  #0e1218;   /* fond principal */
  --bg2: #0b0f14;   /* fond secondaire */

  /* LIGHT – blanc doux (anti-éblouissement) */
  --bgL:  #f6f7f9;  /* fond principal clair */
  --bgL2: #eef1f4;  /* fond secondaire clair */

  /* Texte global (via var(--text)) */
  --text-dark: rgba(255,255,255,.92);
  --text-light:#14161a;

  /* ✅ ACCENT — bleu différent selon thème (PRO SaaS) */
  --accent-dark:  #42A5F5; /* vibrant en dark */
  --accent-light: #1976D2; /* corporate en light */
}

/* ===== 2) BASE : on évite tout fond concurrent ===== */
html, body{
  min-height: 100%;
  margin: 0;
  background: transparent !important;
  overflow-x: hidden; /* évite la bande à droite quand un élément déborde */
}

/* (optionnel) améliore le rendu iOS */
body{
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===== 3) LE SEUL FOND GLOBAL : .app-bg ===== */
.app-bg{
  min-height: 100vh;
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
    radial-gradient(circle at 20% 30%, rgba(66,165,245,.12), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,193,7,.10), transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-size: 40px 40px, 40px 40px, cover, cover, cover;
  background-attachment: fixed;
}

body.light-mode .app-bg,
html.light-mode .app-bg{
  background:
    linear-gradient(rgba(0,0,0,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.12) 1px, transparent 1px),
    radial-gradient(circle at 20% 30%, rgba(66,165,245,.15), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(255,193,7,.12), transparent 50%),
    linear-gradient(180deg, var(--bgL) 0%, var(--bgL2) 100%);
  background-size: 40px 40px, 40px 40px, cover, cover, cover;
  background-attachment: fixed;
}

@media (max-width: 768px){
  .app-bg{
    background-size: 28px 28px, 28px 28px, cover, cover, cover;
  }
}

/* ===== 4) TEXTE GLOBAL + ACCENT GLOBAL (dark/light) ===== */
:root{
  --text: var(--text-dark);
}

/* Dark */
body:not(.light-mode){
  --text: var(--text-dark);
  --accent: var(--accent-dark);
  --accent-glow: rgba(66,165,245,.12);
}

/* Light */
body.light-mode{
  --text: var(--text-light);
  --accent: var(--accent-light);
  --accent-glow: rgba(25,118,210,.12);
}

/* ===== 5) SAFE-AREA iOS + container padding (anti “rebord” iphone) ===== */
main.container{
  box-sizing: border-box;
  width: 100%;
  padding-left: 16px;
  padding-right: 16px;
}

@media (max-width: 1024px){
  main.container{
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
}

/* ===== 6) ANTI DÉBORDEMENT GLOBAL (utile si header/menu pousse) ===== */
.app, .app *{
  box-sizing: border-box;
}
img, video, canvas{
  max-width: 100%;
}

/* =========================================================
   CALENDAR — Jours hors mois (cases “empty”)
   => visibles mais moins intenses
   ========================================================= */

/* Light */
body.light-mode .calendar-cell.empty{
  background: rgba(0,0,0,.055);
  border: 1px dashed rgba(0,0,0,.18);
  opacity: .65;
}

/* Dark */
body:not(.light-mode) .calendar-cell.empty{
  background: rgba(255,255,255,.045);
  border: 1px dashed rgba(255,255,255,.14);
  opacity: .45;
}

/* =========================================================
   (Optionnel) PETIT + : uniformiser le fond des zones “surface”
   (ne casse rien, juste améliore la lisibilité)
   Si tu ne veux PAS toucher aux cards => tu peux supprimer ce bloc.
   ========================================================= */
body.light-mode{
  --surface-bg: rgba(255,255,255,.88);
  --surface-border: rgba(0,0,0,.10);
}
body:not(.light-mode){
  --surface-bg: rgba(255,255,255,.06);
  --surface-border: rgba(255,255,255,.14);
}

.calendar-cell.empty{
  transition: opacity .12s ease, transform .12s ease;
}

/* Desktop hover */
.calendar-cell.empty:hover{
  opacity: .85;
}

/* Mobile touch */
.calendar-cell.empty:active{
  opacity: .85;
  transform: scale(.99);
}

/* Bonus : au lieu d’opacité seule, change aussi le fond => bien visible */
body.light-mode .calendar-cell.empty:hover,
body.light-mode .calendar-cell.empty:active{
  background: rgba(0,0,0,.085);
}

body:not(.light-mode) .calendar-cell.empty:hover,
body:not(.light-mode) .calendar-cell.empty:active{
  background: rgba(255,255,255,.07);
}

/* Jour du mois SANS trade (neutre) — pas de pointillés */
body:not(.light-mode) .calendar-cell.neutral{
  background: rgba(255,255,255,.02) !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  opacity: .95;
}

body.light-mode .calendar-cell.neutral{
  background: rgba(0,0,0,.02) !important;
  border: 1px solid rgba(0,0,0,.10) !important;
  opacity: .98;
}

/* =========================================================
   CALENDAR — Sparkline horizontale (pro & clean)
   ========================================================= */

/* important : le parent doit être relatif */
.calendar-cell{
  position: relative;
}

/* barre en bas, largeur pilotée par style="width:xx%" */
.calendar-sparkline{
  position: absolute;
  left: 8px;
  bottom: 6px;

  height: 4px;
  border-radius: 4px;

  background: currentColor;  /* prend la couleur du texte */
  opacity: .55;

  pointer-events: none;      /* ne gêne pas le clic/édition */
}

/* sécurité anti pseudo-éléments */
.calendar-sparkline::before,
.calendar-sparkline::after{
  content: none !important;
}

.calendar-cell.day-positive{ --spark: rgba(76,175,80,.9); }
.calendar-cell.day-negative{ --spark: rgba(244,67,54,.9); }
.calendar-cell.neutral     { --spark: rgba(255,255,255,.25); }

.calendar-sparkline{
  background: var(--spark);
  z-index: 1;
}

.calendar-amount{
  position: relative;
  z-index: 2;
}

.calendar-cell.is-selected{
  outline: 2px solid rgba(255,193,7,.9);
  box-shadow: 0 0 0 4px rgba(255,193,7,.15);
}

/* =========================================================
   INFO — bouton + modal
   ========================================================= */

.info-row{
  display:flex;
  justify-content:center;
  margin-top: 10px;
}

.info-btn{
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.15);
  background: rgba(255,255,255,.75);
  color:#111;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

/* Modal */
.info-modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}
.info-modal.open{ display:block; }

.info-modal-overlay{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.45);
}

.info-modal-card{
  background: var(--surface-bg);
  color: var(--text);
  border: 1px solid var(--surface-border);
}

.info-modal-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.info-modal-title{ font-weight: 800; }

.info-modal-close{
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor:pointer;
  color: inherit;
}

.info-modal-body{
  padding: 14px;
  font-size: 14px;
  line-height: 1.45;
  opacity: .95;
  white-space: pre-line; /* ✅ garde les retours à la ligne */
}

body:not(.light-mode) .info-btn{
  background: rgba(0,0,0,.25);
  color:#fff;
  border-color: rgba(255,255,255,.18);
}

body:not(.light-mode) .info-modal-card{
  background: #121418;
  color: #fff;
}

body:not(.light-mode) .info-modal-head{
  border-bottom-color: rgba(255,255,255,.10);
}

/* =========================================================
   LEGAL PAGES — xProTrading
   ========================================================= */

.legal-page{
  padding-top: calc(var(--appHeaderH, 70px) + 24px);
  padding-bottom: 60px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== HERO ===== */
.legal-hero{
  padding: 28px 32px;
  border-radius: 18px;
  margin-bottom: 36px;

  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  backdrop-filter: blur(10px);
}

.legal-hero h1{
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 800;
}

.legal-sub{
  margin: 0 0 18px;
  opacity: .75;
}

.legal-meta{
  display:flex;
  gap:10px;
  flex-wrap: wrap;
}

.legal-pill{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  text-decoration:none;
  color: inherit;
}

/* Light mode */
body.light-mode .legal-pill{
  background: rgba(0,0,0,.05);
  border: 1px solid rgba(0,0,0,.15);
}

/* ===== GRID ===== */
.legal-grid{
  display:grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
}

/* ===== TOC ===== */
.legal-toc{
  position: sticky;
  top: calc(var(--appHeaderH, 70px) + 24px);
  align-self: start;
}

.legal-toc-title{
  font-weight: 700;
  margin-bottom: 12px;
  opacity: .7;
}

.legal-toc a{
  display:block;
  font-size: 14px;
  padding: 6px 0;
  text-decoration:none;
  color: inherit;
  opacity:.65;
  transition: all .2s ease;
  position: relative;
  padding-left: 14px;
}

.legal-toc a::before{
  content:"•";
  position:absolute;
  left:0;
  opacity:.35;
}

.legal-toc a:hover{
  opacity:1;
}

.legal-toc a:hover::before{
  opacity:.7;
}

/* ===== CONTENT ===== */
.legal-content section{
  margin-bottom: 28px;
  padding: 22px 26px;
  border-radius: 16px;
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
}

.legal-content h2{
  margin-top: 0;
  font-size: 18px;
  font-weight: 700;
}

.legal-content p{
  line-height: 1.6;
  opacity: .9;
}

.legal-content ul{
  padding-left: 18px;
  line-height: 1.6;
  opacity:.9;
}

/* ===== CALLOUT ===== */
.legal-callout{
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  background: rgba(255,193,7,.08);
  border: 1px solid rgba(255,193,7,.35);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 980px){
  .legal-grid{
    grid-template-columns: 1fr;
  }

  .legal-toc{
    position: relative;
    top: 0;
    margin-bottom: 24px;
  }
}