/* ─── Goey Toast — Klarrro notification system ──────────────────────────────── */

/* ── SVG filter (effet blob) ── */
#gt-svg-filters { position: absolute; width: 0; height: 0; pointer-events: none; overflow: hidden; }

/* ── Container ─────────────────────────────────────────────────────────────── */
#gt-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  /* filter: url(#gt-gooey); ← activer pour l'effet blob inter-toasts */
}

/* ── Toast base ─────────────────────────────────────────────────────────────── */
.gt-toast {
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px 13px 13px;
  min-width: 260px;
  max-width: 360px;
  position: relative;
  overflow: hidden;
  cursor: default;

  /* Dark glassy surface */
  background: rgba(18, 18, 36, 0.92);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-radius: 16px;
  border: 1px solid var(--gt-border, rgba(255,255,255,0.10));

  /* Colored glow + shadow */
  box-shadow:
    0 2px 8px rgba(0,0,0,0.45),
    0 8px 32px rgba(0,0,0,0.35),
    0 0 0 0.5px rgba(255,255,255,0.04) inset,
    0 0 24px -4px var(--gt-glow, transparent);

  /* Entrance state: slide-in from right */
  transform: translateX(calc(100% + 32px)) scale(0.96);
  opacity: 0;
  will-change: transform, opacity;
  transition:
    transform 0.48s cubic-bezier(0.22, 1.5, 0.36, 1),
    opacity   0.28s ease;
}

/* ── Entrance ──────────────────────────────────────────────────────────────── */
.gt-toast.gt-visible {
  transform: translateX(0) scale(1);
  opacity: 1;
}

/* ── Exit ──────────────────────────────────────────────────────────────────── */
.gt-toast.gt-exit {
  transform: translateX(calc(100% + 32px)) scale(0.96);
  opacity: 0;
  transition:
    transform 0.32s cubic-bezier(0.4, 0, 1, 1),
    opacity   0.22s ease;
}

/* ── Left color accent bar ─────────────────────────────────────────────────── */
.gt-toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10%;
  bottom: 10%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--gt-color, rgba(255,255,255,0.3));
  opacity: 0.85;
}

