/* UDCShare v2 — composants. Toute cible tactile mesure au moins var(--size-tap) (48 px). */

/* ── Boutons ── */
.v2-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--size-tap); padding: var(--space-2) var(--space-5);
  border: 2px solid transparent; border-radius: var(--radius-md);
  font: inherit; font-weight: var(--font-weight-bold); text-decoration: none; cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast);
}
.v2-btn--primary { background: var(--color-brand-strong); color: var(--color-on-brand); }
.v2-btn--primary:hover { filter: brightness(1.08); }
.v2-btn--secondary { background: var(--color-surface); color: var(--color-link); border-color: var(--color-border-strong); }
.v2-btn--ghost { background: transparent; color: var(--color-link); }
.v2-btn--danger { background: var(--color-surface); color: var(--color-danger); border-color: var(--color-danger); }
.v2-btn--block { width: 100%; }
.v2-btn[disabled], .v2-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* ── En-tête ── */
.v2-header { position: sticky; top: 0; z-index: 20; background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.v2-header__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 64px; }
.v2-header__brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--size-tap); color: var(--color-text); font-weight: var(--font-weight-bold); font-size: var(--font-size-lg); text-decoration: none; }
.v2-header__brand-mark { display: inline-flex; align-items: center; gap: 8px; }
.v2-header__nav { display: none; }
.v2-header__nav a { display: inline-flex; align-items: center; min-height: var(--size-tap); padding-inline: var(--space-3); color: var(--color-text); text-decoration: none; font-weight: var(--font-weight-medium); }
.v2-header__nav a[aria-current="page"] { color: var(--color-link); text-decoration: underline; }
.v2-header__actions { display: none; gap: var(--space-2); }
.v2-header__toggle { display: inline-flex; align-items: center; justify-content: center; width: var(--size-tap); height: var(--size-tap); border: 0; background: transparent; color: var(--color-text); cursor: pointer; border-radius: var(--radius-md); }
.v2-header__menu { border-top: 1px solid var(--color-border); padding-block: var(--space-2); }
.v2-header__menu[hidden] { display: none; }
/* Compte dans le menu mobile : identité + déconnexion (connecté), connexion + inscription (invité). */
.v2-header__account { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.v2-header__who { display: flex; align-items: center; gap: var(--space-2); margin: 0; min-height: var(--size-tap); color: var(--color-text); font-weight: var(--font-weight-bold); }
.v2-header__who svg, .v2-header__logout svg, .v2-header__cta svg { flex: none; width: 20px; height: 20px; }
.v2-header__who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v2-header__menu a.v2-header__logout, .v2-header__menu a.v2-header__cta {
  justify-content: center; gap: var(--space-2); padding-inline: var(--space-4); border: 2px solid var(--color-border-strong); border-radius: var(--radius-md); font-weight: var(--font-weight-bold);
}
.v2-header__menu a.v2-header__logout { color: var(--color-danger); border-color: var(--color-danger); }
.v2-header__menu a.v2-header__cta--secondary { color: var(--color-link); }
.v2-header__menu a.v2-header__cta--primary { background: var(--color-brand-strong); border-color: var(--color-brand-strong); color: var(--color-on-brand); }
.v2-header__menu a { display: flex; align-items: center; min-height: var(--size-tap); color: var(--color-text); text-decoration: none; font-weight: var(--font-weight-medium); }
@media (min-width: 64rem) {
  .v2-header__nav, .v2-header__actions { display: flex; align-items: center; }
  .v2-header__toggle, .v2-header__menu { display: none !important; }
}

/* ── Barre basse (tableau de bord, mobile) ── */
.v2-bottom-nav { position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--color-surface); border-top: 1px solid var(--color-border); padding-bottom: env(safe-area-inset-bottom); }
.v2-bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; color: var(--color-text-muted); text-decoration: none; font-size: var(--font-size-xs); }
.v2-bottom-nav a[aria-current="page"] { color: var(--color-link); font-weight: var(--font-weight-bold); }
@media (min-width: 64rem) { .v2-bottom-nav { position: static; display: flex; flex-direction: column; width: 14rem; border: 0; border-right: 1px solid var(--color-border); } .v2-bottom-nav a { flex-direction: row; justify-content: flex-start; padding-inline: var(--space-4); font-size: var(--font-size-base); gap: var(--space-3); } }

