/* Roboto fin (outil de patronage) */
@font-face {
  font-family: "Roboto";
  src: url("fonts/Roboto-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
}
@font-face {
  font-family: "Roboto";
  src: url("fonts/Roboto-LightItalic.ttf") format("truetype");
  font-weight: 300;
  font-style: italic;
}

/* Police locale (fonts/) : fonctionne hors ligne */
@font-face {
  font-family: "Hussar";
  src: url("fonts/hussar-bold.woff") format("woff"),
       url("fonts/hussar-bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

/* Taille minimale de l'interface.
   Au-dessus : les textes rétrécissent progressivement avec la fenêtre.
   En dessous : la page se fige à cette taille (le surplus est simplement masqué). */
:root {
  --min-width: 640px;
  --min-height: 360px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  background: #0b0b0c;
  overflow: hidden;
}

/* Direction artistique commune : fond graphite presque noir, typographie Segoe UI Variable
   serrée, bordures fines, pilules. Une seule couleur d'accent : le bleu Devclo #267AB2
   (--dv-accent), décliné en teintes claires (survol, texte sur fond sombre) et sombres (appui). */
:root {
  --dv-bg: #0b0b0c;
  --dv-panel: #151517;
  --dv-card: #1b1b1e;
  --dv-card-hi: #222226;
  --dv-line: rgba(255, 255, 255, 0.07);
  --dv-line-2: rgba(255, 255, 255, 0.12);
  --dv-text: #f2f2f3;
  --dv-soft: #b3b3b8;
  --dv-muted: #7c7c83;
  --dv-accent: #267ab2;        /* couleur principale */
  --dv-accent-hi: #3a8fc8;     /* survol */
  --dv-accent-lo: #1e6494;     /* appui */
  --dv-accent-ink: #6db4e3;    /* texte / icônes d'accent sur fond sombre (contraste AA) */
  --dv-accent-soft: rgba(38, 122, 178, 0.16);
  --dv-accent-line: rgba(38, 122, 178, 0.45);
  --dv-teal: var(--dv-accent); /* anciens noms, gardés pour les styles existants */
  --dv-mauve: #4a9bd2;
  --dv-font: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --dv-font-text: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --dv-top: 78px; /* hauteur réservée à la barre de navigation */
  --dv-edge: max(16px, 4.4vw); /* marge gauche / droite de la barre du haut, et couloir central de la page IA : 4,4 % de la largeur (5,5 % − 20 %), sans plafond */
}

body {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: var(--min-width);
  min-height: var(--min-height);
  background:
    radial-gradient(900px 600px at 80% 10%, rgba(38, 122, 178, 0.112), transparent 70%),
    radial-gradient(700px 520px at 10% 80%, rgba(30, 80, 130, 0.084), transparent 70%),
    var(--dv-bg);
  color: var(--dv-text);
  font-family: var(--dv-font);
  font-weight: 400;
}

/* ---------- Barre de navigation (pilule flottante) ---------- */
#taskbar {
  position: absolute;
  top: 14px;
  left: 24px;
  right: 24px;
  height: 52px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 18px;
  border-radius: 26px;
  background: rgba(6, 6, 7, 0.86);
  border: 1px solid var(--dv-line);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
.tb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16.5px;
  letter-spacing: -0.01em;
  cursor: pointer;
  user-select: none;
}
.tb-logo img { width: 22px; height: 22px; object-fit: contain; }
.tb-links { display: flex; gap: 4px; }
.nav-link {
  height: 36px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 18px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--dv-soft);
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.nav-link.active { color: #fff; background: var(--dv-accent-soft); box-shadow: inset 0 0 0 1px var(--dv-accent-line); }
/* Barre commune (2026-11-16) : logo seul, page active en gras soulignée, cercle du profil à droite */
#taskbar { left: var(--dv-edge); right: var(--dv-edge); }
.tb-logo img { width: 26px; height: 26px; }
.tb-links { align-items: center; gap: 2px; }
#taskbar .nav-link.active, body #taskbar .nav-link.active { background: none !important; box-shadow: none !important; color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }

/* ---------- Pages ---------- */
#app {
  width: 100%;
  height: 100%;
}

.page {
  display: none;
  width: 100%;
  height: 100%;
}

.page.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

#page-home { position: relative; }

@keyframes dv-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
/* ---------- Changement de page : apparition très légère (fondu + 6 px) ---------- */
@keyframes dv-page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.page.active { animation: dv-page-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
#page-patronage.active:not(.editor-open) .pat-landing { animation: dv-page-in 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@media (prefers-reduced-motion: reduce) {
  .page.active, #page-patronage.active:not(.editor-open) .pat-landing { animation: none; }
}

/* ---------- Hors ligne et tablette (point 109, plateforme.js) ---------- */
/* Repère « Hors ligne » : en bas à gauche, tant que le réseau manque */
.dv-horsligne {
  position: fixed;
  left: 14px;
  bottom: 36px; /* (au-dessus de la barre d'état de l'atelier) */
  z-index: 200;
  padding: 6px 12px;
  border-radius: 14px;
  background: rgba(14, 14, 16, 0.92);
  border: 1px solid rgba(232, 160, 60, 0.55);
  color: #f0c27a;
  font-size: 12px;
  font-weight: 600;
  pointer-events: auto;
  cursor: default;
}
.dv-horsligne[hidden] { display: none; }
/* Tablette : cibles du doigt agrandies (44 px conseillés) */
.is-tactile .nav-link { height: 44px; padding: 0 16px; }
.is-tactile input[type="range"] { min-height: 28px; }

/* ---------- Poubelle commune (2026-11-16) : créations de la page IA, projets ----------
   Apparaît au survol de la carte, passe en rouge au survol de l'icône. Suppression en deux temps : un premier clic
   la garde en rouge plein (« Cliquer encore pour supprimer »), le second supprime ; quitter la carte annule. */
.dv-trash, .dv-trash-host > .dv-trash {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 12, 16, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #c9d2de;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.18s, transform 0.18s, color 0.18s, background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.dv-trash svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dv-trash-host:hover .dv-trash, .dv-trash-host:focus-within .dv-trash, .dv-trash.armed { opacity: 1; transform: none; }
.dv-trash:hover, .dv-trash:focus-visible { color: #ff5f57; border-color: rgba(255, 95, 87, 0.6); background: rgba(40, 10, 10, 0.8); }
.dv-trash.armed { color: #fff; background: #e5484d; border-color: #ff7a74; box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.22); }
html[data-theme="clair"] .dv-trash { background: rgba(255, 255, 255, 0.9); border-color: rgba(20, 30, 45, 0.16); color: #4a5464; }
html[data-theme="clair"] .dv-trash:hover { color: #d92d2d; border-color: rgba(217, 45, 45, 0.5); background: #fff5f5; }
html[data-theme="clair"] .dv-trash.armed { color: #fff; background: #e5484d; border-color: #e5484d; }

/* Barre du haut : un peu plus d'espace entre les pages (comme la barre de l'accueil et de la page IA) */
.tb-links { gap: 10px; }

/* Liens de la barre du haut : plus de rectangle au survol (seul le texte s'éclaire), toutes les pages et les deux thèmes */
html .nav-link:hover, html .hm-links > button:not(.dv-acc-btn):hover { background: none !important; box-shadow: none !important; }

/* ---------- Menu du clic droit commun (2026-11-16), pour toute l'app et toutes les pages ----------
   Format retenu par Martin : fond noir uni, coins légèrement arrondis, texte blanc normal (pas de gras), raccourci gris à
   droite, séparateurs fins, pas d'icônes ; rouge pour les suppressions, coche pour les options activées. */
.dv-ctx {
  position: absolute;
  z-index: 400;
  min-width: 200px;
  max-width: min(360px, calc(100vw - 16px));
  padding: 4px;
  display: grid;
  gap: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #0c0d0f;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  font-family: var(--dv-font);
  animation: dv-ctx-in 0.1s ease-out both;
}
@keyframes dv-ctx-in { from { opacity: 0; } to { opacity: 1; } }
.dv-ctx-item {
  width: 100%;
  height: 27px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: #fff;
  font: 400 13px var(--dv-font);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.dv-ctx-item:hover:not(:disabled), .dv-ctx-item:focus-visible { background: rgba(255, 255, 255, 0.09); outline: none; }
.dv-ctx-item:disabled { opacity: 0.38; cursor: default; }
.dv-ctx-ico { display: none; }
.dv-ctx-check { flex: none; margin-left: 10px; font-size: 12px; color: #fff; }
.dv-ctx-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dv-ctx-item kbd { margin-left: 24px; padding: 0; border: 0; background: none; color: #9a9ca3; font: 400 12px var(--dv-font); }
.dv-ctx-item.danger { color: #ff8a80; }
.dv-ctx-item.danger:hover:not(:disabled) { background: rgba(229, 72, 77, 0.16); }
.dv-ctx-sep { height: 1px; margin: 4px 6px; background: rgba(255, 255, 255, 0.13); }
.is-tactile .dv-ctx-item { height: 40px; }
html[data-theme="clair"] .dv-ctx { background: #fff; border-color: rgba(20, 30, 45, 0.16); box-shadow: 0 10px 30px rgba(20, 30, 45, 0.18); }
html[data-theme="clair"] .dv-ctx-item, html[data-theme="clair"] .dv-ctx-check { color: #111418; }
html[data-theme="clair"] .dv-ctx-item:hover:not(:disabled), html[data-theme="clair"] .dv-ctx-item:focus-visible { background: rgba(20, 30, 45, 0.07); }
html[data-theme="clair"] .dv-ctx-item kbd { color: #6a7383; }
html[data-theme="clair"] .dv-ctx-item.danger { color: #d92d2d; }
html[data-theme="clair"] .dv-ctx-sep { background: rgba(20, 30, 45, 0.12); }

/* Petit message en bas de la fenêtre (image copiée, téléchargée…) */
.dv-toast { position: fixed; left: 50%; bottom: 26px; z-index: 500; padding: 9px 16px; border-radius: 11px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(20, 22, 28, 0.94); color: #f1f4f8; font: 600 13px var(--dv-font); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); opacity: 0; transform: translate(-50%, 8px); transition: opacity 0.18s, transform 0.18s; pointer-events: none; }
.dv-toast.show { opacity: 1; transform: translate(-50%, 0); }
html[data-theme="clair"] .dv-toast { background: #fff; color: #1d232c; border-color: rgba(20, 30, 45, 0.14); }
