/* ═══════════════════════════════════════════════════════════════════════════
   Fenêtres du site — modale et notification, partagées par les pages.

   Accompagne public/js/ui-modal.js. Les classes sont préfixées `um-` pour ne
   croiser aucune feuille de page.

   Reprend les variables de public/style.css : une page qui charge cette
   feuille hérite automatiquement de la palette du site.
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes um-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes um-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.um-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(3, 3, 13, .72);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: um-fade .15s ease;
}
.um-overlay[hidden] { display: none !important; }

.um-box {
  width: 100%; max-width: 470px; max-height: 86vh; overflow-y: auto;
  background: #1e2021; border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .7);
  padding: 22px 24px; animation: um-rise .2s ease;
}

.um-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.um-icon {
  width: 18px; height: 18px; flex: 0 0 auto; font-size: 0;
  border-radius: 5px; background: #58a6ff;
}
.um-icon:empty { display: none; }
.um-title {
  font-size: 16.5px; font-weight: 750; margin: 0; letter-spacing: -.01em;
  color: #eceae7;
}
.um-body {
  display: flex; flex-direction: column; gap: 14px;
  font-size: 13.5px; line-height: 1.6; color: #c0beb7;
}
.um-message code {
  background: rgba(0, 0, 0, .3); padding: 1px 6px; border-radius: 4px; font-size: 12.5px;
}

.um-field { display: flex; flex-direction: column; gap: 5px; }
.um-field label { font-size: 12px; font-weight: 650; color: var(--muted, #8582b0); }
.um-hint { font-size: 11.5px; color: var(--muted, #8582b0); line-height: 1.5; }

.um-input {
  width: 100%; background: var(--panel, rgba(21,19,46,.94));
  border: 1px solid var(--border, rgba(255,255,255,.1));
  color: var(--text, #f0efff); border-radius: var(--radius-sm, 10px);
  padding: 9px 12px; font-size: 13.5px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.um-input:focus {
  border-color: var(--purple, var(--vio-8b5cf6)); box-shadow: 0 0 0 3px rgba(var(--vio-rgb-8b5cf6), .13);
}
.um-input::placeholder { color: var(--muted, #8582b0); }

/* Menu deroulant : le chevron du systeme est gris et colle au bord. On met le
   notre, dessine en SVG dans le fond — aucune image a charger — et la liste
   deployee suit le theme sombre au lieu d'un fond blanc. */
