/* ============================================================
   takuverse-shared.css — Styles partagés TakuVerse
   Centralise tous les styles dupliqués dans les pages HTML.
   À inclure APRÈS style.min.css et AVANT style.css sur chaque page.
   ============================================================ */

/* ── Base ── */
body {
  font-family: 'Outfit', sans-serif;
  background-color: #0f0f0f;
  color: white;
  touch-action: pan-x pan-y;
}

/* ── Scrollbars ── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Commentaires ── */
.comment-thread {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.75rem;
}
.comment-replies {
  margin-left: 0.75rem;
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-left: 2px solid rgba(255,255,255,0.12);
  padding-left: 0.75rem;
}
@media (min-width: 1024px) {
  .comment-replies { margin-left: 1.25rem; }
}
.replying-indicator {
  background: transparent;
  border: none;
  padding: 0.25rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #9ca3af;
}
.replying-indicator .replying-user { color: #93c5fd; }
.replying-indicator button { color: #9ca3af; transition: opacity .15s ease; }
.replying-indicator button:hover { opacity: .8; }

.comments-scroll {
  -webkit-overflow-scrolling: touch;
  max-height: 60vh;
}
@media (max-width: 768px) {
  [x-show="showComments"] { min-height: 100px; padding-bottom: 60px; }
  .replying-indicator, .comment-thread { font-size: 0.85rem; }
}

/* ── Alpine ── */
[x-cloak] { display: none !important; }

/* ── Navigation ── */
nav a {
  position: relative;
  overflow: visible;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
nav button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button.search-btn { cursor: pointer; }

/* ── Nav basse mobile : zone tactile élargie + retour visuel immédiat ──────
   Avant : -webkit-tap-highlight-color: transparent supprime le flash natif
   du tap SANS le remplacer par rien → aucun signe visuel entre le tap et la
   navigation, d'où l'impression de boutons "mous"/peu réactifs. La zone
   cliquable (l'icône 24×24 nue, sans padding) était aussi bien en dessous
   des ~44px recommandés pour une cible tactile fiable au pouce.
   Le padding + marge négative agrandit la zone de tap sans rien déplacer
   visuellement (justify-around répartit toujours les icônes pareil). Ciblé
   uniquement sur la nav basse fixe (fixed + bottom-0) pour ne pas toucher
   la sidebar desktop, qui a déjà son propre espacement. */
nav.fixed.bottom-0 a,
nav.fixed.bottom-0 button {
  padding: 10px 14px;
  margin: -10px -14px;
  border-radius: 14px;
  transition: transform .08s ease, background-color .12s ease;
}
nav.fixed.bottom-0 a:active,
nav.fixed.bottom-0 button:active {
  transform: scale(0.93);
  background-color: rgba(236, 72, 153, 0.12);
}

/* ── Pastille active façon Instagram/Material ─────────────────────────────
   Un fond arrondi apparaît derrière l'onglet actif (réutilise le padding /
   border-radius déjà posés ci-dessus pour la zone tactile). Comme TakuVerse
   navigue en pages complètes (pas une SPA), la pastille ne peut pas glisser
   en continu d'un onglet à l'autre pendant la navigation elle-même — par
   contre elle apparaît avec un petit effet d'entrée à chaque page, pour
   donner un peu de vie à défaut d'un vrai glissement continu. */
nav.fixed.bottom-0 a.tv-nav-pill-active {
  background-color: rgba(236, 72, 153, 0.14);
  animation: tvNavPillIn .22s cubic-bezier(.34,1.56,.64,1);
}
@keyframes tvNavPillIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ── État actif nav (gradient pink→purple) ── */
.active {
  color: transparent;
  background-image: linear-gradient(90deg, #ec4899, #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  background-color: rgba(255,255,255,0.05);
  border-radius: 0.75rem;
}

/* ── Halos roses ── */
.post-halo        { box-shadow: 0 0 20px rgba(236, 72, 153, 0.7); }
.right-sidebar-halo { box-shadow: 0 0 20px rgba(236, 72, 153, 0.7); }
.nav-halo         { box-shadow: 0 0 20px rgba(236, 72, 153, 0.7); }
.nav-modal-halo   { box-shadow: 0 0 20px rgba(236, 72, 153, 0.7); }

/* ── Pull-to-refresh ── */
.pull-to-refresh {
  position: fixed;
  top: -50px;
  left: 0;
  width: 100%;
  height: 50px;
  background-color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  z-index: 1000;
}
.pull-to-refresh.active { transform: translateY(50px); }
.pull-to-refresh .spinner {
  border: 4px solid rgba(255,255,255,0.3);
  border-top: 4px solid #ec4899;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: tv-spin 1s linear infinite;
}
#pull-to-refresh { transform: translateY(-100%); opacity: 0; }
#pull-to-refresh.active { transform: translateY(0); opacity: 1; }
#pull-to-refresh.releasing { transition: transform 0.35s cubic-bezier(0.215, 0.61, 0.355, 1); }

@keyframes tv-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ── Médias posts ── */
.post-media { aspect-ratio: 16 / 9; }
.post-media.image { aspect-ratio: 1 / 1; }

.aspect-square video,
.aspect-square img { object-fit: cover; width: 100%; height: 100%; }
.aspect-square .group:hover video { filter: brightness(0.8); }

/* ── Caption clamp ── */
.caption-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

/* ── Story viewer ── */
.story-viewer-wrap { max-height: 88vh; }
.story-media {
  width: 100%;
  max-height: 88vh;
  object-fit: contain;
  background: black;
  display: block;
}

/* ── Stories bar ── */
#stories-container {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
}
#stories-container > div {
  flex: 0 0 70px;
  width: 70px;
  max-width: 70px;
  scroll-snap-align: start;
}
#stories-container > div > span {
  display: block;
  width: 70px;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
@media (max-width: 640px) {
  #stories-container {
    flex: 0 0 auto;
    width: calc((70px * 4) + (1rem * 3) + (1rem * 2));
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ── Featured banner ── */
.tv-featured-bg { position: absolute; inset: 0; z-index: 0; }
.tv-featured-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,var(--overlayA, .85)),
    rgba(0,0,0,var(--overlayB, .45)),
    rgba(0,0,0,var(--overlayA, .85))
  );
  z-index: 1;
}
.tv-featured-bg > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .40; z-index: 0; }
.tv-featured-content { position: relative; z-index: 2; }
.tv-featured-scrim { background: rgba(0,0,0,var(--scrimA, .60)); backdrop-filter: blur(6px); }
.tv-featured-title { text-shadow: 0 2px 10px rgba(0,0,0,var(--shadowA, .85)); }

