/* =============================================================
   pw-ui.css — Print&Web UI library (Phase 3.1 Foundations)
   Surcouche additive : se charge APRÈS print_and_web.css.
   Toutes les classes sont préfixées `.pw-*` pour ne jamais
   entrer en collision avec le code legacy.
   Toutes les variables sont préfixées `--pw-*` (cohérent
   avec celles déjà déclarées dans print_and_web.css).
   ============================================================= */
/* -------------------------------------------------------------
   1. TOKENS — variables de base + extension
   ------------------------------------------------------------- */
 :root { 
/* Couleurs Print&Web (autonome — fonctionne sur les 4 sites
     même si le CSS principal du site ne les définit pas) */
 --pw-bg: #FFF; --pw-text: #111; --pw-muted: #666; --pw-accent: #019875; --pw-accent-600:#017c65; --pw-accent-800:#016c59; --pw-dark: #333; --pw-border: #E6E6E6; --pw-radius: 12px; --pw-shadow: 0 6px 16px #00000014; --pw-gap: 20px; --pw-gap-sm: 12px; --pw-max: 1200px; 
/* Couleurs sémantiques (états) */
 --pw-success: #16a34a; --pw-success-bg: #dcfce7; --pw-warning: #f59e0b; --pw-warning-bg: #fef3c7; --pw-danger: #dc2626; --pw-danger-bg: #fee2e2; --pw-info: #0284c7; --pw-info-bg: #e0f2fe; 
/* Échelle de gris (neutral) */
 --pw-neutral-50: #f8fafc; --pw-neutral-100: #f1f5f9; --pw-neutral-200: #e2e8f0; --pw-neutral-300: #cbd5e1; --pw-neutral-400: #94a3b8; --pw-neutral-500: #64748b; --pw-neutral-600: #475569; --pw-neutral-700: #334155; --pw-neutral-800: #1e293b; --pw-neutral-900: #0f172a; 
/* Espacements (échelle t-shirt) */
 --pw-space-xs: 4px; --pw-space-sm: 8px; --pw-space-md: 16px; --pw-space-lg: 24px; --pw-space-xl: 32px; --pw-space-2xl: 48px; 
/* Typographie */
 --pw-font-sans: 'Poppins', system-ui, -apple-system, sans-serif; --pw-text-xs: 12px; --pw-text-sm: 14px; --pw-text-base: 16px; --pw-text-lg: 18px; --pw-text-xl: 24px; --pw-leading-tight: 1.25; --pw-leading-normal: 1.5; 
/* Radius (en complément de --pw-radius existant = 12px) */
 --pw-radius-sm: 6px; --pw-radius-md: 10px; --pw-radius-lg: 16px; --pw-radius-full: 9999px; 
/* Shadows */
 --pw-shadow-sm: 0 1px 2px rgba(0, 0, 0, .06); --pw-shadow-md: 0 4px 12px rgba(0, 0, 0, .08); --pw-shadow-lg: 0 10px 30px rgba(0, 0, 0, .12); 
/* Transitions */
 --pw-duration-fast: 120ms; --pw-duration-normal: 200ms; --pw-duration-slow: 320ms; --pw-ease: cubic-bezier(.4, 0, .2, 1); 
/* Z-index ladder */
 --pw-z-dropdown: 100; --pw-z-sticky: 200; --pw-z-overlay: 500; --pw-z-modal: 600; --pw-z-toast: 700; }
/* -------------------------------------------------------------
   2. BASE — focus visible accessible (composants pw-* uniquement)
   ------------------------------------------------------------- */
 .pw-btn:focus-visible, .pw-input:focus-visible, .pw-select:focus-visible, .pw-textarea:focus-visible { outline: 2px solid var(--pw-accent); outline-offset: 2px; }
/* -------------------------------------------------------------
   3. BOUTONS  .pw-btn (+ variants + tailles + états)
   ------------------------------------------------------------- */
 .pw-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--pw-space-sm); padding: 10px 18px; font-family: var(--pw-font-sans); font-size: var(--pw-text-sm); font-weight: 600; line-height: 1.2; text-decoration: none; text-align: center; border: 1px solid transparent; border-radius: var(--pw-radius-md); background: transparent; color: var(--pw-text); cursor: pointer; transition: background var(--pw-duration-normal) var(--pw-ease), border-color var(--pw-duration-normal) var(--pw-ease), color var(--pw-duration-normal) var(--pw-ease), transform var(--pw-duration-fast) var(--pw-ease), box-shadow var(--pw-duration-normal) var(--pw-ease); -webkit-appearance: none; appearance: none; }
