/* =========================================================================
   1AI TRADER — « Neo » : nouveau langage visuel (chargé en dernier).
   Verre sombre, bords lumineux, relief 3D, typographie plus grande.
   Utilise les mêmes variables de thème que algo.css : clair + sombre automatiques.
   ========================================================================= */

:root {
  --neo-glow: color-mix(in srgb, var(--algo-accent) 55%, transparent);
  --neo-edge: linear-gradient(135deg, color-mix(in srgb, var(--algo-accent) 70%, transparent), transparent 38%, transparent 62%, color-mix(in srgb, #29E0FF 55%, transparent));
  --neo-grad: linear-gradient(135deg, #2F6BFF 0%, #29B6F6 100%);
  --algo-nav-h: 84px;
}
:root[data-theme="light"] {
  --neo-glow: color-mix(in srgb, var(--algo-accent) 28%, transparent);
}

/* ---------- Typographie : plus grande, plus serrée ---------- */
body.algo h1 { font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4.4rem); line-height: 1.04; letter-spacing: -0.035em; font-weight: 700; }
body.algo h2 { font-size: clamp(1.9rem, 1.3rem + 2vw, 3rem); line-height: 1.08; letter-spacing: -0.028em; font-weight: 700; }
body.algo h3 { letter-spacing: -0.015em; }

.algo-section-head p.lead, .lead { font-size: clamp(1.05rem, .98rem + .4vw, 1.25rem); }

/* ---------- En-tête flottant en verre ---------- */
.algo-header {
  inset-block-start: 12px; inset-inline: 14px;
  height: 64px; border-radius: 22px;
  background: color-mix(in srgb, var(--algo-surface) 62%, transparent);
  border: 1px solid transparent;
  background-image: linear-gradient(color-mix(in srgb, var(--algo-surface) 70%, transparent), color-mix(in srgb, var(--algo-surface) 70%, transparent)), var(--neo-edge);
  background-origin: border-box; background-clip: padding-box, border-box;
  backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  box-shadow: 0 18px 50px -22px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.07);
}
.algo-header .algo-container { max-width: 1240px; }
.algo-header.is-scrolled { box-shadow: 0 24px 60px -20px rgba(0,0,0,.7), 0 0 0 1px color-mix(in srgb, var(--algo-accent) 18%, transparent); }

/* ---------- Boutons lumineux ---------- */
.algo-btn {
  background: var(--neo-grad); color: #fff; border: 0; border-radius: 14px;
  box-shadow: 0 10px 30px -10px var(--neo-glow), inset 0 1px 0 rgba(255,255,255,.28);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.algo-btn:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 16px 40px -10px var(--neo-glow), inset 0 1px 0 rgba(255,255,255,.35); filter: brightness(1.08); color: #fff; }
.algo-btn--ghost { background: color-mix(in srgb, var(--algo-surface) 55%, transparent); color: var(--algo-ink); border: 1px solid var(--algo-border); box-shadow: inset 0 1px 0 rgba(255,255,255,.05); backdrop-filter: blur(10px); }
.algo-btn--ghost:hover { color: var(--algo-ink); border-color: var(--algo-accent); box-shadow: 0 10px 30px -14px var(--neo-glow); }

/* ---------- Cartes en verre avec bord lumineux ---------- */
.algo-card {
  position: relative; border-radius: 26px; border: 1px solid transparent;
  background-image:
    linear-gradient(160deg, color-mix(in srgb, color-mix(in srgb, var(--algo-accent) 9%, var(--algo-surface)) 84%, transparent) 0%, color-mix(in srgb, var(--algo-surface) 80%, transparent) 55%),
    var(--neo-edge);
  backdrop-filter: blur(12px) saturate(1.3); -webkit-backdrop-filter: blur(12px) saturate(1.3);
  background-origin: border-box; background-clip: padding-box, border-box;
  box-shadow: 0 24px 60px -30px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.06);
}
:root[data-theme="light"] .algo-card { box-shadow: 0 24px 60px -34px rgba(31,85,240,.35), inset 0 1px 0 #fff; }
.algo-card--hover:hover { box-shadow: 0 30px 70px -26px var(--neo-glow), inset 0 1px 0 rgba(255,255,255,.1); }
.algo-card__icon { border-radius: 16px; background: var(--neo-grad); color: #fff; box-shadow: 0 10px 26px -10px var(--neo-glow), inset 0 1px 0 rgba(255,255,255,.3); }

/* ---------- Sections : rythme + lueurs ---------- */
.algo-section { position: relative; }
.algo-eyebrow { background: color-mix(in srgb, var(--algo-accent) 14%, transparent); backdrop-filter: blur(8px); box-shadow: 0 0 24px -8px var(--neo-glow); }

/* ---------- Pied de page : dalle en verre ---------- */
.algo-footer { border-radius: 36px 36px 0 0; margin-inline: 12px; border: 1px solid var(--algo-border); border-bottom: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--algo-accent) 7%, var(--algo-surface)), var(--algo-surface)); box-shadow: 0 -30px 80px -40px var(--neo-glow); }