/* ── Desktop Ad Rail ── */
:root {
  --tv-container-max: 80rem;
  --tv-container-gutter: max(0px, calc((100vw - var(--tv-container-max)) / 2));
  --tv-ad-gap: 16px;
  --tv-ad-rail: 0px;
}
@media (min-width: 1024px) { :root { --tv-ad-rail: 160px; } }
@media (min-width: 1912px) { :root { --tv-ad-rail: 300px; } }
.tv-ad-rail { width: var(--tv-ad-rail); }
@media (min-width: 1024px) {
  .tv-left-sidebar-offset { left: var(--tv-container-gutter); }
  .tv-main-offset { margin-left: 256px; }
  .tv-ad-rail {
    left: calc(var(--tv-container-gutter) - var(--tv-ad-rail) - var(--tv-ad-gap));
    display: none;
  }
}
@media (min-width: 1632px) { .tv-ad-rail { display: block; } }
.tv-ad-slot { border: 1px solid #333; border-radius: 16px; background: #111; overflow: hidden; }
.tv-ad-badge {
  position: absolute;
  top: 10px; left: 10px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e5e5e5;
}

/* ── Mobile follow suggestions ── */
#mobile-follow-suggestions summary::-webkit-details-marker { display: none; }
#mobile-follow-suggestions details[open] .details-chevron { transform: rotate(180deg); }
#mobile-follow-suggestions { display: block; }
@media (min-width: 1024px) { #mobile-follow-suggestions { display: none !important; } }
#mobile-follow-suggestions select {
  background-color: #111 !important;
  color: #e5e5e5 !important;
  -webkit-text-fill-color: #e5e5e5 !important;
  border-color: #333 !important;
  color-scheme: dark;
}
#mobile-follow-suggestions select option { background-color: #111; color: #e5e5e5; }

/* ── iOS/PWA dark inputs ── */
input[type="text"], input[type="search"], textarea {
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  caret-color: #fff !important;
  color-scheme: dark;
}
input:-webkit-autofill, textarea:-webkit-autofill {
  -webkit-text-fill-color: #fff !important;
  box-shadow: 0 0 0px 1000px #1a1a1a inset !important;
  transition: background-color 9999s ease-out 0s;
}
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }

/* ── Bref type buttons ── */
.bref-type-btn { -webkit-tap-highlight-color: transparent; outline: none; }
.bref-type-btn:focus { outline: none; box-shadow: none; }
.bref-type-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px #ec4899; }
.bref-type-selected { box-shadow: 0 0 0 1px rgba(255,46,166,.55), 0 0 18px rgba(255,46,166,.35); }

/* ── Profil grid ── */
.post-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}
@media (max-width: 380px) {
  .post-grid { grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); }
}
.mini-card { position: relative; border: 1px solid #333; border-radius: 14px; overflow: hidden; aspect-ratio: 1/1; background: #1a1a1a; }
.mini-media { position: absolute; inset: 0; }
.mini-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-badge { position: absolute; right: 6px; top: 6px; font-size: 12px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.15); padding: 2px 6px; border-radius: 999px; }
.mini-top, .mini-bottom { position: absolute; left: 0; right: 0; display: flex; gap: 6px; padding: 6px; color: white; pointer-events: none; }
.mini-top { top: 0; align-items: center; background: linear-gradient(to bottom, rgba(0,0,0,.65), rgba(0,0,0,0)); }

/* ── Toggle switch (réglages) ── */
.toggle-container { position: relative; display: inline-block; width: 40px; height: 20px; flex-shrink: 0; }
.toggle-input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #6b7280; transition: .4s; border-radius: 20px; }
.toggle-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
.toggle-input:checked + .toggle-slider { background-color: #3b82f6; }
.toggle-input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ── Marketplace mobile ── */
@media (max-width: 768px) {
  main { min-width: 0; }
  #mp-category-bar { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  #mp-category-bar .mp-category-inner { flex-wrap: nowrap; min-width: 0; }
  #mp-category-bar button { flex: 0 0 auto; max-width: 10rem; overflow: hidden; text-overflow: ellipsis; }
}
select option { background-color: #1a1a1a; color: white; }

/* ── Cloche de notifications : pastille seule (pas de nombre) ──────────────
   Masque le compteur chiffré sur toutes les pages et le remplace par un
   point. La visibilité reste pilotée par x-show="unreadCount > 0", donc le
   point n'apparaît que s'il y a quelque chose (notif non lue ou activité
   Univers repliée dans le signal).
   ⚠️ "display" est SANS !important exprès : Alpine pilote la visibilité en
   posant un style inline display:none quand unreadCount === 0. Un
   display:inline-block !important ici gagnerait toujours sur ce style
   inline (non-important) et rendrait le point visible en permanence, même
   à 0 non-lu. Sans !important, le style inline d'Alpine reste prioritaire
   quand caché, et cette règle ne s'applique que quand Alpine affiche
   l'élément (donc pas de conflit) — tout en gardant taille/police en
   !important puisqu'Alpine n'y touche jamais. */
a[href="notifications.html"] span.bg-pink-500.rounded-full {
  min-width: 0 !important;
  width: 9px !important;
  height: 9px !important;
  padding: 0 !important;
  font-size: 0 !important;
  line-height: 0 !important;
  display: inline-block;
}