/* ── Icon bubble ───────────────────────────────────────────────────────────── */
.gt-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--gt-icon-bg, rgba(255,255,255,0.06));
  border: 1px solid var(--gt-border, rgba(255,255,255,0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gt-color, #fff);
  margin-top: 1px;
  font-size: .9rem;
  line-height: 1;
}

/* ── Body ──────────────────────────────────────────────────────────────────── */
.gt-body {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.gt-msg {
  font-size: .855rem;
  font-weight: 600;
  color: #eeeef5;
  line-height: 1.4;
  letter-spacing: .01em;
  word-break: break-word;
}

.gt-desc {
  font-size: .775rem;
  color: #8888a8;
  margin-top: .28rem;
  line-height: 1.45;
}

/* ── Close button ──────────────────────────────────────────────────────────── */
.gt-close {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: #55556a;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: color .15s, background .15s;
}
.gt-close:hover { color: #d0d0e8; background: rgba(255,255,255,0.07); }
.gt-close { font-size: .7rem; }

/* ── Progress bar ──────────────────────────────────────────────────────────── */
.gt-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: rgba(255,255,255,0.05);
  overflow: hidden;
  border-radius: 0 0 16px 16px;
}

.gt-progress-bar {
  height: 100%;
  background: var(--gt-color, #fff);
  width: 100%;
  transform-origin: left;
  animation: gt-shrink linear forwards;
  opacity: 0.55;
}

@keyframes gt-shrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ── Urgent pulse ──────────────────────────────────────────────────────────── */
.gt-toast.gt-urgent-pulse {
  animation: gt-pulse 2.2s ease-in-out infinite;
}

@keyframes gt-pulse {
  0%, 100% {
    box-shadow:
      0 2px 8px rgba(0,0,0,0.45),
      0 8px 32px rgba(0,0,0,0.35),
      0 0 0 0.5px rgba(255,255,255,0.04) inset,
      0 0 20px -4px var(--gt-glow, transparent);
  }
  50% {
    box-shadow:
      0 2px 8px rgba(0,0,0,0.45),
      0 8px 32px rgba(0,0,0,0.35),
      0 0 0 0.5px rgba(255,255,255,0.04) inset,
      0 0 38px -2px var(--gt-glow, transparent);
  }
}

/* ── Type variables ────────────────────────────────────────────────────────── */
.gt-success {
  --gt-color:    #4ade80;
  --gt-border:   rgba(74, 222, 128, 0.22);
  --gt-glow:     rgba(34, 197, 94, 0.28);
  --gt-icon-bg:  rgba(34, 197, 94, 0.14);
}
.gt-error {
  --gt-color:    #f87171;
  --gt-border:   rgba(248, 113, 113, 0.22);
  --gt-glow:     rgba(239, 68, 68, 0.28);
  --gt-icon-bg:  rgba(239, 68, 68, 0.14);
}
.gt-warning {
  --gt-color:    #fbbf24;
  --gt-border:   rgba(251, 191, 36, 0.22);
  --gt-glow:     rgba(245, 158, 11, 0.28);
  --gt-icon-bg:  rgba(245, 158, 11, 0.14);
}
.gt-info {
  --gt-color:    #60a5fa;
  --gt-border:   rgba(96, 165, 250, 0.22);
  --gt-glow:     rgba(59, 130, 246, 0.28);
  --gt-icon-bg:  rgba(59, 130, 246, 0.14);
}
.gt-urgent {
  --gt-color:    #ff5252;
  --gt-border:   rgba(255, 82, 82, 0.38);
  --gt-glow:     rgba(255, 64, 64, 0.45);
  --gt-icon-bg:  rgba(239, 68, 68, 0.20);
}
.gt-purple {
  --gt-color:    #c084fc;
  --gt-border:   rgba(192, 132, 252, 0.22);
  --gt-glow:     rgba(139, 92, 246, 0.28);
  --gt-icon-bg:  rgba(139, 92, 246, 0.14);
}

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  #gt-container {
    bottom: 16px;
    right: 12px;
    left: 12px;
    align-items: stretch;
  }
  .gt-toast {
    max-width: 100%;
    min-width: 0;
    border-radius: 14px;
  }
}

/* ── Reduce motion ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .gt-toast,
  .gt-toast.gt-visible,
  .gt-toast.gt-exit { transition: opacity 0.2s ease !important; transform: none !important; }
  .gt-toast.gt-urgent-pulse { animation: none !important; }
  .gt-progress-bar { animation-duration: 99999s !important; }
}

/* ═══ V2 « île » — app participant (classe posée par le hub KlrNotify) ═══════
   Une seule notification à la fois, en haut sous la barre du haut. Fixe :
   le flou d'arrière-plan est permis ici (jamais sur une carte qui défile).
   Les autres pages qui chargent goey-toast gardent le rendu ci-dessus. */
#gt-container.gt-island {
  top: var(--klr-notify-top, calc(env(safe-area-inset-top, 0px) + 12px));
  bottom: auto;
  left: 50%;
  right: auto;
  width: min(calc(100vw - 24px), 420px);
  transform: translateX(-50%);
  align-items: stretch;
  gap: 0;
  z-index: var(--z-toast);
}
/* Feuille légère ouverte (menu, fiche soirée…) : le retour d'action passe
   au-dessus d'elle, toujours sous les overlays bloquants (match, avertissement). */
#gt-container.gt-island.gt-island--raised { z-index: var(--z-loader); }

.gt-isl {
  --gt-accent: var(--info);
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr 44px;
  align-items: center;
  column-gap: 10px;
  padding: 8px 4px 8px 10px;
  min-height: 56px;
  border-radius: 20px;
  background: var(--app-surface-a-92, rgba(22,22,44,.92));
  border: 1px solid var(--app-fg-a-10, rgba(255,255,255,.1));
  box-shadow: 0 10px 30px var(--app-shadow-a-40, rgba(0,0,0,.4)), 0 1px 0 var(--app-fg-a-05, rgba(255,255,255,.05)) inset;
  backdrop-filter: saturate(1.4) blur(18px);
  -webkit-backdrop-filter: saturate(1.4) blur(18px);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  animation: gt-isl-in .42s cubic-bezier(.22, 1.2, .36, 1) both;
}
/* Pile : un liseré sous l'île annonce d'autres notifications en attente. */
#gt-container.gt-has-more .gt-isl:not(.gt-isl--exit):not(.gt-isl--exit-up)::after {
  content: '';
  position: absolute;
  left: 18px; right: 18px; bottom: -5px;
  height: 5px;
  border-radius: 0 0 12px 12px;
  background: var(--app-surface-a-70, rgba(22,22,44,.7));
  border: 1px solid var(--app-fg-a-08, rgba(255,255,255,.08));
  border-top: 0;
}
.gt-isl--tappable { cursor: pointer; }
.gt-isl--drag { animation: none; transition: none; }

