/* ============================================================================
   VNCT Modals + signalement — Subset du Design System pour Quasar
   Quasar a son propre CSS complet, on ne charge que les composants VNCT nécessaires.

   Le nom du fichier est historique : il portait le FAB, retiré depuis. Il
   est CONSERVÉ tel quel : dashboard/index.html et l'APP_SHELL du service worker
   le référencent, et un renommage y ferait un 404 (page de connexion sans style
   de modale, mise en cache du shell en échec).

   Ce que ce fichier porte encore : les modales du design system (dont vit le
   pop-up des nouveautés), les champs de formulaire et d'upload, les toasts, le
   badge de version, et le bouton drapeau de signalement.
   ============================================================================ */

/* Variables nécessaires aux composants ci-dessous */
:root {
  --accent-h: 330;
  --accent-s: 90%;
  --accent-l: 60%;
  --accent: hsl(var(--accent-h), var(--accent-s), var(--accent-l));
  --neon-shadow-sm: 0 0 6px hsla(var(--accent-h), var(--accent-s), 60%, 0.4);
  --neon-shadow-md: 0 0 12px hsla(var(--accent-h), var(--accent-s), 60%, 0.5),
                    0 0 24px hsla(var(--accent-h), var(--accent-s), 60%, 0.2);
  --neon-shadow-lg: 0 0 16px hsla(var(--accent-h), var(--accent-s), 60%, 0.6),
                    0 0 32px hsla(var(--accent-h), var(--accent-s), 60%, 0.3),
                    0 0 64px hsla(var(--accent-h), var(--accent-s), 60%, 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.563rem;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --leading-relaxed: 1.7;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
}

/* Accent cyan en mode clair — override global */
[data-theme="light"] {
  --accent-h: 185; --accent-s: 80%; --accent-l: 45%;
  --accent: hsl(185, 80%, 45%);
  --neon-shadow-sm: 0 0 6px hsla(185, 80%, 45%, 0.4);
  --neon-shadow-md: 0 0 12px hsla(185, 80%, 45%, 0.5), 0 0 24px hsla(185, 80%, 45%, 0.2);
  --neon-shadow-lg: 0 0 16px hsla(185, 80%, 45%, 0.6), 0 0 32px hsla(185, 80%, 45%, 0.3);
}
[data-theme="light"] .vnct-modal-overlay {
  --text-primary: #1a1a2e; --text-secondary: rgba(0,0,0,.55); --text-muted: rgba(0,0,0,.35);
  --bg-secondary: #ffffff; --bg-tertiary: #f0f0f4; --border-default: rgba(0,0,0,.1);
  --surface-hover: rgba(0,0,0,.04);
}
[data-theme="light"] .vnct-modal,
[data-theme="light"] .modal {
  border-color: hsl(185, 80%, 45%);
  box-shadow: 0 0 16px hsla(185, 80%, 45%, 0.3);
}
[data-theme="light"] .vnct-btn--primary,
[data-theme="light"] .modal .btn-primary {
  background: hsl(185, 80%, 45%); border-color: hsl(185, 80%, 45%); color: #fff;
}
/* Quasar utilise ses propres variables de couleur */
.vnct-modal-overlay { --bg-secondary: #12121a; --border-default: rgba(255, 255, 255, 0.08); --text-primary: #f0f0f5; --text-secondary: #a0a0b5; --text-muted: #606075; --bg-tertiary: #1a1a28; --surface-hover: rgba(255, 255, 255, 0.05); }
/* Le badge de version figeait ici ses couleurs en dur (--text-muted: #606075 en
   sombre, color: #9090a5 en clair), ce qui doublait les tokens du design system
   déjà chargé sur les deux pages. Retiré : il suit maintenant --text-secondary
   et --text-muted, qui se déclinent seuls en sombre et en clair. */

/* Modal */
.vnct-modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  animation: vnct-fade-in var(--duration-fast) ease;
}
.vnct-modal-overlay[aria-hidden="true"],
.vnct-modal-overlay.vnct-modal-overlay--closing { animation: vnct-fade-out var(--duration-fast) ease forwards; }

.vnct-modal {
  background: var(--bg-secondary); border: 1.5px solid var(--accent);
  border-radius: var(--radius-xl); padding: var(--space-8);
  max-width: 500px; width: 90%; max-height: 85vh; overflow-y: auto;
  animation: vnct-scale-in var(--duration-normal) var(--ease-spring);
  box-shadow: var(--neon-shadow-lg);
}
.vnct-modal__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-6); }
.vnct-modal__title { font-size: var(--text-xl); font-weight: var(--font-semibold); color: var(--text-primary); }
.vnct-modal__close {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-secondary); cursor: pointer;
  border-radius: var(--radius-sm); font-size: var(--text-lg);
}
.vnct-modal__close:hover { color: var(--text-primary); background: var(--surface-hover); }
.vnct-modal__body { font-size: var(--text-base); color: var(--text-primary); line-height: 1.5; }

