/* Animations de chargement (dash_app/layout/loading.py + loading.js) — charte
   de polish.css, transform/opacity seulement ; mouvement réduit : ni reflet
   ni glissement. */
:root { --sk-bg: #e9ecef; --sk-soft: #f1f3f5; --sk-line: #eceef0; --sk-g: var(--wwf-green, #007932); --sk-o: var(--wwf-orange, #f07d00); }

#cibel-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 9500; pointer-events: none; opacity: 0; transition: opacity .25s; }
#cibel-progress.on { opacity: 1; }
#cibel-progress > div { height: 100%; background: var(--sk-g); box-shadow: 0 0 8px rgba(0, 121, 50, .45); transform: scaleX(0); transform-origin: 0 50%; transition: transform .2s linear; }
#cibel-progress.err > div { background: var(--sk-o); }

#cibel-status { position: fixed; left: 50%; bottom: 20px; z-index: 9600; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 8px 16px; border-radius: 22px; background: #fff; border: 1px solid var(--mantine-color-gray-3, #dee2e6); box-shadow: 0 6px 20px rgba(23, 20, 21, .12); font-size: 13px; line-height: 1.4; color: var(--wwf-text, #303030); opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: opacity .2s, transform .2s; }
#cibel-status.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#cibel-status small { display: block; font-size: 12px; color: #5c5f66; }
#cibel-status .cs-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--sk-g); animation: ld-pulse 1.2s ease-in-out infinite; }
#cibel-status.err { border-color: var(--sk-o); padding-right: 8px; }
#cibel-status .cs-ico { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--sk-o); color: #fff; font-weight: 800; }
#cibel-status button { flex: none; min-height: 32px; padding: 0 14px; border: 0; border-radius: 16px; cursor: pointer; font: inherit; font-weight: 700; background: var(--sk-g); color: #fff; }
#cibel-status button[data-a=close] { padding: 0 10px; background: none; color: inherit; font-size: 18px; }

.cibel-sk { position: relative; overflow: hidden; }
.cibel-sk::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .6) 50%, transparent 70%); transform: translateX(-100%); animation: ld-shimmer 1.6s ease-in-out infinite; }
.cibel-sk .sk-b { flex: none; max-width: 100%; border-radius: 6px; background: var(--sk-bg); }
.cibel-sk .sk-r { border-radius: 50%; }
.sk-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sk-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sk-card { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: #fff; border: 1px solid var(--mantine-color-gray-3, #dee2e6); border-radius: var(--mantine-radius-md, 8px); }
.sk-card .sk-col { gap: 10px; }
.sk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(var(--sk-min, 170px), 100%), 1fr)); gap: 12px; }
.sk-fill, .sk-step { flex: 1; }
.sk-plot { display: flex; align-items: flex-end; gap: 3%; padding: 0 3% 0 6%; border: solid var(--sk-line); border-width: 0 0 1px 1px; }
.cibel-sk .sk-bar { flex: 1; border-radius: 4px 4px 0 0; }
.sk-tr { display: grid; grid-template-columns: repeat(var(--sk-cols, 5), minmax(0, 1fr)); gap: 16px; align-items: center; padding: 12px; border-bottom: 1px solid var(--sk-line); }
.sk-th { background: var(--sk-soft); border-radius: 6px 6px 0 0; }
.sk-gantt { display: flex; flex-direction: column; gap: 6px; }
.sk-gt { display: grid; grid-template-columns: minmax(96px, 24%) 1fr; gap: 16px; align-items: center; min-height: 26px; }
.sk-ticks { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; }
.sk-track { position: relative; height: 14px; background: linear-gradient(90deg, var(--sk-line) 1px, transparent 1px) 0 0 / 8.333% 100%; }
.cibel-sk .sk-gbar { position: absolute; top: 0; bottom: 0; border-radius: 9px; background: #d3e5d9; }
.sk-map { position: relative; flex: 1; min-height: 420px; height: 100%; overflow: hidden; border-radius: 12px; background: #e5ece6; }
.sk-map-page { height: calc(100vh - 230px); min-height: 360px; }
.sk-land { position: absolute; background: #d5e1d7; border-radius: 42% 58% 47% 53% / 55% 43% 57% 45%; }
.sk-ctl { position: absolute; top: 12px; left: 12px; display: grid; gap: 2px; }
.sk-ctl > div { width: 28px; height: 28px; border-radius: 4px; background: #fff; }
.sk-legend { position: absolute; left: 12px; bottom: 12px; width: min(200px, 60%); }
.cibel-sk .sk-input { width: 100%; height: 34px; background: var(--sk-soft); }
.cibel-sk .sk-btn { width: 112px; height: 34px; }

/* Fond de la Cartographie, recouvert par les tuiles (geo_dashboard.py::build_map) */
.cibel-map-host { position: relative; }
.cibel-map-host > .cibel-sk { position: absolute; inset: 0; }
.cibel-map-host > .cibel-sk .sk-map { min-height: 0; border-radius: 0; }
.cibel-map-host > #geo-cart-ol-map { position: relative; }
.cibel-map-host:has(.ol-viewport) > .cibel-sk::after { animation: none; opacity: 0; }

/* Zones : squelette (initial, ghost), contenu estompé + liseré (stale), liseré (bar), fondu (out) */
.cibel-ld { position: relative; }
.cibel-ld-ghost { display: none; }
.cibel-ld-body { transition: opacity .2s; }
.cibel-js .cibel-ld[data-ld-initial]:not([data-ld-ready]) > .cibel-ld-ghost, .cibel-ld[data-ld=ghost] > .cibel-ld-ghost { display: block; animation: ld-in .2s ease-out .2s both; }
.cibel-ld-now .cibel-ld[data-ld-initial]:not([data-ld-ready]) > .cibel-ld-ghost { animation-delay: 0s; }
.cibel-js .cibel-ld[data-ld-initial]:not([data-ld-ready]) > .cibel-ld-body, .cibel-ld[data-ld=ghost] > .cibel-ld-body { position: absolute; top: 0; left: 0; right: 0; visibility: hidden; }
.cibel-ld[data-ld=out] > .cibel-ld-ghost { display: block; position: absolute; top: 0; left: 0; right: 0; z-index: 1; animation: ld-out .2s ease-in both; }
.cibel-ld[data-ld=out] > .cibel-ld-body { animation: ld-in .24s ease-out both; }
.cibel-ld[data-ld=stale] > .cibel-ld-body { opacity: .45; transition-delay: .2s; }
.cibel-ld[data-ld=stale]::before, .cibel-ld[data-ld=bar]::before { content: ""; position: absolute; top: 0; left: 0; right: 0; z-index: 2; height: 2px; border-radius: 2px; background: var(--sk-g); transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; animation: ld-grow 1.2s ease-in-out .2s infinite; }

#cibel-route { position: fixed; right: 0; bottom: 0; z-index: 90; overflow: hidden; padding: var(--mantine-spacing-lg, 20px); background: var(--wwf-bg, #f5f5f5); animation: ld-in .18s ease-out both; }
#cibel-route.out { animation: ld-out .2s ease-in both; }

@keyframes ld-shimmer { to { transform: translateX(100%); } }
@keyframes ld-in { from { opacity: 0; } }
@keyframes ld-out { to { opacity: 0; } }
@keyframes ld-grow { 70% { transform: scaleX(1); opacity: 1; } to { transform: scaleX(1); opacity: 0; } }
@keyframes ld-pulse { 50% { opacity: .35; } }

@media (max-width: 48em) {
  #cibel-status { bottom: 12px; }
  #cibel-route { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .cibel-sk::after { animation: none; opacity: 0; }
  #cibel-status .cs-dot { animation: none; }
  .cibel-ld[data-ld=stale]::before, .cibel-ld[data-ld=bar]::before { transform: none; opacity: .6; animation: ld-in .01s linear .2s both; }
  #cibel-progress > div, #cibel-status { transition: none; }
  #cibel-status, #cibel-status.on { transform: translate(-50%, 0); }
}