.gt-isl-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--gt-accent);
  background: color-mix(in srgb, var(--gt-accent) 16%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gt-accent) 28%, transparent) inset;
}
.gt-isl-icon svg, .gt-isl-close svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.gt-isl-body { min-width: 0; padding: 2px 0; }
.gt-isl-title {
  font-weight: 700;
  font-size: .9375rem;
  line-height: 1.25;
  color: var(--text);
  overflow-wrap: anywhere;
}
.gt-isl-text {
  margin-top: 2px;
  font-size: .875rem;
  line-height: 1.35;
  color: var(--text2);
  overflow-wrap: anywhere;
}
.gt-isl-close {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gt-isl-close:hover { color: var(--text); background: var(--app-fg-a-06, rgba(255,255,255,.06)); }
.gt-isl-close:focus-visible, .gt-isl-action:focus-visible {
  outline: 2px solid var(--app-accent-ink, #EE7A97);
  outline-offset: 2px;
}
.gt-isl-actions {
  grid-column: 2 / 4;
  display: flex;
  padding: 4px 8px 2px 0;
}
.gt-isl-actions[hidden] { display: none; }
.gt-isl-action {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--app-accent-fill, #C43D63);
  color: var(--app-on-accent, #FFFFFF);
  font: 700 .875rem/1 'DM Sans', system-ui, sans-serif;
  cursor: pointer;
}

/* Couleur de pastille par nature */
.gt-isl--success { --gt-accent: var(--success); }
.gt-isl--error   { --gt-accent: var(--danger); }
.gt-isl--safety  { --gt-accent: var(--danger); }
.gt-isl--warning { --gt-accent: var(--app-amber-ink, #F59E0B); }
.gt-isl--info    { --gt-accent: var(--info); }
.gt-isl--xp      { --gt-accent: var(--app-amber-ink, #F59E0B); }
.gt-isl--match,
.gt-isl--social  { --gt-accent: var(--app-accent-ink, #EE7A97); }
.gt-isl--match .gt-isl-icon {
  color: var(--app-on-accent, #FFFFFF);
  background: var(--app-accent-fill, #C43D63);
  box-shadow: none;
}
.gt-isl--safety, .gt-isl--error { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

.gt-isl--bump { animation: gt-isl-bump .32s ease both; }
.gt-isl--exit { animation: gt-isl-out .3s ease both; pointer-events: none; }
.gt-isl--exit-up { animation: gt-isl-out-up .26s ease both; pointer-events: none; }
/* Sortante hors du flux : la suivante prend sa place (fondu au même endroit)
   au lieu de s'afficher décalée sous elle le temps de la sortie. */
#gt-container.gt-island > .gt-isl--exit,
#gt-container.gt-island > .gt-isl--exit-up { position: absolute; top: 0; left: 0; right: 0; }

@keyframes gt-isl-in {
  from { transform: translateY(-14px) scale(.96); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes gt-isl-out {
  from { transform: none; opacity: 1; }
  to   { transform: translateY(-10px) scale(.97); opacity: 0; }
}
@keyframes gt-isl-out-up {
  from { opacity: 1; }
  to   { transform: translateY(-80px); opacity: 0; }
}
@keyframes gt-isl-bump {
  0%   { transform: none; }
  40%  { transform: scale(1.025); }
  100% { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gt-isl, .gt-isl--bump { animation: none; }
  .gt-isl--exit, .gt-isl--exit-up { animation: gt-isl-fade .2s linear both; }
  @keyframes gt-isl-fade { from { opacity: 1; } to { opacity: 0; } }
}