/* Mobile modal */
@media (max-width: 768px) {
  .vnct-modal-overlay { align-items: center; padding: var(--space-4); }
  .vnct-modal { width: 90%; max-height: 80vh; border-radius: var(--radius-xl); padding: var(--space-6); font-size: var(--text-sm); }
  .vnct-modal__title { font-size: var(--text-lg); }
  .vnct-modal__body { font-size: var(--text-sm); }
  .vnct-modal__body h4 { font-size: var(--text-base); }
  .vnct-modal__body p { font-size: var(--text-sm); }
}

/* ============================================================================
   Bouton drapeau de signalement — remplace le FAB rond, retiré du dashboard.

   Même emplacement que lui (flottant, en bas à droite), mais une seule action :
   ouvrir la modale de signalement. Le SVG est celui du drapeau du chrome de la
   vitrine, pour que les deux surfaces se ressemblent vraiment.

   Pastille iconique : dérogation actée à la règle « texte explicite > icône
   seule », comme sur les headers de Prisma et de Maât. Le libellé est porté par
   title + aria-label sur le bouton.

   Aucune couleur en dur : tout vient des tokens, donc les thèmes sombre et
   clair suivent sans règle dédiée.
   ============================================================================ */
.vnct-report-fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  /* Volontairement SOUS .vnct-modal-overlay (1000) et sous .modal-overlay de
     style.css (9500) : une modale ouverte doit recouvrir le drapeau, jamais
     l'inverse. Reprend le z-index qu'avait le FAB. */
  z-index: 900;
  /* 44px = cible tactile minimale. Plus discret que les 56px du FAB, qui
     mordait sur les actions de bas de page. */
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--duration-normal) ease,
              border-color var(--duration-normal) ease,
              box-shadow var(--duration-normal) ease,
              transform var(--duration-normal) ease;
}
.vnct-report-fab:hover,
.vnct-report-fab:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--neon-shadow-sm);
}
.vnct-report-fab:active { transform: scale(0.94); }

