/* ============================================
   sprint2-ext.css — v1.0.0
   Styles unifiés pour Sprint 2 :
     - .delacc-* (delete-account-ext)
     - .readonly-* (readonly-banner-ext)
     - .welcome-* (welcome-aboplus-ext)
   Wrapper additif, n'écrase aucun style core.
   ============================================ */

:root {
  --s2-bg-overlay: rgba(26, 40, 69, 0.45);
  --s2-bg-sheet: var(--ivoire, #F5EFE0);
  --s2-text: var(--nuit, #1A2845);
  --s2-text-soft: rgba(26, 40, 69, 0.65);
  --s2-text-muted: rgba(26, 40, 69, 0.5);
  --s2-border: var(--sable, #ECDDCB);
  --s2-danger: var(--boow, #F85558);
  --s2-danger-soft: rgba(248, 85, 88, 0.10);
  --s2-success: var(--mousse, #7B9F35);
  --s2-warn: var(--terracotta, #C9622D);
  --s2-warn-soft: rgba(201, 98, 45, 0.12);
  --s2-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   Menu item — Delete account (injecté dans #screen-menu)
   On suit le pattern .abo-menu-item de la prod si dispo, sinon style baseline.
   ============================================ */
.delete-account-menu-item.abo-menu-item,
.delete-account-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 20px;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--s2-border);
  cursor: pointer;
  font: inherit;
  text-align: left;
  color: var(--s2-danger);
  transition: background 0.16s var(--s2-ease);
  -webkit-tap-highlight-color: transparent;
}

.delete-account-menu-item:hover {
  background: var(--s2-danger-soft);
}

.delete-account-menu-item .abo-menu-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--s2-danger-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--s2-danger);
}

.delete-account-menu-item .abo-menu-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.delete-account-menu-item .abo-menu-title {
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--s2-danger);
}

.delete-account-menu-item .abo-menu-sub {
  font-family: ui-monospace, "Geist Mono", monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.65;
  color: var(--s2-text-soft);
}

/* ============================================
   Sheet Delete Account
   ============================================ */
.delacc-overlay {
  position: fixed;
  inset: 0;
  /* v2.47.3 ANTI-CLIGNOTEMENT — backdrop-filter supprimé.
     Cause suspecte : ré-évaluation continue du blur sur arrière-plan
     instable (menu/dashboard qui re-render), donnant un effet visuel
     de clignotement même si DOM stable (destroyCount = 0 vérifié).
     Remplacé par fond opaque qui isole visuellement la sheet. */
  background: rgba(20, 32, 56, 0.92);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.24s var(--s2-ease);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
}

.delacc-overlay.is-open { opacity: 1; }

.delacc-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  background: var(--s2-bg-sheet);
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* v2.47.4 ANTI-TREMBLEMENT — suppression transform translateY + transition transform.
     Cause suspectée : une animation/transition CSS héritée du core (sélecteur trop
     large genre * ou .abo-app *) re-déclenchait la transition transform en boucle,
     donnant un tremblement visible (~2px d'amplitude).
     Fix : la sheet apparaît juste par opacity sur l'overlay. Position statique.
     Animation force-disabled au cas où un keyframe prod s'applique. */
  opacity: 1;
  animation: none !important;
  box-shadow: 0 -10px 40px rgba(26, 40, 69, 0.25);
  position: relative;
}

.delacc-overlay.is-open .delacc-sheet {
  /* Plus de transform ici — la sheet est statique une fois ouverte */
  animation: none !important;
}

@media (min-width: 768px) {
  .delacc-overlay { align-items: center; }
  .delacc-sheet { border-radius: 22px; max-height: 86vh; }
}

.delacc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--s2-border);
  background: var(--s2-bg-sheet);
}

.delacc-title {
  font-family: var(--font-display), "Unbounded", system-ui, sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--s2-text);
  flex: 1;
}

.delacc-close,
.delacc-back {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--s2-border);
  background: transparent;
  color: var(--s2-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s var(--s2-ease);
  flex-shrink: 0;
}

.delacc-close:hover,
.delacc-back:hover {
  background: var(--s2-border);
}

