/* =====================================================================
 *  css/uni_app.css — UNITYDOM : 📱 FLUIDE COMME UNE APPLI (mobile + PC)
 *  Chargé par index.php (et les pages lecteur / playlist). 100 % additif.
 *   1. toucher « natif » : pas de délai, pas de flash gris, retour visuel à l'appui
 *   2. défilement : élan, pas de rebond horizontal, carrousels qui s'arrêtent net
 *   3. ordre d'empilement unique : contenu < barre du bas < lecteur < fenêtres < messages
 *   4. lecteur ouvert : le bas des pages n'est plus caché sous le lecteur
 *   5. fenêtres (notifications…) = feuilles qui montent du bas sur téléphone
 *   6. appli installée : barre d'état du téléphone respectée (encoche)
 *   7. fil infini léger : les cartes hors écran ne sont pas dessinées
 *   8. loader de navigation (pages ouvertes sans rechargement)
 * ===================================================================== */

/* ---------- 1. toucher natif ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, [role="button"], label, summary, select, .nav-item, .ufs-btn, [data-ufs], [data-urx], [data-or-album], [data-or-menu] {
    touch-action: manipulation;                 /* plus de délai de 300 ms au toucher */
    -webkit-tap-highlight-color: transparent;   /* plus de flash gris */
}
#bottom-nav, #bottom-nav *, .uni-dock-x, .uni-dock-radio, #sb-bulle { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
img { -webkit-user-drag: none; }
#bottom-nav .nav-item { transition: transform .12s ease, color .15s ease; }
#bottom-nav .nav-item:active { transform: scale(.92); }
.ufs-btn:active, .uff-go:active, .or-pill:active, .or-chip:active, .or-jouer:active, .or-play:active, #alc .play:active, .uni-dock-x:active { transform: scale(.94); }
@media (hover: none) { a:hover, button:hover { transition-duration: 0s; } }

/* ---------- 2. défilement ---------- */
html, body { overscroll-behavior-x: none; }
.hide-scrollbar, .story-container, .or-car, .or-al-car, .or-tri, #alc .chips, .umo, .ufs-tabs, [class*="carousel"] {
    -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
