/**
 * Tchumy — Modern UI layer (2026 dating app aesthetic)
 * Chargé après design-system.css. Garde les accents violet/rose, surfaces plus nettes.
 */

/* ── Typographie héritée via base.html (Plus Jakarta Sans) ── */

/* ── Tokens modernes ── */
:root {
  --ui-bg: #09090b;
  --ui-bg-elevated: #111114;
  --ui-surface: #18181b;
  --ui-surface-hover: #1f1f23;
  --ui-border: rgba(255, 255, 255, 0.08);
  --ui-border-strong: rgba(255, 255, 255, 0.12);
  --ui-text: #fafafa;
  --ui-text-secondary: rgba(255, 255, 255, 0.62);
  --ui-text-muted: rgba(255, 255, 255, 0.42);
  --ui-accent: #8b5cf6;
  --ui-accent-rose: #ec4899;
  --ui-accent-soft: rgba(139, 92, 246, 0.14);
  --ui-radius-sm: 12px;
  --ui-radius-md: 16px;
  --ui-radius-lg: 22px;
  --ui-radius-xl: 28px;
  --ui-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24);
  --ui-shadow-md: 0 8px 32px rgba(0, 0, 0, 0.36);
  --ui-gradient-accent: linear-gradient(135deg, #7c3aed 0%, #a855f7 42%, #ec4899 100%);
  --ui-gradient-subtle: linear-gradient(180deg, rgba(139, 92, 246, 0.06) 0%, transparent 48%);

  /* Alias vers tokens existants */
  --app-shell-bg: var(--ui-bg);
  --app-frame-gradient: var(--ui-bg);
  --bg-base: var(--ui-bg);
  --bg-card: var(--ui-surface);
  --bg-card-elevated: var(--ui-surface-hover);
  --text-primary: var(--ui-text);
  --text-secondary: var(--ui-text-secondary);
  --text-tertiary: var(--ui-text-muted);
  --color-border: var(--ui-border-strong);
  --text: var(--ui-text);
  --text-muted: var(--ui-text-secondary);
  --card: var(--ui-surface);
  --border: var(--ui-border);
  --tchumy-violet: #8b5cf6;
  --tchumy-violet-light: #a78bfa;
  --tchumy-rose: #ec4899;
  --tchumy-gradient-brand: var(--ui-gradient-accent);
  --tchumy-shadow-brand: 0 4px 20px rgba(124, 58, 237, 0.28);
  --grad: var(--ui-gradient-accent);
  --r-organic: var(--ui-radius-md);
  --r-bubble: var(--ui-radius-lg);
}

html,
body {
  background: var(--ui-bg) !important;
  color: var(--ui-text);
}

.decouvrirRoot {
  background: var(--ui-bg) !important;
}

.decouvrirRoot::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--ui-gradient-subtle);
  z-index: 0;
}

/* ── Typographie hiérarchie ── */
.titre-page {
  font-size: clamp(20px, 4.8vw, 26px) !important;
  font-weight: 700 !important;
  letter-spacing: -0.03em !important;
  color: var(--ui-text) !important;
}

.titre-section {
  font-size: 11px !important;
  font-weight: 600 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--ui-text-muted) !important;
}

.texte-corps {
  color: var(--ui-text-secondary) !important;
  line-height: 1.55 !important;
}

/* ── En-têtes de page ── */
.header-page {
  background: rgba(9, 9, 11, 0.92) !important;
  backdrop-filter: blur(16px) saturate(120%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(120%) !important;
  border-bottom: 1px solid var(--ui-border) !important;
  padding-top: max(12px, env(safe-area-inset-top)) !important;
  padding-bottom: 12px !important;
}

.header-page__title {
  font-size: 17px !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
}

.header-page__back {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: 50% !important;
}

/* ── Boutons ── */
.btn-primary,
.btn.btn-primary,
a.btn-primary {
  background: var(--ui-gradient-accent) !important;
  border-radius: var(--ui-radius-md) !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  box-shadow: var(--tchumy-shadow-brand) !important;
  border: none !important;
}

.btn-secondary,
.btn.btn-secondary,
.btn-neutral,
.btn.btn-neutral {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border-strong) !important;
  border-radius: var(--ui-radius-md) !important;
  color: var(--ui-text) !important;
}