.pw-btn:hover { transform: translateY(-1px); }
.pw-btn:active { transform: translateY(0); }
.pw-btn:disabled, .pw-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
/* Variants */
 .pw-btn-primary { background: var(--pw-accent); color: #fff; box-shadow: var(--pw-shadow-sm); }
.pw-btn-primary:hover { background: var(--pw-accent-600); color: #fff; }
.pw-btn-primary:active { background: var(--pw-accent-800); }
.pw-btn-secondary { background: #fff; border-color: var(--pw-border); color: var(--pw-text); }
.pw-btn-secondary:hover { background: var(--pw-neutral-50); border-color: var(--pw-neutral-300); }
.pw-btn-ghost { background: transparent; color: var(--pw-text); }
.pw-btn-ghost:hover { background: var(--pw-neutral-100); }
.pw-btn-danger { background: var(--pw-danger); color: #fff; }
.pw-btn-danger:hover { background: #b91c1c; color: #fff; }
/* Tailles */
 .pw-btn-sm { padding: 6px 12px; font-size: var(--pw-text-xs); border-radius: var(--pw-radius-sm); }
.pw-btn-lg { padding: 14px 24px; font-size: var(--pw-text-base); }
.pw-btn-block { width: 100%; }
/* État loading (spinner). Le toggle JS arrive en 3.2. */
 .pw-btn.is-loading { pointer-events: none; position: relative; color: transparent !important; }
.pw-btn.is-loading::after { content: ''; position: absolute; width: 14px; height: 14px; top: calc(50% - 7px); left: calc(50% - 7px); border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; color: #fff; animation: pw-spin .7s linear infinite; }
.pw-btn-secondary.is-loading::after, .pw-btn-ghost.is-loading::after { color: var(--pw-text); }
@keyframes pw-spin { to { transform: rotate(360deg); } }
/* -------------------------------------------------------------
   4. CHAMPS  .pw-input / .pw-select / .pw-textarea
   ------------------------------------------------------------- */
 .pw-input, .pw-select, .pw-textarea { display: block; width: 100%; padding: 10px 14px; font-family: var(--pw-font-sans); font-size: var(--pw-text-sm); line-height: 1.4; color: var(--pw-text); background: #fff; border: 1px solid var(--pw-border); border-radius: var(--pw-radius-md); transition: border-color var(--pw-duration-normal) var(--pw-ease), box-shadow var(--pw-duration-normal) var(--pw-ease); -webkit-appearance: none; appearance: none; box-sizing: border-box; }
.pw-input::placeholder, .pw-textarea::placeholder { color: var(--pw-neutral-400); }
.pw-input:focus, .pw-select:focus, .pw-textarea:focus { border-color: var(--pw-accent); box-shadow: 0 0 0 3px rgba(1, 152, 117, .15); outline: none; }
.pw-input:disabled, .pw-select:disabled, .pw-textarea:disabled { background: var(--pw-neutral-100); color: var(--pw-neutral-500); cursor: not-allowed; }
.pw-input.is-error, .pw-select.is-error, .pw-textarea.is-error { border-color: var(--pw-danger); }
.pw-input.is-error:focus, .pw-select.is-error:focus, .pw-textarea.is-error:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.pw-input.is-success, .pw-select.is-success, .pw-textarea.is-success { border-color: var(--pw-success); }
.pw-textarea { min-height: 96px; resize: vertical; }
.pw-select { background-image: linear-gradient( 45deg, transparent 50%, var(--pw-neutral-500) 50%), linear-gradient(-45deg, transparent 50%, var(--pw-neutral-500) 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.pw-label { display: block; font-size: var(--pw-text-sm); font-weight: 600; color: var(--pw-text); margin-bottom: var(--pw-space-xs); }
.pw-helper { margin-top: var(--pw-space-xs); font-size: var(--pw-text-xs); color: var(--pw-muted); }
.pw-helper.is-error { color: var(--pw-danger); }
/* Input group (icône préfixe / suffixe) */
 .pw-input-group { position: relative; }
.pw-input-group .pw-input { padding-left: 40px; }
.pw-input-group .pw-input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--pw-neutral-400); pointer-events: none; }
.pw-input-group.has-suffix .pw-input { padding-left: 14px; padding-right: 40px; }
.pw-input-group.has-suffix .pw-input-icon { left: auto; right: 14px; }
/* -------------------------------------------------------------
   5. CARDS  .pw-card
   ------------------------------------------------------------- */
 .pw-card { background: #fff; border: 1px solid var(--pw-border); border-radius: var(--pw-radius); box-shadow: var(--pw-shadow-sm); overflow: hidden; }
.pw-card-header, .pw-card-body, .pw-card-footer { padding: var(--pw-space-md); }
.pw-card-header { border-bottom: 1px solid var(--pw-border); font-weight: 600; }
.pw-card-footer { border-top: 1px solid var(--pw-border); background: var(--pw-neutral-50); }
.pw-card-hover { transition: transform var(--pw-duration-normal) var(--pw-ease), box-shadow var(--pw-duration-normal) var(--pw-ease); }
.pw-card-hover:hover { transform: translateY(-2px); box-shadow: var(--pw-shadow-md); }
/* -------------------------------------------------------------
   6. ALERTS  .pw-alert (info / success / warning / danger)
   ------------------------------------------------------------- */
 .pw-alert { display: flex; align-items: flex-start; gap: var(--pw-space-sm); padding: 12px 16px; border-radius: var(--pw-radius-md); border: 1px solid transparent; font-size: var(--pw-text-sm); line-height: var(--pw-leading-normal); }
.pw-alert-icon { flex-shrink: 0; margin-top: 2px; font-size: 16px; }
.pw-alert-body { flex: 1; }
.pw-alert-title { font-weight: 600; margin: 0 0 2px 0; }
.pw-alert-info { background: var(--pw-info-bg); color: #075985; border-color: #bae6fd; }
.pw-alert-success { background: var(--pw-success-bg); color: #166534; border-color: #bbf7d0; }
.pw-alert-warning { background: var(--pw-warning-bg); color: #92400e; border-color: #fde68a; }
.pw-alert-danger { background: var(--pw-danger-bg); color: #991b1b; border-color: #fecaca; }
/* -------------------------------------------------------------
   7. TOASTS  .pw-toast (le contrôle JS arrive en 3.2)
   ------------------------------------------------------------- */
 .pw-toast-container { position: fixed; top: 24px; right: 24px; z-index: var(--pw-z-toast); display: flex; flex-direction: column; gap: var(--pw-space-sm); pointer-events: none; }
.pw-toast { display: flex; align-items: flex-start; gap: var(--pw-space-sm); min-width: 280px; max-width: 420px; padding: 12px 16px; background: #fff; border: 1px solid var(--pw-border); border-left: 4px solid var(--pw-accent); border-radius: var(--pw-radius-md); box-shadow: var(--pw-shadow-lg); font-size: var(--pw-text-sm); pointer-events: auto; animation: pw-toast-in var(--pw-duration-normal) var(--pw-ease); }
.pw-toast.is-leaving { animation: pw-toast-out var(--pw-duration-normal) var(--pw-ease) forwards; }
.pw-toast-success { border-left-color: var(--pw-success); }
.pw-toast-warning { border-left-color: var(--pw-warning); }
.pw-toast-danger { border-left-color: var(--pw-danger); }
.pw-toast-info { border-left-color: var(--pw-info); }
.pw-toast-icon { flex-shrink: 0; }
.pw-toast-body { flex: 1; }
.pw-toast-close { background: none; border: 0; cursor: pointer; color: var(--pw-muted); font-size: 18px; line-height: 1; padding: 0; }
@keyframes pw-toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pw-toast-out { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }
@media (max-width: 640px) { .pw-toast-container { top: 12px; left: 12px; right: 12px; } .pw-toast { min-width: 0; max-width: none; } }
/* -------------------------------------------------------------
   8. MODALS  .pw-modal (le contrôle JS arrive en 3.2)
   ------------------------------------------------------------- */
 .pw-modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: var(--pw-z-overlay); display: none; align-items: center; justify-content: center; padding: var(--pw-space-md); animation: pw-fade-in var(--pw-duration-normal) var(--pw-ease); }
.pw-modal-overlay.is-open { display: flex; }
.pw-modal { background: #fff; border-radius: var(--pw-radius-lg); box-shadow: var(--pw-shadow-lg); max-width: 560px; width: 100%; max-height: calc(100vh - 48px); display: flex; flex-direction: column; z-index: var(--pw-z-modal); animation: pw-modal-in var(--pw-duration-normal) var(--pw-ease); }
.pw-modal-header { display: flex; align-items: center; justify-content: space-between; gap: var(--pw-space-sm); padding: var(--pw-space-md) var(--pw-space-lg); border-bottom: 1px solid var(--pw-border); }
.pw-modal-title { font-size: var(--pw-text-lg); font-weight: 600; margin: 0; }
.pw-modal-close { background: none; border: 0; cursor: pointer; color: var(--pw-muted); font-size: 22px; line-height: 1; padding: 4px; border-radius: var(--pw-radius-sm); }
.pw-modal-close:hover { background: var(--pw-neutral-100); }
.pw-modal-body { padding: var(--pw-space-lg); overflow-y: auto; flex: 1; }
.pw-modal-footer { display: flex; gap: var(--pw-space-sm); justify-content: flex-end; padding: var(--pw-space-md) var(--pw-space-lg); border-top: 1px solid var(--pw-border); }
@keyframes pw-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pw-modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 640px) { .pw-modal-header, .pw-modal-body, .pw-modal-footer { padding-left: var(--pw-space-md); padding-right: var(--pw-space-md); } .pw-modal-footer { flex-direction: column-reverse; } .pw-modal-footer .pw-btn { width: 100%; } }
/* -------------------------------------------------------------
   9. UTILITIES — strict minimum, préfixées .pw-u-*
   ------------------------------------------------------------- */
 .pw-u-flex { display: flex; }
.pw-u-flex-col { display: flex; flex-direction: column; }
.pw-u-grid { display: grid; }
.pw-u-items-center { align-items: center; }
.pw-u-justify-center { justify-content: center; }
.pw-u-justify-between { justify-content: space-between; }
.pw-u-gap-xs { gap: var(--pw-space-xs); }
.pw-u-gap-sm { gap: var(--pw-space-sm); }
.pw-u-gap-md { gap: var(--pw-space-md); }
.pw-u-gap-lg { gap: var(--pw-space-lg); }
.pw-u-stack-xs > * + * { margin-top: var(--pw-space-xs); }
.pw-u-stack-sm > * + * { margin-top: var(--pw-space-sm); }
.pw-u-stack-md > * + * { margin-top: var(--pw-space-md); }
.pw-u-stack-lg > * + * { margin-top: var(--pw-space-lg); }
.pw-u-text-center { text-align: center; }
.pw-u-text-right { text-align: right; }
.pw-u-text-muted { color: var(--pw-muted); }
.pw-u-text-xs { font-size: var(--pw-text-xs); }
.pw-u-text-sm { font-size: var(--pw-text-sm); }
.pw-u-text-lg { font-size: var(--pw-text-lg); }
.pw-u-text-bold { font-weight: 600; }
.pw-u-hidden { display: none !important; }
/* sr-only — masque visuellement, lisible par screen readers */
 .pw-u-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 640px) { .pw-u-hidden-mobile { display: none !important; } }
@media (min-width: 641px) { .pw-u-hidden-desktop { display: none !important; } }
/* -------------------------------------------------------------
   10. TABS — anti-flash avant init JS (drop-in easytabs)
   ------------------------------------------------------------- */
/* Avant que pw-ui.js tourne, cacher tous les panels sauf le 1er
   (ou celui qui a .active si déjà marqué dans le HTML).
   Une fois initTabs() exécuté, container reçoit data-pw-tabs-init="1"
   et le JS gère la visibilité via l'attribut natif [hidden]. */
 .tab-container:not([data-pw-tabs-init="1"]) .panel-container > *:not(:first-child):not(.active) { display: none; }
/* Focus visible accessibilité sur les onglets actifs */
 .tab-container ul.etabs > li.tab > a:focus-visible { outline: 2px solid var(--pw-accent); outline-offset: 2px; border-radius: var(--pw-radius-sm); }
/* fin pw-ui.css */