/* ---------- Relief 3D au défilement (piloté par algo-depth.js) ----------
   Utilise les propriétés individuelles rotate/translate : aucun conflit avec
   les transform déjà utilisés par les survols et les animations existantes. */
.d3 {
  rotate: 1 0 0 var(--rx, 0deg);
  translate: 0 calc(var(--ty, 0px) + var(--py, 0px)) var(--tz, 0px);
  scale: var(--sc, 1);
  transition: box-shadow .25s ease, border-color .25s ease;
  backface-visibility: hidden;
}
.d3-stage { perspective: 1300px; perspective-origin: 50% 45%; }

/* Admin : même relief, plus discret */
.algo-admin .adm-kpi, .algo-admin .algo-card { border-radius: 20px; }

@media (prefers-reduced-motion: reduce) {
  .d3 { rotate: none; translate: none; }
  .d3-stage { perspective: none; }
}
@media (max-width: 720px) {
  .algo-header { inset-inline: 8px; inset-block-start: 8px; border-radius: 18px; }
}

/* ---------- Sections de l'accueil : étapes et profils ---------- */
.neo-step { padding-top: 64px; overflow: hidden; }
.neo-num {
  position: absolute; inset-block-start: 6px; inset-inline-start: 22px;
  font-family: var(--algo-font-display); font-weight: 700; font-size: 3.6rem; line-height: 1; letter-spacing: -0.04em;
  background: var(--neo-grad); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  opacity: .9; filter: drop-shadow(0 6px 18px var(--neo-glow));
}
.neo-step::after { /* trait lumineux qui relie les étapes */
  content: ""; position: absolute; inset-block-start: 40px; inset-inline-start: 96px; inset-inline-end: -40px; height: 2px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--algo-accent) 70%, transparent), transparent);
}
.neo-step:last-child::after { display: none; }
@media (max-width: 939px) { .neo-step::after { display: none; } }
.neo-persona .algo-card__icon { width: 56px; height: 56px; font-size: 1.5rem; margin-bottom: 14px; }


/* ---------- Inclinaison au survol + reflet ---------- */
.d3.is-tilting { transform: rotateX(var(--hx, 0deg)) rotateY(var(--hy, 0deg)) translateZ(18px); transition: transform .12s ease-out, box-shadow .25s ease; box-shadow: 0 40px 90px -30px var(--neo-glow); z-index: 2; }
.d3.is-tilting::after { /* reflet qui suit la souris */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(255,255,255,.10), transparent 55%);
}
.algo-card { transform-style: preserve-3d; }
.algo-card .algo-card__icon { transform: translateZ(26px); }
.algo-card h3 { transform: translateZ(14px); }

/* ---------- Titres : mots qui se déploient en 3D ---------- */
.neo-split { perspective: 700px; }
.neo-w { display: inline-block; opacity: 0; transform: rotateX(-85deg) translateY(.5em) translateZ(-40px); transform-origin: 50% 100%; }
.neo-split.is-in .neo-w { opacity: 1; transform: none; transition: transform .9s cubic-bezier(.2,.9,.2,1), opacity .6s ease; transition-delay: calc(var(--i, 0) * 70ms); }
@media (prefers-reduced-motion: reduce) { .neo-w { opacity: 1; transform: none; } }

/* ---------- Flottement permanent des icônes ---------- */
@keyframes neoFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
.algo-card__icon { animation: neoFloat 4.5s ease-in-out infinite; }
.algo-grid > :nth-child(2n) .algo-card__icon { animation-delay: -1.5s; }
.algo-grid > :nth-child(3n) .algo-card__icon { animation-delay: -3s; }
@media (prefers-reduced-motion: reduce) { .algo-card__icon { animation: none; } }