/* ── Champs ── */
.input-field,
input.input-field,
textarea.input-field,
select.input-field {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border-strong) !important;
  border-radius: var(--ui-radius-md) !important;
  color: var(--ui-text) !important;
}

.input-field:focus,
input.input-field:focus,
textarea.input-field:focus {
  border-color: rgba(139, 92, 246, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12) !important;
}

/* ── Cartes ── */
.card,
.card-padded,
.surface,
.surface-strong {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: var(--ui-radius-lg) !important;
  box-shadow: var(--ui-shadow-sm) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ── Navigation bas ── */
nav.navbar.bottomNav {
  background: rgba(17, 17, 19, 0.94) !important;
  backdrop-filter: blur(20px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(140%) !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: 999px !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4) !important;
}

nav.navbar.bottomNav.bottomNav--decouvrir,
body.page-decouvrir nav.navbar.bottomNav {
  background: rgba(17, 17, 19, 0.94) !important;
}

.navbar-item.active,
.navbar .navItemActive {
  background: var(--ui-accent-soft) !important;
  border-radius: 14px !important;
}

.navbar-item.active svg,
.navbar .navItemActive svg {
  color: var(--ui-accent) !important;
  stroke: var(--ui-accent) !important;
}

.navbar-item.active .navIcon--heart path,
.navbar .navItemActive .navIcon--heart path {
  fill: rgba(139, 92, 246, 0.2) !important;
  stroke: var(--ui-accent) !important;
}

.navbar .navBadge--matches,
.navbar .navBadge--messages,
.navbar .navBadge--notifs {
  background: var(--ui-accent-rose) !important;
  font-weight: 700 !important;
}

/* ── Auth / landing ── */
.auth-page__title,
.home-title {
  letter-spacing: -0.04em !important;
}

.home-root::before {
  background:
    radial-gradient(480px 360px at 50% 0%, rgba(139, 92, 246, 0.08), transparent 65%),
    radial-gradient(360px 280px at 80% 90%, rgba(236, 72, 153, 0.05), transparent 60%) !important;
}

.home-btn-main {
  border-radius: var(--ui-radius-md) !important;
  font-weight: 700 !important;
}

/* ── Messages ── */
.convHeader,
.chatHead {
  background: rgba(9, 9, 11, 0.94) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid var(--ui-border) !important;
}

.convRow {
  border-bottom-color: var(--ui-border) !important;
  padding: 14px 4px !important;
}

.convRow:active {
  background: var(--ui-surface-hover) !important;
}

.convAvatarWrap {
  background: var(--ui-gradient-accent) !important;
  padding: 2px !important;
}

.convAvatar {
  background: var(--ui-surface) !important;
}

/* ── Matchs ── */
.mHead {
  background: transparent !important;
  backdrop-filter: none !important;
  border: none !important;
  border-bottom: 1px solid var(--ui-border) !important;
  border-radius: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.mCard,
.iCard {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: var(--ui-radius-lg) !important;
  box-shadow: var(--ui-shadow-sm) !important;
}

.mAvatarRing,
.iAvatarRing {
  background: var(--ui-gradient-accent) !important;
}

.mTab {
  border-radius: 999px !important;
  font-weight: 600 !important;
  border-color: var(--ui-border) !important;
  color: var(--ui-text-secondary) !important;
}

.mTab[aria-selected='true'] {
  background: var(--ui-gradient-accent) !important;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.22) !important;
}

.mEmpty {
  background: var(--ui-surface) !important;
  border-color: var(--ui-border) !important;
  border-radius: var(--ui-radius-lg) !important;
}

/* ── Notifications ── */
.notifsItem,
.notifRow {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: var(--ui-radius-md) !important;
}

/* ── Profil (meProfile) ── */
.meProfile {
  --me-soft: var(--ui-bg) !important;
  --me-card: var(--ui-surface) !important;
  --me-border: var(--ui-border) !important;
  --me-ink: var(--ui-text) !important;
  --me-muted: var(--ui-text-muted) !important;
}

.meCard,
.meBlock {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border) !important;
  border-radius: var(--ui-radius-lg) !important;
}