/* ── Pied de page ── */
/* Pied de page : même style que l'accueil (views/partials/footer.ejs) — titres discrets en capitales, liens sobres. */
.v2-footer { margin-top: var(--space-7); padding-block: var(--space-6); background: var(--color-surface-2); color: var(--color-text); font-size: var(--font-size-sm); border-top: 1px solid var(--color-border); }
.v2-footer__grid { display: grid; gap: var(--space-5) var(--space-4); grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); }
.v2-footer__brand { grid-column: 1 / -1; }
.v2-footer__brand p { margin: var(--space-2) 0 0; color: var(--color-text-muted); line-height: 1.6; max-width: 32rem; }
.v2-footer__logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--color-text); font-size: 18px; }
@media (min-width: 48rem) { .v2-footer__grid { grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--space-6); } .v2-footer__brand { grid-column: auto; } }
.v2-footer h2 { margin: 0 0 var(--space-3); font-size: 12px; font-weight: var(--font-weight-bold); text-transform: uppercase; letter-spacing: 1px; color: var(--color-text-muted); }
.v2-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.v2-footer li a { display: inline-flex; align-items: center; min-height: 36px; color: var(--color-text-muted); text-decoration: none; }
.v2-footer li a:hover, .v2-footer li a:focus-visible { color: var(--color-text); }
.v2-footer__legal { margin: var(--space-5) 0 0; padding-top: var(--space-4); border-top: 1px solid var(--color-border); color: var(--color-text-muted); font-size: var(--font-size-xs); }
/* Logo unique (views/v2/partials/logo.ejs) */
.udc-logo-mark { flex: 0 0 auto; color: var(--color-brand); }
.udc-logo-name { font-weight: 800; letter-spacing: -0.4px; white-space: nowrap; color: var(--color-text); }
.udc-logo-name em { font-style: normal; color: var(--color-link); }

/* ── Cartes ── */
.v2-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.v2-card__title { font-size: var(--font-size-lg); margin-bottom: var(--space-2); }
.v2-grid { display: grid; gap: var(--space-4); }
@media (min-width: 48rem) { .v2-grid--2 { grid-template-columns: repeat(2, 1fr); } .v2-grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .v2-grid--4 { grid-template-columns: repeat(4, 1fr); } }

/* ── Champs ── */
.v2-field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.v2-field label { font-weight: var(--font-weight-medium); }
.v2-field__hint { font-size: var(--font-size-sm); color: var(--color-text-muted); }
.v2-field__error { font-size: var(--font-size-sm); color: var(--color-danger); font-weight: var(--font-weight-medium); }
.v2-input, .v2-select, .v2-textarea {
  width: 100%; min-height: var(--size-tap); padding: var(--space-2) var(--space-3);
  font: inherit; font-size: var(--font-size-base); /* 16 px : pas de zoom automatique sur iOS */
  color: var(--color-text); background: var(--color-surface);
  border: 2px solid var(--color-border-strong); border-radius: var(--radius-md);
}
.v2-input[aria-invalid="true"] { border-color: var(--color-danger); }
.v2-check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--size-tap); }
.v2-check input { flex-shrink: 0; width: 24px; height: 24px; accent-color: var(--color-brand-strong); }
/* Lien seul sur sa ligne (hors paragraphe) : zone de toucher de 44 px, comme un bouton. */
.v2-card > a:not(.v2-btn) { display: inline-flex; align-items: center; min-height: var(--size-tap); }