#activityContent, #uni-sheet .uni-sh-corps, .ufs-sheet > div, #modal-content { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* ---------- 3. ordre d'empilement ---------- */
#bottom-nav { z-index: 100; }
#uni-reprendre { z-index: 115; }
#uni-dock { z-index: 120; }
html:not(.sb-ouvert) #sb { z-index: 110 !important; }    /* Shatta Bot fermé : sous le lecteur et la barre (ouvert : au-dessus de tout) */
#activityModal, #custom-modal { z-index: 2147482600 !important; }
/* une fenêtre ouverte : le bot se cache, la page derrière ne défile plus */
html:has(#activityModal:not(.hidden)) #sb, html:has(#custom-modal[style*="block"]) #sb { display: none !important; }
html:has(#activityModal:not(.hidden)), html:has(#custom-modal[style*="block"]) { overflow: hidden; }

/* ---------- 4. lecteur ouvert : rien de caché dessous ---------- */
body.uni-joue { padding-bottom: calc(84px + 128px + env(safe-area-inset-bottom)) !important; }
@media (min-width: 768px) { body.uni-joue { padding-bottom: calc(110px + 128px) !important; } }
body.uni-joue #sb { bottom: calc(var(--uni-pile, 230px) + 14px) !important; }

/* ---------- 5. notifications : feuille qui monte du bas (téléphone) ---------- */
#activityContent { overflow-x: hidden; }
#act { overflow-wrap: anywhere; max-width: 100%; }
#act img, #act video, #act iframe { max-width: 100%; }
#act .act-son > * { min-width: 0; }
#act .act-son { max-width: 100%; overflow: hidden; }
#act .act-btns { flex-wrap: wrap; }
#act .act-resume { flex-wrap: wrap; }
@media (max-width: 640px) {
    #activityModal { align-items: flex-end !important; padding: 0 !important; }
    #activityModal #activityBox { max-width: 100% !important; border-radius: 22px 22px 0 0 !important; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; transform: translateY(0); padding-bottom: env(safe-area-inset-bottom); }
    #activityModal #activityBox.opacity-0 { transform: translateY(40px) !important; }
    #activityModal #activityBox > div:first-child { position: relative; padding: 14px 16px 12px !important; }
    #activityModal #activityBox > div:first-child::before { content: ""; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: rgba(255,255,255,.22); }
    #activityModal #activityBox > div:first-child button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px !important; background: rgba(255,255,255,.08) !important; font-size: 18px !important; flex-shrink: 0; }
    #activityContent { padding: 10px 10px 16px !important; max-height: none !important; flex: 1; min-height: 0; overflow-y: auto; }
    #act .act-l { padding: 10px 6px; gap: 10px; }
    #act .act-av { width: 40px; height: 40px; }
}

/* ---------- 6. appli installée : encoche / barre d'état ---------- */
@media (display-mode: standalone) {
    header.sticky { padding-top: env(safe-area-inset-top); }
}

/* ---------- 7. fil infini léger (cartes hors écran non dessinées) ---------- */
@supports (content-visibility: auto) {
    #ufs-l > .ufs-it:not(.ufs-instant):not(.ufs-neuf-it):not(#ufs-dir) { content-visibility: auto; contain-intrinsic-size: auto 380px; }
}

/* ---------- 8. loader de navigation ---------- */
#uni-app-loader { position: fixed; left: 0; right: 0; top: 64px; bottom: 0; z-index: 95; display: flex; align-items: center; justify-content: center; background: rgba(9,9,15,.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s ease; pointer-events: none; }
#uni-app-loader.on { opacity: 1; visibility: visible; pointer-events: auto; }
#uni-app-loader .loader-keys { display: flex; gap: 6px; align-items: flex-end; height: 44px; }
#uni-app-loader .loader-keys span { width: 9px; border-radius: 4px; animation: keyBounce 1s ease-in-out infinite; }
#uni-app-loader .loader-keys span:nth-child(1) { background: #00d9ff; animation-delay: 0s; }
#uni-app-loader .loader-keys span:nth-child(2) { background: #22c55e; animation-delay: .12s; }
#uni-app-loader .loader-keys span:nth-child(3) { background: #facc15; animation-delay: .24s; }
#uni-app-loader .loader-keys span:nth-child(4) { background: #ff0055; animation-delay: .36s; }
#uni-app-loader .loader-keys span:nth-child(5) { background: #8b5cf6; animation-delay: .48s; }
@keyframes keyBounce { 0%, 100% { height: 14px; opacity: .6; } 50% { height: 44px; opacity: 1; } }

/* ---------- 10. téléphone : cibles faciles à toucher, textes lisibles ---------- */
@media (pointer: coarse) {
    /* zones de toucher agrandies sans rien déplacer (pseudo-élément invisible) */
    .uab .x::after, .ufs-menu::after, .uni-dock-x::after, .ur-bts .ur-x::after, .ur-bts .ur-pg::after { content: ""; position: absolute; inset: -8px; }
    .ufs-menu { position: relative; min-width: 40px; min-height: 40px; }
    .uab .x { width: 36px; height: 36px; }
    .ufs-nom, .ufs-tag, .uht-lien, .ufs-at, .ufs-ht a, .act-p, a.ufs-q { padding-top: 6px; padding-bottom: 6px; margin-top: -6px; margin-bottom: -6px; display: inline-block; }
    .uff-msg { min-height: 36px; display: inline-flex; align-items: center; }
}
@media (max-width: 640px) {
    .text-\[0\.6rem\], .text-\[0\.62rem\], .text-\[0\.65rem\], .text-\[10px\] { font-size: 11px !important; }
    .ujx-nv { font-size: 11px !important; }
}

/* ---------- 12. ordinateur : chaque page prend toute sa largeur prévue (avant : elle se rétrécissait selon son contenu,
   le corps de page étant en colonne flexible) — même largeur d'une page à l'autre ---------- */
#uni-vue > main, #uni-vue > div[class*="mx-auto"]:not([class*="fixed"]), #uni-vue > section[class*="mx-auto"]:not([class*="fixed"]) { width: 100%; }

/* ---------- 11. boutons flottants : s'effacent quand on descend (comme une appli) ---------- */
#sb { transition: transform .25s ease, opacity .25s ease, bottom .25s ease !important; }
html.uni-bas:not(.sb-ouvert) #sb { transform: translateY(calc(100% + 24px)); opacity: 0; pointer-events: none; }

/* ---------- 9. transition native entre les pages (pendant le changement seulement) ---------- */
html.uni-vt header.sticky { view-transition-name: uni-tete; }
html.uni-vt #bottom-nav { view-transition-name: uni-nav; }
html.uni-vt #uni-dock.on { view-transition-name: uni-dock; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .2s; }

@media (prefers-reduced-motion: reduce) {
    #bottom-nav .nav-item:active, .ufs-btn:active { transform: none; }
    #uni-app-loader .loader-keys span { animation-duration: 2.4s; }
}