.livingAurora {
  opacity: 0.55 !important;
  filter: blur(28px) !important;
}

/* ── Paramètres profil ── */
.peBlock,
.peToggleRow {
  background: var(--ui-surface) !important;
  border-color: var(--ui-border) !important;
  border-radius: var(--ui-radius-md) !important;
}

.peToggleTrack[aria-checked='true'],
.peToggleTrack.is-on {
  background: var(--ui-gradient-accent) !important;
}

/* ── Découvrir : bulles ── */
.soulAtmosphere {
  opacity: 0.25 !important;
  animation: none !important;
  background:
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(139, 92, 246, 0.06), transparent) !important;
}

.soulAnchor::before {
  animation: none !important;
  opacity: 0.35 !important;
}

.soulAnchor {
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border) !important;
  box-shadow: var(--ui-shadow-sm) !important;
}

.soulOrb {
  background: var(--ui-surface) !important;
  border: 2px solid var(--ui-border-strong) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: var(--ui-shadow-md) !important;
}

.soulOrb::after {
  background: radial-gradient(120% 90% at 30% 18%, rgba(255, 255, 255, 0.08), transparent 55%) !important;
  opacity: 1 !important;
}

.soulOrb--shared {
  border-color: rgba(236, 72, 153, 0.45) !important;
  box-shadow: 0 0 0 1px rgba(236, 72, 153, 0.2), var(--ui-shadow-md) !important;
}

.soulOrb--ad {
  background: linear-gradient(145deg, var(--ui-surface) 0%, rgba(139, 92, 246, 0.12) 100%) !important;
}

.bubble-nameKicker {
  color: var(--ui-text-muted) !important;
  letter-spacing: 0.1em !important;
}

.bubble-name {
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
}

.bubble-label {
  color: var(--ui-accent) !important;
  font-weight: 600 !important;
  font-size: 9px !important;
}

/* ── Découvrir : swipe cards ── */
.swipe-card {
  border-radius: var(--ui-radius-xl) !important;
  background: var(--ui-surface) !important;
  border: 1px solid var(--ui-border) !important;
  box-shadow: var(--ui-shadow-md) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.swipe-card-photo-zone {
  border-radius: var(--ui-radius-xl) var(--ui-radius-xl) 0 0 !important;
}

.swipe-card-photo-zone.is-base-avatar,
.swipe-card-photo-zone.is-base-avatar.has-real-photo,
.swipe-card-photo-zone.is-vector-photo {
  background: linear-gradient(145deg, #5b21b6 0%, #7c3aed 38%, #db2777 100%) !important;
}

.sw-gradient {
  background: linear-gradient(
    to bottom,
    transparent 42%,
    rgba(9, 9, 11, 0.55) 72%,
    rgba(9, 9, 11, 0.96) 100%
  ) !important;
}

.sw-name {
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}

.sw-meta {
  color: var(--ui-text-secondary) !important;
  font-weight: 500 !important;
}

.sw-vibe {
  background: rgba(139, 92, 246, 0.2) !important;
  border: 1px solid rgba(167, 139, 250, 0.28) !important;
  color: #e9d5ff !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
}

.sw-pill {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--ui-border) !important;
}

/* Swipe actions */
#swipe-actions {
  gap: 12px !important;
}