/* ── Onglets ── */
.v2-tabs__list { display: flex; gap: var(--space-1); border-bottom: 2px solid var(--color-border); overflow-x: auto; }
.v2-tabs__tab { min-height: var(--size-tap); padding-inline: var(--space-4); border: 0; background: transparent; color: var(--color-text-muted); font: inherit; font-weight: var(--font-weight-medium); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.v2-tabs__tab[aria-selected="true"] { color: var(--color-link); border-bottom-color: var(--color-brand-strong); }
.v2-tabs__panel { padding-top: var(--space-4); }
.v2-tabs__panel[hidden] { display: none; }

/* ── Feuille modale (bas d'écran sur mobile, centrée sur grand écran) ── */
.v2-sheet { border: 0; padding: 0; width: 100%; max-width: 32rem; margin: auto auto 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-md); }
.v2-sheet::backdrop { background: var(--color-overlay); }
.v2-sheet__head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--color-border); }
.v2-sheet__head h2 { margin: 0; font-size: var(--font-size-lg); }
.v2-sheet__body { padding: var(--space-5); }
@media (min-width: 48rem) { .v2-sheet { margin: auto; border-radius: var(--radius-lg); } }

/* ── Notifications ── */
.v2-toast-region { position: fixed; z-index: 50; left: var(--space-4); right: var(--space-4); bottom: calc(var(--space-4) + 56px); display: flex; flex-direction: column; gap: var(--space-2); pointer-events: none; }
@media (min-width: 48rem) { .v2-toast-region { left: auto; width: 24rem; bottom: var(--space-4); } }
.v2-toast, .v2-alert { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); pointer-events: auto; }
.v2-toast { box-shadow: var(--shadow-md); }
.v2-alert--success, .v2-toast--success { background: var(--color-success-soft); border-color: var(--color-success); }
.v2-alert--warning, .v2-toast--warning { background: var(--color-warning-soft); border-color: var(--color-warning); }
.v2-alert--danger, .v2-toast--danger { background: var(--color-danger-soft); border-color: var(--color-danger); }
.v2-alert--success .v2-alert__title { color: var(--color-success); }
.v2-alert--warning .v2-alert__title { color: var(--color-warning); }
.v2-alert--danger .v2-alert__title { color: var(--color-danger); }
.v2-alert__title { font-weight: var(--font-weight-bold); margin: 0 0 var(--space-1); }
.v2-alert p { margin: 0; }

/* ── Barre de progression ── */
.v2-progress { display: flex; flex-direction: column; gap: var(--space-1); }
.v2-progress__track { height: 10px; border-radius: var(--radius-pill); background: var(--color-surface-2); border: 1px solid var(--color-border); overflow: hidden; }
.v2-progress__bar { height: 100%; width: 0; background: var(--color-brand-strong); transition: width var(--motion-base); }
.v2-progress__label { display: flex; justify-content: space-between; font-size: var(--font-size-sm); color: var(--color-text-muted); }

/* ── Carte de forfait ── */
.v2-plan { display: flex; flex-direction: column; gap: var(--space-3); }
.v2-plan__price { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--space-2); margin: 0; font-size: var(--font-size-2xl); font-weight: var(--font-weight-bold); }
.v2-plan__price small { white-space: nowrap; }
.v2-plan__price small { font-size: var(--font-size-sm); font-weight: var(--font-weight-regular); color: var(--color-text-muted); }
.v2-plan__list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.v2-plan__list li { display: flex; gap: var(--space-2); }
.v2-plan__list .is-off { color: var(--color-text-muted); }
.v2-plan .v2-btn { margin-top: auto; }

