/* ============================================
   sprint5-ext.css — v1.0.0 (Sprint 5, v2.50.0)
   Header mobile conforme à la maquette de Pierre.
   Tokens reproduits depuis tokens.css de la maquette.

   RÈGLES SPRINT 3+ APPLIQUÉES
     1. Pas de transform translateY
     2. Pas de backdrop-filter
     3. animation: none !important
     4. (architecture) setInterval, pas MutationObserver subtree
     5. (architecture) update inline + memoization
   ============================================ */

:root {
  --s5-ivoire: var(--ivoire, #F5EFE0);
  --s5-nuit: var(--nuit, #1A2845);
  --s5-sable: var(--sable, #ECDDCB);
  --s5-mousse: var(--mousse, #7B9F35);
  --s5-mousse-soft: rgba(123, 159, 53, 0.20);
  --s5-display: var(--font-display, "Unbounded"), system-ui, sans-serif;
  --s5-mono: ui-monospace, "Geist Mono", monospace;
  --s5-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   HEADER MOBILE V2 — visible uniquement < 768px
   ============================================ */
.abo-mobile-header-v2 {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: var(--s5-ivoire);
  border-bottom: 1px solid var(--s5-sable);
  position: sticky;
  top: 0;
  z-index: 5;
  flex-shrink: 0;
  opacity: 1;
  animation: none !important;
}

@media (max-width: 767px) {
  .abo-mobile-header-v2 {
    display: flex;
  }
}

.abo-mh-brand {
  font-family: var(--s5-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--s5-nuit);
  line-height: 1;
}

.abo-mh-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Filter pill (Perso / Pro / Tout) */
.abo-mh-filter {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--s5-sable);
  border-radius: 999px;
  font-family: var(--s5-mono);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.abo-mh-filter button {
  border: 0;
  background: transparent;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--s5-nuit);
  opacity: 0.55;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  transition: all 0.18s var(--s5-ease);
  line-height: 1.1;
}

.abo-mh-filter button:hover {
  opacity: 0.85;
}

.abo-mh-filter button.is-active {
  background: var(--s5-ivoire);
  opacity: 1;
  box-shadow: 0 1px 2px rgba(26, 40, 69, 0.07);
}

/* Icon button (loupe) */
.abo-mh-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--s5-sable);
  cursor: pointer;
  transition: background 0.18s var(--s5-ease);
  color: var(--s5-nuit);
  flex-shrink: 0;
  padding: 0;
}

.abo-mh-icon-btn:hover {
  background: var(--s5-sable);
}

/* Sync dot */
.abo-mh-sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.abo-mh-sync-synced {
  background: var(--s5-mousse);
  box-shadow: 0 0 0 3px var(--s5-mousse-soft);
}

.abo-mh-sync-idle {
  background: #c5b89c;
  box-shadow: 0 0 0 3px transparent;
}

.abo-mh-sync-pending {
  background: #d4a847;
  box-shadow: 0 0 0 3px rgba(212, 168, 71, 0.20);
}

/* ============================================
   SEARCH BAR (révélée par tap loupe)
   ============================================ */
.abo-mh-search-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--s5-ivoire);
  border-bottom: 1px solid var(--s5-sable);
  position: sticky;
  top: 56px;
  z-index: 5;
  flex-shrink: 0;
}

@media (max-width: 767px) {
  .abo-mh-search-bar:not([hidden]) {
    display: flex;
  }
}

.abo-mh-search-bar[hidden] {
  display: none !important;
}

.abo-mh-search-icon {
  color: var(--s5-nuit);
  opacity: 0.55;
  flex-shrink: 0;
}

.abo-mh-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--s5-nuit);
  outline: none;
  padding: 4px 0;
}

.abo-mh-search-input::placeholder {
  color: var(--s5-nuit);
  opacity: 0.4;
}

.abo-mh-search-clear {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: var(--s5-sable);
  color: var(--s5-nuit);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.16s var(--s5-ease);
}

.abo-mh-search-clear:hover {
  background: rgba(26, 40, 69, 0.15);
}

/* ============================================
   Cache ancien .mode-cards du core quand notre header est actif
   (sur mobile uniquement)
   ============================================ */
@media (max-width: 767px) {
  body.abo-mh-active .mode-cards {
    display: none !important;
  }

  /* Compense un peu de padding-top si le screen avait du padding-top global */
  body.abo-mh-active .screen > .app-content {
    padding-top: 0;
  }
}

/* ============================================
   prefers-reduced-motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .abo-mobile-header-v2,
  .abo-mh-filter button,
  .abo-mh-icon-btn,
  .abo-mh-search-bar {
    transition: none !important;
    animation: none !important;
  }
}