.sw-action {
  border: 1px solid var(--ui-border) !important;
  background: var(--ui-surface) !important;
  box-shadow: var(--ui-shadow-sm) !important;
}

.sw-action--like {
  background: var(--ui-gradient-accent) !important;
  border-color: transparent !important;
}

.sw-action--pass {
  background: var(--ui-surface) !important;
}

/* ── Sheet / overlay profil ── */
.dcSheet,
.dcGalleryOverlay {
  background: var(--ui-bg) !important;
}

.dcSheetHandle {
  background: rgba(255, 255, 255, 0.18) !important;
}

/* ── Toasts ── */
.toast {
  background: var(--ui-surface-hover) !important;
  border: 1px solid var(--ui-border-strong) !important;
  border-radius: var(--ui-radius-md) !important;
  box-shadow: var(--ui-shadow-md) !important;
}

/* ── Streaks : moins flashy ── */
.streak-badge {
  animation: none !important;
  background: var(--ui-accent-soft) !important;
  border-color: rgba(139, 92, 246, 0.28) !important;
  box-shadow: none !important;
}

/* ── Discover empty ── */
.discover-empty {
  background: transparent !important;
}

.discover-empty__title {
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
}

/* ── Wizard onboarding ── */
.wiz-step-indicator .wiz-dot.is-active {
  background: var(--ui-accent) !important;
}

/* ── Web shell desktop ── */
@media (min-width: 768px) {
  .app-container,
  .appShell.app-container {
    border-radius: var(--ui-radius-xl) !important;
    border: 1px solid var(--ui-border) !important;
    background: var(--ui-bg) !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55) !important;
  }
}

/* Réduire les animations « AI glow » */
@keyframes soulPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.02); }
}

.soulOrb {
  animation-duration: 5s !important;
}

/* ══════════════════════════════════════════════════════════
   TINDER 2026 — Découvrir plein écran, actions flottantes
   ══════════════════════════════════════════════════════════ */

/* Carte photo-first, quasi plein écran */
html:has(.decouvrirRoot) #deck,
html:has(.decouvrirRoot) .swipeStage {
  padding: 0 10px !important;
}

html:has(.decouvrirRoot) .swipe-card {
  border-radius: 20px !important;
  border: none !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45) !important;
}

html:has(.decouvrirRoot) .swipe-card-photo-zone {
  border-radius: 20px !important;
}

html:has(.decouvrirRoot) .sw-name {
  font-size: 30px !important;
  line-height: 1.1 !important;
}

html:has(.decouvrirRoot) .sw-meta {
  font-size: 15px !important;
}

/* Dock d'actions style Tinder — pas de pill glass */
html:has(.decouvrirRoot) #swipe-actions,
html:has(.decouvrirRoot) #bubble-card-actions {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  gap: 20px !important;
  padding: 12px 20px 20px !important;
}

html:has(.decouvrirRoot) .sw-action {
  background: #18181b !important;
  border: 2px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28) !important;
}

html:has(.decouvrirRoot) .sw-action--pass {
  width: 56px !important;
  height: 56px !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
  color: #f87171 !important;
  background: #141416 !important;
}

html:has(.decouvrirRoot) .sw-action--like {
  width: 64px !important;
  height: 64px !important;
  background: linear-gradient(145deg, #ec4899 0%, #7c3aed 100%) !important;
  border: none !important;
  box-shadow: 0 10px 32px rgba(236, 72, 153, 0.38) !important;
  color: #fff !important;
}

html:has(.decouvrirRoot) .sw-action--nav,
html:has(.decouvrirRoot) .sw-action--more {
  width: 48px !important;
  height: 48px !important;
  background: #18181b !important;
}

/* Bulles = cercles photo style grille (moins mystique) */
html:has(.decouvrirRoot) .soulAnchor {
  width: 64px !important;
  height: 64px !important;
  background: #18181b !important;
  border: 2px solid rgba(139, 92, 246, 0.35) !important;
}

html:has(.decouvrirRoot) .soulAnchorLabel {
  font-size: 9px !important;
  letter-spacing: 0.12em !important;
  color: rgba(255, 255, 255, 0.55) !important;
}

html:has(.decouvrirRoot) .soulOrb {
  border: 2px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35) !important;
}