/* ── États vide / erreur ── */
.v2-state { text-align: center; padding: var(--space-6) var(--space-4); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.v2-state__icon { width: 56px; height: 56px; color: var(--color-text-muted); }
.v2-state--error .v2-state__icon { color: var(--color-danger); }

/* ── Bandeau cookies ── */
/* Bandeau cookies : carte sombre arrondie en bas d'écran (couleurs « inverse » de design/tokens.json). */
.v2-cookie { position: fixed; z-index: 40; inset: auto var(--space-2) var(--space-2) var(--space-2); max-width: 30rem; max-height: calc(100dvh - var(--space-4)); overflow-y: auto; margin-inline: auto; padding: var(--space-5); font-size: var(--font-size-sm); background: var(--color-inverse-surface); color: var(--color-inverse-text); border-radius: 24px; box-shadow: var(--shadow-md); }
@media (min-width: 48rem) { .v2-cookie { inset: auto auto var(--space-4) var(--space-4); margin: 0; } }
.v2-cookie[hidden] { display: none; }
.v2-cookie :focus-visible { outline-color: var(--color-inverse-focus); }
.v2-cookie__head { display: flex; align-items: center; gap: var(--space-3); }
.v2-cookie__icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--color-inverse-surface-2); color: var(--color-inverse-link); }
.v2-cookie h2 { margin: 0; font-size: var(--font-size-lg); font-weight: var(--font-weight-bold); color: var(--color-inverse-text); }
.v2-cookie__text { margin: var(--space-3) 0 0; color: var(--color-inverse-text-muted); }
.v2-cookie a { color: var(--color-inverse-link); text-decoration: underline; text-underline-offset: 2px; }
.v2-cookie__panel { display: grid; gap: var(--space-2); margin: var(--space-4) 0 0; padding: 0; border: 0; }
.v2-cookie__panel[hidden] { display: none; }
.v2-cookie__category { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--color-inverse-surface-2); }
.v2-cookie__category h3 { margin: 0; font-size: var(--font-size-base); color: var(--color-inverse-text); }
.v2-cookie__category p { margin: var(--space-1) 0 0; font-size: var(--font-size-xs); color: var(--color-inverse-text-muted); }
.v2-cookie__switch { appearance: none; flex-shrink: 0; position: relative; width: 48px; height: 28px; margin: 0; border-radius: var(--radius-pill); background: var(--color-border-strong); cursor: pointer; transition: background var(--motion-fast); }
.v2-cookie__switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--color-inverse-text); transition: transform var(--motion-fast); }
.v2-cookie__switch:checked { background: var(--color-brand-strong); }
.v2-cookie__switch:checked::after { transform: translateX(20px); }
.v2-cookie__switch:disabled { cursor: not-allowed; opacity: 0.75; }
.v2-cookie__actions { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
.v2-cookie__btn { min-height: var(--size-tap); width: 100%; padding: var(--space-2) var(--space-4); border: 0; border-radius: var(--radius-pill); font: inherit; font-size: var(--font-size-base); font-weight: var(--font-weight-bold); cursor: pointer; }
.v2-cookie__btn[hidden] { display: none; }
.v2-cookie__btn--refuse { background: var(--color-inverse-surface-2); color: var(--color-inverse-text); }
.v2-cookie__btn--link { background: transparent; color: var(--color-inverse-link); }
.v2-cookie__btn--accept { background: var(--color-brand-strong); color: var(--color-on-brand); }
.v2-cookie__btn--refuse:hover, .v2-cookie__btn--link:hover { text-decoration: underline; }
.v2-cookie__btn--accept:hover { filter: brightness(1.08); }
@media (prefers-reduced-motion: reduce) { .v2-cookie__switch, .v2-cookie__switch::after { transition: none; } }
/* Téléphone : bandeau compact (une carte basse, deux boutons côte à côte) au lieu d'une moitié d'écran. */
@media (max-width: 47.99rem) {
  .v2-cookie { padding: var(--space-4); border-radius: var(--radius-lg); }
  .v2-cookie__icon { display: none; }
  .v2-cookie h2 { font-size: var(--font-size-base); }
  .v2-cookie__text { margin-top: var(--space-1); font-size: var(--font-size-xs); }
  .v2-cookie__actions { grid-template-columns: 1fr 1fr; margin-top: var(--space-3); }
  .v2-cookie__btn { min-height: 44px; font-size: var(--font-size-sm); }
  .v2-cookie__btn--link { grid-column: 1 / -1; grid-row: 2; min-height: 36px; }
}
/* La bulle de discussion ne recouvre pas le bandeau tant qu'aucun choix n'est fait. */
body:has(.v2-cookie:not([hidden])) #chat-widget-toggle { display: none; }

/* ── Badge ── */
.v2-badge { display: inline-flex; align-items: center; padding: 2px var(--space-2); border-radius: var(--radius-pill); background: var(--color-brand-soft); color: var(--color-text); font-size: var(--font-size-xs); font-weight: var(--font-weight-bold); }

/* ── Galerie /_ui (page interne) ── */
.v2-gallery__theme { padding: var(--space-5) var(--space-4); background: var(--color-bg); color: var(--color-text); border-radius: var(--radius-lg); border: 1px solid var(--color-border); }
.v2-gallery__row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.v2-gallery__block + .v2-gallery__block, .v2-grid + .v2-gallery__block { margin-top: var(--space-6); }
.v2-bottom-nav--demo { position: static; }

/* Phrase rassurante (« le destinataire n'a pas besoin de compte »), avec coche. */
.v2-reassure { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-3) 0 0; font-size: var(--font-size-sm); color: var(--color-success); font-weight: var(--font-weight-medium); }
.v2-reassure svg { width: 20px; height: 20px; }