select.um-input {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px; cursor: pointer; color-scheme: dark;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23a78bfa' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
select.um-input:hover:not(:disabled) { border-color: rgba(255, 255, 255, .22); }
select.um-input option { background: #13131a; color: #fff; }

/* ─── Menu maison ────────────────────────────────────────────────────────────
   Un <select> natif ne laisse pas habiller sa liste : elle est dessinee par le
   systeme, blanche et anguleuse au milieu d'une fenetre sombre. Celui-ci est a
   nous de bout en bout. */
.um-dd { position: relative; }
.um-dd-trigger {
  display: flex; align-items: center; gap: 10px; text-align: left;
  cursor: pointer; padding-right: 12px;
}
.um-dd-label { flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.um-dd-caret { color: #79c0ff; font-size: 11px; flex-shrink: 0; transition: transform .18s; }
.um-dd-trigger[aria-expanded="true"] { border-color: #58a6ff; }
.um-dd-trigger[aria-expanded="true"] .um-dd-caret { transform: rotate(180deg); }

.um-dd-panel {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 40;
  max-height: 280px; overflow-y: auto; padding: 6px;
  background: #1e2021;
  border: 1px solid rgba(88, 166, 255, .45); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.um-dd-panel[hidden] { display: none; }
.um-dd-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 8px; cursor: pointer;
  background: none; color: #c0beb7;
  font-family: inherit; font-size: 13px; transition: background .12s, color .12s;
}
.um-dd-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.um-dd-nom { color: #eceae7; }
.um-dd-sub { color: #98958d; font-size: 11.5px; }
.um-dd-check { width: 16px; height: 16px; flex: 0 0 auto; opacity: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M3.5 8.5 6.5 11.5 12.5 4.5' fill='none' stroke='%2358a6ff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 16px no-repeat; }
.um-dd-opt:hover { background: rgba(255, 255, 255, .05); }
.um-dd-opt.is-on { background: #1a2330; }
.um-dd-opt.is-on .um-dd-check { opacity: 1; }

.um-textarea { resize: vertical; line-height: 1.5; }

/* Jeton : lecture seule en chasse fixe, avec son bouton de copie */
.um-token { display: flex; gap: 8px; }
.um-token .um-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* Texte préformaté : un plan, un récapitulatif */
/* Un bloc de commande et son bouton. Le bouton se pose DANS le bloc, en haut
   a droite : accroche a la commande qu'il copie, il ne peut pas etre confondu
   avec celui d'une autre. */
.um-cmd { position: relative; }
.um-cmd-copy { position: absolute; top: 7px; right: 7px; opacity: .82; }
.um-cmd-copy:hover { opacity: 1; }
.um-cmd .um-pre { padding-right: 92px; }

.um-pre {
  background: rgba(0, 0, 0, .3); border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: var(--radius-sm, 10px); padding: 13px 15px; margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; line-height: 1.7; color: var(--text2, #a5a3cc);
  white-space: pre-wrap; word-break: break-word;
}

.um-warn {
  background: rgba(245, 158, 11, .09); border: 1px solid rgba(245, 158, 11, .28);
  border-radius: var(--radius-sm, 10px); padding: 11px 13px;
  font-size: 12.5px; line-height: 1.55; color: var(--text2, #a5a3cc);
}
.um-warn strong { color: var(--yellow-l, #fbbf24); }

/* ─── Boutons ────────────────────────────────────────────────────────────── */
.um-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.um-btn {
  min-width: 96px; justify-content: center;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border, rgba(255,255,255,.1));
  border-radius: var(--radius-sm, 10px); padding: 9px 16px;
  background: var(--panel, rgba(21,19,46,.94)); color: var(--text, #f0efff);
  font-family: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer;
  transition: opacity .15s, border-color .15s, transform .12s;
}
.um-btn:hover { border-color: var(--border-glow, rgba(var(--vio-rgb-8b5cf6),.4)); }
.um-btn:active { transform: translateY(1px); }
.um-btn:focus-visible { outline: 2px solid var(--purple, var(--vio-8b5cf6)); outline-offset: 2px; }
.um-btn[hidden] { display: none !important; }
.um-btn--primary {
  background: #316dca;
  color: #fff; border-color: transparent;
}
.um-btn--primary:hover { background: #388bfd; opacity: 1; border-color: transparent; }
.um-btn--danger {
  background: rgba(244, 63, 94, .14); color: var(--red-l, #fb7185);
  border-color: rgba(244, 63, 94, .32);
}
.um-btn--sm { min-width: 0; padding: 6px 12px; font-size: 12.5px; }

/* ─── Notification ───────────────────────────────────────────────────────── */
.um-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 10001;
  max-width: min(90vw, 460px);
  background: #1e2021; border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius, 14px); padding: 12px 20px;
  font-size: 13.5px; line-height: 1.5; color: var(--text, #f0efff);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .6); animation: um-rise .2s ease;
}
.um-toast--ok    { border-color: rgba(16, 185, 129, .42); }
.um-toast--error { border-color: rgba(244, 63, 94, .42); }

@media (prefers-reduced-motion: reduce) {
  .um-overlay, .um-box, .um-toast { animation: none !important; }
}
@media (max-width: 520px) {
  .um-box { padding: 18px 16px; }
  .um-foot { flex-direction: column-reverse; }
  .um-foot .um-btn { width: 100%; }
}