/* Mode switch discret en haut */
html:has(.decouvrirRoot) .discoverModeSwitch,
html:has(.decouvrirRoot) #discoverModeToggle {
  border-radius: 999px !important;
  background: #18181b !important;
  border: 1px solid var(--ui-border) !important;
}

@media (prefers-reduced-motion: reduce) {
  .soulOrb,
  .soulOrb--resonant,
  .streak-badge {
    animation: none !important;
  }
}

/* ══════════════════════════════════════════════════════════
   Paramètres profil — style moderne 2026
   ══════════════════════════════════════════════════════════ */

.pe-settings .pe-settings__top.card-padded,
.pe-settings .peCompletionTop,
.pe-settings .peBlock,
.pe-settings .peAccordion {
  background: #18181b !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 20px !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.pe-settings .peCompletionTop {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(236, 72, 153, 0.05)) !important;
}

.pe-settings .peJumpNav__chip {
  background: #18181b !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.72) !important;
  border-radius: 999px !important;
}

.pe-settings .peJumpNav__chip.is-active,
.pe-settings .peJumpNav__chip:hover {
  background: rgba(139, 92, 246, 0.14) !important;
  border-color: rgba(167, 139, 250, 0.35) !important;
  color: #fafafa !important;
}

.pe-settings .meModeCard {
  background: #1f1f23 !important;
  border: 2px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 18px !important;
}

.pe-settings .meModeCard.is-selected,
.pe-settings .meModeCard.actif {
  border-color: rgba(236, 72, 153, 0.55) !important;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(236, 72, 153, 0.08)) !important;
  box-shadow: 0 8px 28px rgba(124, 58, 237, 0.18) !important;
}

.pe-settings .peToggleRow {
  background: #1f1f23 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 16px !important;
}

.pe-settings .peToggleTrack {
  width: 52px !important;
  height: 32px !important;
  border: none !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

.pe-settings .peToggleTrack.is-on {
  background: linear-gradient(135deg, #7c3aed, #ec4899) !important;
}

.pe-settings .peToggleKnob {
  width: 26px !important;
  height: 26px !important;
  top: 3px !important;
  left: 3px !important;
  background: #fafafa !important;
  color: #71717a !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28) !important;
}

.pe-settings .peToggleTrack.is-on .peToggleKnob {
  transform: translateX(20px) !important;
  color: #7c3aed !important;
}

/* ══════════════════════════════════════════════════════════
   Messages — liste pleine hauteur (web vertical)
   ══════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
  .appShell.app-container {
    position: relative;
  }

  .mainContent.page-content:has(.msgs-inbox) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding-bottom: calc(var(--bottom-nav-reserve, 68px) + 8px);
  }

  .msgs-inbox {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  .msgs-inbox #convList {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.chat-conversation-open .chatPane {
    position: absolute;
    inset: 0;
    max-width: none;
    left: 0;
    margin-left: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    z-index: 150;
  }

  body.chat-conversation-open .chatPane.open {
    height: 100%;
    max-height: 100%;
    min-height: 0;
  }
}

/* ══════════════════════════════════════════════════════════
   Écran de chargement Découvrir (libellé : profils)
   ══════════════════════════════════════════════════════════ */

.discoverLoader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}

.discoverLoader.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}

.discoverLoader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
}

.discoverLoader__spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: #ec4899;
  border-right-color: #8b5cf6;
  animation: discoverSpin 0.75s linear infinite;
}

.discoverLoader__label {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: -0.01em;
}

@keyframes discoverSpin {
  to { transform: rotate(360deg); }
}