/* ── Sections communes aux pages publiques (déplacées de home.css au J4) ── */
.v2-hero { padding-block: var(--space-3) var(--space-6); }
.v2-hero h1 { font-size: var(--font-size-xl); margin-bottom: var(--space-1); }
.v2-hero__lead { color: var(--color-text-muted); margin-bottom: var(--space-3); }
@media (min-width: 48rem) {
  .v2-hero { padding-block: var(--space-7); }
  .v2-hero h1 { font-size: var(--font-size-3xl); }
  .v2-hero__lead { font-size: var(--font-size-lg); max-width: 40rem; }
}
.v2-alert--info { background: var(--color-surface-2); }
/* Volets repliables (options d'envoi, import Drive, questions). */
.v2-fold { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); margin-top: var(--space-3); }
.v2-fold > summary { min-height: var(--size-tap); padding: var(--space-3) var(--space-4); cursor: pointer; font-weight: var(--font-weight-medium); list-style-position: inside; }
.v2-fold__hint { display: block; font-weight: var(--font-weight-regular); font-size: var(--font-size-sm); }
.v2-fold__body { padding: 0 var(--space-4) var(--space-4); }
.v2-fold[open] > summary { border-bottom: 1px solid var(--color-border); margin-bottom: var(--space-3); }
/* Étapes numérotées */
.v2-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-4); counter-reset: v2-step; }
.v2-steps__item { counter-increment: v2-step; position: relative; padding-left: var(--space-7); }
.v2-steps__item::before {
  content: counter(v2-step); position: absolute; left: 0; top: 0; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--color-brand-strong); color: var(--color-on-brand); font-weight: var(--font-weight-bold);
}
.v2-steps__item h3 { font-size: var(--font-size-base); margin-bottom: var(--space-1); }
.v2-steps__item p { margin: 0; }
@media (min-width: 48rem) { .v2-steps { grid-template-columns: repeat(4, 1fr); } .v2-grid--3 { grid-template-columns: repeat(3, 1fr); } }
.v2-grid--3 .v2-card p { margin: 0; }
.v2-cta { text-align: center; }

/* ── « Faites passer le message » (au-dessus du pied de page) ── */
.v2-share-site { margin-top: var(--space-7); padding-block: var(--space-6); text-align: center; border-top: 1px solid var(--color-border); }
.v2-share-site h2 { font-size: var(--font-size-lg); }
.v2-share-site__list { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.v2-share-site + .v2-footer { margin-top: 0; }

/* Bouton de thème (public/v2/js/theme.js) : Auto, Clair, Sombre */
.udc-theme-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface); color: var(--color-text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.udc-theme-toggle:hover { background: var(--color-surface-2); }
.udc-theme-toggle:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.udc-theme-toggle[hidden] { display: none; }
.udc-theme-toggle--floating { position: fixed; left: 12px; bottom: 12px; z-index: 400; box-shadow: var(--shadow-sm); }
.v2-header__bar > .udc-theme-toggle { margin-left: auto; }
@media (min-width: 64rem) {
  .v2-header__nav { margin-inline: auto; }
  .v2-header__bar > .udc-theme-toggle { order: 3; margin-left: 0; }
  .v2-header__actions { order: 4; }
}
/* Téléphone : le bouton de thème garde son icône seule (nom lu par aria-label) et ne colle plus au nom UDCShare. */
@media (max-width: 599px) {
  .udc-theme-toggle:not(.udc-theme-toggle--floating) { width: 44px; padding: 0; justify-content: center; flex: 0 0 44px; }
  .udc-theme-toggle:not(.udc-theme-toggle--floating) .udc-theme-toggle__text { display: none; }
}