/* ---------- Page d'accueil : la vidéo reste en fond FIXE derrière toute la page ---------- */
.algo-main:has(> .neo-cine) { padding-top: 0; }
.neo-pagebg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: #02040B; perspective: 1400px; }
.neo-pagebg__stage { position: absolute; inset: 0;
  background: center / cover no-repeat var(--poster, none);                          /* image fixe en attendant la vidéo */
  transform-origin: 50% 50%; will-change: transform;
  transform: rotateX(calc(var(--my, 0) * -2.4deg)) rotateY(calc(var(--mx, 0) * 3.2deg)) scale(var(--zoom, 1));
  transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.neo-cine__reel, .neo-cine__v { position: absolute; inset: 0; width: 100%; height: 100%; }
/* si le navigateur bloque la lecture vidéo (ex. mode économie d'énergie), l'image fixe bouge quand même, lentement */
.neo-pagebg:not(.is-playing) .neo-pagebg__stage { animation: neoDrift 26s ease-in-out infinite alternate; }
@keyframes neoDrift { from { scale: 1; translate: 0 0; } to { scale: 1.08; translate: -1.6% -1%; } }
.neo-cine__v { object-fit: cover; object-position: 4% 50%; opacity: 0; transition: opacity 1.6s ease; }
.neo-cine__v.is-on { opacity: 1; }
.neo-frames { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .8s ease; }
.use-frames .neo-frames { opacity: 1; }
.use-frames .neo-cine__v { opacity: 0 !important; }
/* Safari : jamais de gros bouton « Lecture » par-dessus la vidéo de fond */
.neo-cine__v::-webkit-media-controls, .neo-cine__v::-webkit-media-controls-panel, .neo-cine__v::-webkit-media-controls-start-playback-button,
.neo-cine__v::-webkit-media-controls-overlay-play-button, .neo-cine__v::-webkit-media-controls-enclosure { display: none !important; -webkit-appearance: none; opacity: 0; pointer-events: none; }
.neo-pagebg__shade { position: absolute; inset: 0;
  background: radial-gradient(120% 95% at 40% 45%, transparent 45%, rgb(2 4 11 / .55) 100%), rgb(2 4 11 / var(--shade, .1)); }
/* poussière lumineuse à plusieurs profondeurs : traverse l'écran vers vous (parallaxe 3D) */
.neo-dust { position: absolute; inset: 0; transform-style: preserve-3d; }
.neo-dust i { position: absolute; left: 50%; top: 50%; width: var(--s, 3px); height: var(--s, 3px); border-radius: 50%; opacity: 0;
  background: rgb(170 210 255 / .95); box-shadow: 0 0 10px 2px rgb(75 134 255 / .65);
  animation: neoDust var(--d, 14s) linear infinite; animation-delay: var(--dl, 0s); }
@keyframes neoDust {
  0% { transform: translate3d(var(--x, 0), var(--y, 0), -900px); opacity: 0; }
  15% { opacity: .9; }
  100% { transform: translate3d(calc(var(--x, 0) * 3.2), calc(var(--y, 0) * 3.2), 500px); opacity: 0; }
}
/* hero : fenêtre transparente sur la vidéo + boutons et panneaux */
.neo-cine { position: relative; width: 100%; height: 100vh; height: 100svh; min-height: 520px; max-height: 1100px; overflow: hidden; isolation: isolate; }
.neo-cine__shade { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(180deg, rgb(2 4 11 / .55) 0%, transparent 22%); }
.neo-cine .neo-sweep { z-index: 3; }
.neo-cine__ui { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; padding-block-end: clamp(84px, 13vh, 130px); margin-inline: auto; }
.neo-cine__cta { display: flex; flex-wrap: wrap; gap: 14px; }
.neo-cine__scroll { position: absolute; inset-inline-end: 22px; inset-block-end: clamp(84px, 13vh, 130px); width: 30px; height: 52px; border-radius: 18px; border: 1.5px solid rgba(255,255,255,.45); display: grid; justify-items: center; padding-top: 10px; }
.neo-cine__scroll i { width: 4px; height: 10px; border-radius: 3px; background: #fff; animation: neoScrollCue 1.8s ease-in-out infinite; }
@keyframes neoScrollCue { 0% { opacity: 0; transform: translateY(-4px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }
.has-pagebg .a3d-bg { display: none; }
/* reflet lumineux qui balaie l'image */
.neo-sweep { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.neo-sweep::before { content: ""; position: absolute; top: -10%; bottom: -10%; left: 0; width: 18%; background: linear-gradient(100deg, transparent, rgba(190,220,255,.14), rgba(255,255,255,.28), rgba(190,220,255,.14), transparent); mix-blend-mode: screen; transform: translateX(-130%) skewX(-18deg); animation: neoSweep 8s ease-in-out infinite; }
@keyframes neoSweep { 0% { transform: translateX(-130%) skewX(-18deg); } 40%, 100% { transform: translateX(620%) skewX(-18deg); } }
@media (max-width: 700px) {
  /* mobile : animation verticale plein écran, fixe derrière toute la page, comme sur ordinateur */
  .neo-pagebg__stage { inset: 0; background: 0 70px / 100% auto no-repeat var(--p-md, none); }
  .neo-frames { inset: auto; top: 70px; left: 0; width: 100%; height: auto; aspect-ratio: 9 / 16; -webkit-mask-image: linear-gradient(180deg, #000 88%, transparent); mask-image: linear-gradient(180deg, #000 88%, transparent); }   /* image entière (pas de logo coupé), sous l'en-tête */
  .neo-cine { min-height: 100svh; }
  .neo-cine__ui { padding-inline: 22px; padding-block-end: 56px; }
  .neo-cine__scroll { display: none; }
}
@media (prefers-reduced-motion: reduce) { .neo-sweep::before, .neo-cine__scroll i, .neo-dust i, .neo-pagebg__stage { animation: none !important; } .neo-pagebg__stage { transition: none; } }

/* ---------- Panneaux de verre animés par-dessus la vidéo (illustratifs) ---------- */
.neo-hud { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.neo-hud__card { position: absolute; padding: 12px 16px; border-radius: 18px; color: #EAF0FF; font-size: .85rem;
  background: linear-gradient(160deg, rgba(20,40,100,.55), rgba(5,10,28,.62)); border: 1px solid rgba(110,160,255,.35);
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 24px 60px -22px rgba(30,90,255,.6), inset 0 1px 0 rgba(255,255,255,.14);
  animation: neoHudFloat 6s ease-in-out infinite;
  transform: translate3d(calc(var(--mx, 0) * var(--k, 18) * 1px), calc(var(--my, 0) * var(--k, 18) * 1px), 0); }
@keyframes neoHudFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
.neo-hud__ai { right: 6%; top: 24%; display: flex; align-items: center; gap: 10px; --k: 26; }
.neo-hud__dots { display: inline-flex; gap: 4px; }
.neo-hud__dots i { width: 7px; height: 7px; border-radius: 50%; background: #29E0FF; animation: neoDot 1.2s ease-in-out infinite; }
.neo-hud__dots i:nth-child(2) { animation-delay: .2s; } .neo-hud__dots i:nth-child(3) { animation-delay: .4s; }
@keyframes neoDot { 0%, 100% { opacity: .25; scale: .7; } 50% { opacity: 1; scale: 1.2; } }
.neo-hud__sig { right: 5%; bottom: 20%; width: min(250px, 22vw); animation-delay: -2s; --k: 34; }
.neo-hud__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.neo-hud__buy { color: #7FB2FF; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.neo-hud__row small { color: rgba(234,240,255,.55); font-size: .66rem; }
.neo-hud__sig svg { width: 100%; height: 64px; overflow: visible; }
.neo-hud__sig polyline { fill: none; stroke: #4B86FF; stroke-width: 2.2; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: neoHudDraw 5s ease-in-out infinite; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 6px #4B86FF); }
.neo-hud__sig line { stroke-width: 1.4; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.neo-hud__sig .tp { stroke: #34D399; color: #34D399; } .neo-hud__sig .sl { stroke: #F87171; color: #F87171; }
@keyframes neoHudDraw { 0% { stroke-dashoffset: 1; } 60%, 92% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.neo-hud__lv { display: flex; justify-content: space-between; font-size: .68rem; margin-top: 4px; gap: 6px; }
.neo-hud__chip { right: 26%; bottom: 12%; display: inline-flex; gap: 8px; align-items: center; animation-delay: -4s; --k: 14; }
.neo-hud__chip2 { right: auto; left: 46%; bottom: 30%; animation-delay: -1s; --k: 22; }
@media (max-width: 1000px) { .neo-hud__chip, .neo-hud__chip2 { display: none; } }
@media (max-width: 700px) { .neo-hud__sig, .neo-hud__ai { display: none; } }
@media (prefers-reduced-motion: reduce) { .neo-hud__card, .neo-hud__dots i, .neo-hud__sig polyline { animation: none; stroke-dashoffset: 0; } }

/* Choix du pays sur les pages d'offres */
.neo-country { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 22px; padding: 12px 16px; border-radius: 16px; border: 1px solid var(--algo-border); background: color-mix(in srgb, var(--algo-surface) 70%, transparent); backdrop-filter: blur(10px); }
.neo-country label { font-weight: 600; display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.neo-country select { min-width: 210px; max-width: 100%; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--algo-border); background: var(--algo-surface); color: var(--algo-ink); }
.neo-country small { flex: 1 1 220px; }

/* ---------- Mode clair : le fond animé devient clair (la vidéo est inversée, les bleus restent bleus) ---------- */
:root[data-theme="light"] .neo-pagebg { background: #F5F8FF; }
:root[data-theme="light"] .neo-pagebg__stage { background-image: var(--p-dl, none); }
:root[data-theme="light"] .neo-pagebg__shade { background: radial-gradient(120% 95% at 40% 45%, transparent 50%, rgb(245 248 255 / .7) 100%), rgb(245 248 255 / var(--shade, .1)); }
:root[data-theme="light"] .neo-dust i { background: rgb(31 85 240 / .9); box-shadow: 0 0 8px 1px rgb(31 85 240 / .35); }
:root[data-theme="light"] .neo-cine__shade { background: linear-gradient(180deg, rgb(245 248 255 / .6) 0%, transparent 22%); }
:root[data-theme="light"] .neo-sweep::before { mix-blend-mode: normal; opacity: .5; }
:root[data-theme="light"] .neo-hud__card { color: #0A1230; background: linear-gradient(160deg, rgb(255 255 255 / .85), rgb(232 240 255 / .8)); border-color: rgb(31 85 240 / .28); box-shadow: 0 24px 50px -26px rgb(31 85 240 / .45), inset 0 1px 0 #fff; }
:root[data-theme="light"] .neo-hud__row small { color: rgb(10 18 48 / .55); }
:root[data-theme="light"] .neo-hud__buy { color: #1F55F0; }
:root[data-theme="light"] .neo-hud__dots i { background: #1F55F0; }
:root[data-theme="light"] .neo-cine__ui .algo-btn--ghost { color: #0A1230; background: rgb(255 255 255 / .75); border-color: rgb(31 85 240 / .35); }
:root[data-theme="light"] .neo-cine__scroll { border-color: rgb(10 18 48 / .4); }
:root[data-theme="light"] .neo-cine__scroll i { background: #0A1230; }

/* ---------- Mode clair : petits textes qui disparaissaient (jaune, vert, en-têtes de tableaux sombres, boutons) ---------- */
:root[data-theme="light"] .ac-chip--xp,
:root[data-theme="light"] [style*="#F59E0B"], :root[data-theme="light"] [style*="#f59e0b"], :root[data-theme="light"] [style*="245,158,11"], :root[data-theme="light"] [style*="245, 158, 11"] { color: #A15207 !important; }
:root[data-theme="light"] .algo-badge--positive, :root[data-theme="light"] .badge.bg-success { color: #0B6B33; }
:root[data-theme="light"] .table-dark th, :root[data-theme="light"] thead.table-dark th, :root[data-theme="light"] .table-dark > :not(caption) > * > * { color: #EAF0FF !important; }
:root[data-theme="light"] .btn-info { color: #fff; }
:root[data-theme="light"] .btn-outline-warning { color: #8A5A00; border-color: #C08A2E; }
:root[data-theme="light"] .btn-outline-warning:hover { color: #fff; background: #C08A2E; }
:root[data-theme="light"] .mode-label, :root[data-theme="light"] [style*="148, 163, 184"], :root[data-theme="light"] [style*="148,163,184"] { color: #55658F !important; }
:root[data-theme="light"] .btn-bulk-delete { color: #C1121F; }

/* ---------- Scène 3D « une plateforme, quatre piliers » : posée sur une vitre pour rester bien visible devant l'animation ---------- */
.a3d-story .a3d { border-radius: 26px; background: color-mix(in srgb, var(--algo-surface) 92%, transparent); border: 1px solid var(--algo-border); -webkit-backdrop-filter: blur(26px); backdrop-filter: blur(26px); box-shadow: var(--algo-shadow-md); }
:root[data-theme="light"] .a3d-story .a3d { background: rgb(255 255 255 / .95); }

/* image fixe de secours (visible même si le script ne démarre pas) : première image de chaque animation */
.neo-pagebg__stage { background-image: var(--p-dd, var(--poster, none)); }
@media (max-width: 700px) { .neo-pagebg__stage { background-image: var(--p-md, none); background-position: 0 70px; background-size: 100% auto; } :root[data-theme="light"] .neo-pagebg__stage { background-image: var(--p-ml, none); background-position: 0 70px; background-size: 100% auto; } }