.delacc-body {
  padding: 18px 20px 12px;
  overflow-y: auto;
  flex: 1;
}

.delacc-warn {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 14px;
  background: var(--s2-warn-soft);
  border-radius: 12px;
  margin-bottom: 16px;
  color: var(--s2-warn);
}

.delacc-warn svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.delacc-warn-title {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--s2-text);
}

.delacc-warn-sub {
  margin-top: 3px;
  font-size: 13px;
  color: var(--s2-text-soft);
  line-height: 1.45;
}

.delacc-prose {
  font-size: 14px;
  line-height: 1.5;
  color: var(--s2-text);
  margin: 0 0 10px;
}

.delacc-prose-soft {
  color: var(--s2-text-soft);
  font-size: 13px;
}

.delacc-list {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--s2-text-soft);
  font-size: 13.5px;
  line-height: 1.65;
}

.delacc-list li {
  margin-bottom: 2px;
}

.delacc-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--s2-border);
  border-radius: 12px;
  font: inherit;
  font-family: ui-monospace, "Geist Mono", monospace;
  font-size: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--s2-bg-sheet);
  color: var(--s2-text);
  outline: none;
  transition: border-color 0.16s var(--s2-ease);
  margin-bottom: 14px;
}

.delacc-input:focus { border-color: var(--s2-text); }
.delacc-input.is-valid { border-color: var(--s2-danger); color: var(--s2-danger); }

.delacc-foot {
  display: flex;
  gap: 10px;
  padding: 12px 18px 18px;
  border-top: 1px solid var(--s2-border);
  background: var(--s2-bg-sheet);
}

.delacc-btn {
  flex: 1;
  padding: 13px 16px;
  border-radius: 12px;
  border: 0;
  font: inherit;
  font-weight: 500;
  font-size: 14.5px;
  cursor: pointer;
  transition: all 0.16s var(--s2-ease);
  letter-spacing: -0.005em;
}

.delacc-btn-ghost {
  background: transparent;
  color: var(--s2-text);
  border: 1px solid var(--s2-border);
}

.delacc-btn-ghost:hover { background: var(--s2-border); }

.delacc-btn-danger {
  background: var(--s2-danger);
  color: var(--s2-bg-sheet);
}

.delacc-btn-danger:hover:not(:disabled) { background: #ed4a4d; }

.delacc-btn-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.delacc-btn-danger.is-ready:not(:disabled) {
  animation: delaccPulse 0.4s var(--s2-ease) 0s 1;
}

@keyframes delaccPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* ============================================
   ReadOnly Banner
   ============================================ */
.readonly-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(95deg, var(--s2-warn-soft) 0%, rgba(201, 98, 45, 0.05) 100%);
  border-bottom: 1px solid rgba(201, 98, 45, 0.18);
  color: var(--s2-text);
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  animation: readonlySlideDown 0.32s var(--s2-ease);
}

@keyframes readonlySlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.readonly-banner.is-leaving {
  animation: readonlySlideUp 0.24s var(--s2-ease) forwards;
}

@keyframes readonlySlideUp {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-100%); opacity: 0; }
}

.readonly-banner-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--s2-warn);
  color: var(--s2-bg-sheet);
  display: flex;
  align-items: center;
  justify-content: center;
}

.readonly-banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.3;
}

.readonly-banner-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--s2-text);
  letter-spacing: -0.005em;
}

.readonly-banner-sub {
  font-size: 11.5px;
  color: var(--s2-text-soft);
}

.readonly-banner-cta {
  padding: 7px 14px;
  border-radius: 999px;
  border: 0;
  background: var(--s2-warn);
  color: var(--s2-bg-sheet);
  font: inherit;
  font-family: ui-monospace, "Geist Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
  transition: background 0.16s var(--s2-ease);
  flex-shrink: 0;
}

.readonly-banner-cta:hover { background: #b0561d; }

.readonly-banner-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--s2-text-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s var(--s2-ease);
  flex-shrink: 0;
}

.readonly-banner-close:hover {
  background: rgba(26, 40, 69, 0.08);
  color: var(--s2-text);
}