@media (max-width: 768px) {
  /* Barre d'accueil iOS : sans ça, le drapeau tombe dessous. */
  .vnct-report-fab { bottom: calc(var(--space-6) + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .vnct-report-fab { transition: none; }
  .vnct-report-fab:active { transform: none; }
}

/* ============================================================================
   Modale unifiée de signalement — écran de choix puis formulaire
   ============================================================================ */
.vnct-feedback-intro {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.vnct-feedback-choices { display: flex; flex-direction: column; gap: var(--space-3); }
.vnct-feedback-choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  text-align: left;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  cursor: pointer;
  transition: border-color var(--duration-normal) ease, box-shadow var(--duration-normal) ease;
}
.vnct-feedback-choice:hover,
.vnct-feedback-choice:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--neon-shadow-sm);
}
.vnct-feedback-choice__icon { flex-shrink: 0; font-size: var(--text-lg); line-height: 1.2; }
.vnct-feedback-choice__text {
  /* Sans ça, un libellé long pousserait la carte hors de la modale. */
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.vnct-feedback-choice__title { font-size: var(--text-base); font-weight: var(--font-semibold); color: var(--text-primary); }
.vnct-feedback-choice__desc { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.4; }

.vnct-feedback-actions {
  margin-top: var(--space-6);
  display: flex;
  /* « Retour » à gauche, « Envoyer » à droite : le retour arrière n'est pas une
     action de validation, il ne doit pas se ramasser à côté du bouton d'envoi. */
  justify-content: space-between;
  gap: var(--space-3);
}
@media (prefers-reduced-motion: reduce) {
  .vnct-feedback-choice { transition: none; }
}

/* ============================================================================
   Badge de version — et porteur des mentions de licence AGPL-3.0

   Le pourquoi du placement est dans VNCT.VersionBadge (js/vnct-common.js). Ici,
   quatre points de vigilance :

   • CONTRASTE. Le badge était en --text-muted à `opacity: .6`, soit 1,87:1 en
     sombre et 1,80:1 en clair — illisible, et intenable pour du texte porteur
     d'un lien. Il passe à --text-secondary sans opacité : 7,70:1 en sombre,
     7,19:1 en clair.

   • LE LIEN NE SE DISTINGUE PAS PAR LA SEULE COULEUR : il est souligné, et
     prend la couleur du texte qui l'entoure. --accent est écarté volontairement
     — en thème clair il vaut hsl(185, 80%, 45%), soit 2,06:1 sur le fond : il
     aurait recréé exactement le défaut qu'on corrige.

   • IL NE DOIT PAS ATTEINDRE LE DRAPEAU DE SIGNALEMENT, fixe en bas à droite.
     D'où la largeur maximale, qui lui laisse sa colonne : 44 px de bouton, plus
     son décalage (--space-6) et une respiration (--space-4).

   • IL RESTE SOUS LES MODALES. z-index 1, contre 900 pour le drapeau, 1000 pour
     .vnct-modal-overlay et 9500 pour .modal-overlay de style.css.

   `--vnct-badge-left` permet à une page de le décaler sans redéclarer la règle :
   le shell du dashboard s'en sert pour le sortir de sous sa barre latérale
   (voir style.css). La largeur maximale s'en déduit toute seule.
   ============================================================================ */
.vnct-version-badge {
  position: fixed;
  bottom: var(--space-2);
  left: var(--vnct-badge-left, var(--space-3));
  max-width: min(46rem, calc(100vw - var(--vnct-badge-left, var(--space-3)) - 44px - var(--space-6) - var(--space-4)));
  font-family: var(--font-family);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
  z-index: 1;
  opacity: 1;
  /* Le texte porte une URL qu'on peut vouloir copier : la sélection reste
     possible, contrairement au badge purement décoratif d'origine. */
  user-select: text;
  -webkit-user-select: text;
}

/* Fente que /api/instance n'a pas remplie : rien à afficher, et surtout pas un
   séparateur orphelin. */
.vnct-version-badge__item:empty { display: none; }

.vnct-version-badge__item + .vnct-version-badge__item::before {
  content: " · ";
  color: var(--text-muted);
}

.vnct-version-badge__link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.vnct-version-badge__link:hover,
.vnct-version-badge__link:focus-visible {
  color: var(--text-primary);
}
.vnct-version-badge__link:focus-visible {
  /* currentColor plutôt que --accent : le contour hérite du contraste du texte
     au lieu de retomber sur les 2,06:1 de l'accent clair. */
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

@media (max-width: 768px) {
  /* Barre d'accueil iOS. La règle équivalente du design system est écrasée par
     le `bottom` ci-dessus, chargé après elle : elle doit être reprise ici. */
  .vnct-version-badge { bottom: calc(var(--space-2) + env(safe-area-inset-bottom)); }
}

/* Bouton VNCT */
.vnct-btn { font-family: var(--font-family); font-size: var(--text-sm); font-weight: var(--font-semibold); padding: var(--space-3) var(--space-6); border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); text-decoration: none; line-height: 1; transition: all 0.3s ease; }
.vnct-btn--primary { background: var(--accent); color: #000; border-color: var(--accent); }
.vnct-btn--primary:hover { box-shadow: var(--neon-shadow-md); filter: brightness(1.1); }
.vnct-btn--primary:active { filter: brightness(0.95); transform: scale(0.96); }

/* Toasts */
.vnct-toast-container { position: fixed; z-index: 2000; display: flex; flex-direction: column; gap: var(--space-3); pointer-events: none; top: var(--space-6); right: var(--space-6); max-width: 400px; }
.vnct-toast { font-family: var(--font-family); font-size: var(--text-sm); padding: var(--space-4) var(--space-6); background: var(--bg-glass); backdrop-filter: blur(12px); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); pointer-events: auto; display: flex; align-items: center; gap: var(--space-3); }
.vnct-toast--success { border-left: 3px solid #30d060; }
.vnct-toast--error { border-left: 3px solid #f04050; }

/* Keyframes */
@keyframes vnct-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes vnct-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes vnct-scale-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* Upload / Drop zone */
.vnct-upload { position: relative; }
.vnct-upload__input { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.vnct-upload__dropzone {
  display: flex; align-items: center; justify-content: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-tertiary); border: 2px dashed var(--border-default); border-radius: var(--radius-md);
  cursor: pointer; transition: border-color 0.3s ease, background 0.3s ease;
}
.vnct-upload__dropzone:hover { border-color: var(--accent); }
.vnct-upload__dropzone--dragover { border-color: var(--accent); background: rgba(255,255,255,.03); }
.vnct-upload__icon { width: 24px; height: 24px; color: var(--text-muted); flex-shrink: 0; }
.vnct-upload__text { font-size: var(--text-sm); color: var(--text-secondary); font-weight: var(--font-medium); }
.vnct-upload__gallery { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.vnct-upload__gallery:empty { display: none; }
.vnct-upload__preview { position: relative; display: flex; align-items: center; justify-content: center; background: var(--bg-tertiary); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: var(--space-2); width: 120px; height: 90px; overflow: hidden; }
.vnct-upload__img { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); object-fit: contain; }
.vnct-upload__remove { position: absolute; top: var(--space-2); right: var(--space-2); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border-default); border-radius: var(--radius-full); font-size: var(--text-lg); line-height: 1; cursor: pointer; transition: all 0.2s ease; }
.vnct-upload__remove:hover { background: #f04050; color: #fff; border-color: #f04050; }
[data-theme="light"] .vnct-upload__dropzone { background: rgba(0,0,0,.02); }
[data-theme="light"] .vnct-upload__dropzone--dragover { background: rgba(0,180,200,.05); }
[data-theme="light"] .vnct-upload__preview { background: rgba(0,0,0,.02); }

/* Inputs VNCT pour les modals */
.vnct-textarea, .vnct-input {
  font-family: var(--font-family); font-size: var(--text-base); padding: var(--space-3) var(--space-4);
  background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); outline: none; width: 100%;
}
.vnct-textarea { min-height: 100px; resize: vertical; }
.vnct-textarea:focus, .vnct-input:focus { border-color: var(--accent); box-shadow: var(--neon-shadow-sm); }
.vnct-label { font-size: var(--text-sm); font-weight: var(--font-medium); color: var(--text-secondary); margin-bottom: var(--space-2); display: block; }
