/*
 * FLOWAYZ — APP SHELL POLISH (Sprint 3, refonte 2026-04-26)
 *
 * Polish handoff (handoff/02-components-spec.md § Sidebar + Topbar) appliqué
 * sur les sélecteurs existants (.sidebar-link, .header-icon-btn, .sidebar.active).
 * Stratégie extend pas replace : aucune nouvelle classe nécessaire dans les
 * partials existants — le CSS overrides via cascade + spécificité naturelle.
 *
 * Si tu préfères revenir à l'état antérieur (solid accent active background) :
 * commente l'@import dans layouts/application.html.erb ou supprime ce fichier.
 */

/* =============================================================================
   SIDEBAR — active marker accent + soft background (handoff §02)
   ============================================================================= */

/* Active item : soft bg + accent color + 4px left marker.
   Override propre des --nav-item-active-{bg,color} pour cohérence handoff. */
.sidebar-link.active {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}

/* Marker 4px à gauche — handoff signature visuelle */
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  pointer-events: none;
}

/* Hover plus discret — bg-hover plutôt que solid accent */
.sidebar-link:hover:not(.active) {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
  /* PAS de transform: scale sur le link entier — red line handoff */
}

/* Icons SVG dans .sidebar-link : scale OK (icon ≤ 24px = autorisé)
   mais on garde l'existant `transform: scale(1.08)` (déjà présent) */

/* =============================================================================
   TOPBAR — active state + Cmd+K hint badge
   ============================================================================= */

/* Active page link dans la topbar */
.header-icon-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-md, 10px);
  position: relative;
}
.header-icon-btn.active::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}

/* Cmd+K hint badge — affiché dans topbar pour suggérer le raccourci */
.fz-cmdk-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted, var(--text-muted-handoff));
  background: var(--bg-muted);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-md, 10px);
  cursor: pointer;
  transition: all var(--dur-fast, 150ms) var(--ease-out, ease);
  user-select: none;
}
.fz-cmdk-hint:hover {
  color: var(--text-primary);
  border-color: var(--border-strong, var(--border-strong-handoff));
}
.fz-cmdk-hint kbd {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default, var(--border-handoff));
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}
@media (max-width: 768px) {
  .fz-cmdk-hint .fz-cmdk-hint__label { display: none; }
}

/* =============================================================================
   COMMAND PALETTE — affinage spec handoff
   ============================================================================= */

/* Footer hint dans la palette */
.command-palette__hint-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--border-faint);
  font-size: 11px;
  color: var(--text-muted, var(--text-muted-handoff));
  background: var(--bg-muted);
}
.command-palette__hint-footer kbd {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default, var(--border-handoff));
  border-radius: 4px;
  font-weight: 600;
  margin: 0 2px;
}

/* =============================================================================
   PAGE TRANSITIONS — réactivées 2026-05-06 (Sprint 1 polish)
   =============================================================================
   Cible : <main> uniquement (jamais <body>) pour éviter le flash dark/light
   reporté en 2026-04-27. Valeurs très discrètes : opacity reste >= 0.96,
   pas de scale/translate sur le body, fade-in court avec tiny lift de 3px.
   JS : `app/javascript/utils/turbo_transition.js` (cible main, no-op si
   prefers-reduced-motion). */

main.turbo-leaving {
  opacity: 0.96;
  transition: opacity 70ms ease-out;
}

main.turbo-arriving {
  animation: fz-turbo-arrive 200ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes fz-turbo-arrive {
  from { opacity: 0.94; transform: translate3d(0, 3px, 0); }
  to   { opacity: 1;    transform: translate3d(0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  main.turbo-leaving,
  main.turbo-arriving {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