/* Mobile compact */
@media (max-width: 420px) {
  .readonly-banner { padding: 9px 12px; gap: 10px; }
  .readonly-banner-icon { width: 24px; height: 24px; }
  .readonly-banner-title { font-size: 12.5px; }
  .readonly-banner-sub { display: none; }
  .readonly-banner-cta { padding: 6px 11px; font-size: 10.5px; }
}

/* ============================================
   Welcome AboPlus Sheet
   ============================================ */
.welcome-overlay {
  position: fixed;
  inset: 0;
  /* v2.47.3 — backdrop-filter supprimé par cohérence (même cause potentielle) */
  background: rgba(20, 32, 56, 0.94);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.32s var(--s2-ease);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.welcome-overlay.is-open { opacity: 1; }

.welcome-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  background: var(--s2-bg-sheet);
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* v2.47.4 — sheet statique, animations bloquées (cohérence avec delete-account) */
  opacity: 1;
  animation: none !important;
  box-shadow: 0 -12px 50px rgba(26, 40, 69, 0.3);
  position: relative;
}

.welcome-overlay.is-open .welcome-sheet {
  animation: none !important;
}

@media (min-width: 768px) {
  .welcome-overlay { align-items: center; }
  .welcome-sheet { border-radius: 24px; max-height: 86vh; }
}

.welcome-hero {
  padding: 32px 24px 22px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 30%,
      rgba(123, 159, 53, 0.12) 0%,
      transparent 60%);
}

.welcome-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--s2-success) 0%, #6a8d2a 100%);
  color: var(--s2-bg-sheet);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow:
    0 6px 20px rgba(123, 159, 53, 0.35),
    0 2px 6px rgba(123, 159, 53, 0.2);
  animation: welcomeBadgePop 0.6s var(--s2-ease) 0.1s both;
}

@keyframes welcomeBadgePop {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

.welcome-title {
  font-family: var(--font-display), "Unbounded", system-ui, sans-serif;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.025em;
  color: var(--s2-text);
  line-height: 1.1;
  margin-bottom: 8px;
}

.welcome-sub {
  font-size: 14.5px;
  color: var(--s2-text-soft);
  line-height: 1.45;
  max-width: 28ch;
  margin: 0 auto;
}

.welcome-features {
  padding: 8px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.welcome-feature {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 14px;
  border: 1px solid var(--s2-border);
  border-radius: 14px;
  background: transparent;
  transition: background 0.16s var(--s2-ease);
  animation: welcomeFeatureSlide 0.4s var(--s2-ease) both;
}

.welcome-feature:nth-child(1) { animation-delay: 0.18s; }
.welcome-feature:nth-child(2) { animation-delay: 0.26s; }
.welcome-feature:nth-child(3) { animation-delay: 0.34s; }
.welcome-feature:nth-child(4) { animation-delay: 0.42s; }

@keyframes welcomeFeatureSlide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(123, 159, 53, 0.10);
  color: var(--s2-success);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.welcome-feature-text { flex: 1; min-width: 0; }

.welcome-feature-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--s2-text);
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}

.welcome-feature-desc {
  font-size: 13px;
  color: var(--s2-text-soft);
  line-height: 1.4;
}

.welcome-foot {
  padding: 12px 20px 22px;
  border-top: 1px solid var(--s2-border);
  background: var(--s2-bg-sheet);
}

.welcome-btn {
  width: 100%;
  padding: 15px 18px;
  border-radius: 14px;
  border: 0;
  background: var(--s2-text);
  color: var(--s2-bg-sheet);
  font: inherit;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.16s var(--s2-ease);
}

.welcome-btn:hover { background: #0e1a35; transform: translateY(-1px); }
.welcome-btn:active { transform: scale(0.99); }

/* ============================================
   prefers-reduced-motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .delacc-overlay,
  .delacc-sheet,
  .readonly-banner,
  .welcome-overlay,
  .welcome-sheet,
  .welcome-badge,
  .welcome-feature {
    animation: none !important;
    transition: none !important;
  }
}
