/* ═══════════════════════════════════════════════════════════════
   styles-modals.css — Modals internes Wineblender
   Remplace toutes les fenêtres système (alert/confirm/prompt)
   ═══════════════════════════════════════════════════════════════ */

/* ── Overlay générique ── */
.wb-modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: wb-fade-in .15s ease;
}
.wb-modal-overlay.hidden { display: none !important; }

@keyframes wb-fade-in { from { opacity:0 } to { opacity:1 } }

.wb-modal-box {
  background: var(--card, #fff);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
  padding: 24px;
  max-width: 380px; width: 100%;
  animation: wb-slide-up .18s cubic-bezier(.4,0,.2,1);
}
@keyframes wb-slide-up { from { transform:translateY(16px);opacity:0 } to { transform:translateY(0);opacity:1 } }

.wb-modal-box.wb-modal-wide { max-width: 600px; }
.wb-modal-box.wb-modal-xl   { max-width: 740px; max-height: 90vh; display:flex; flex-direction:column; }

.wb-modal-icon  { font-size: 36px; text-align: center; margin-bottom: 10px; }
.wb-modal-title { font-size: 17px; font-weight: 800; color: var(--txt); text-align: center; margin-bottom: 8px; }
.wb-modal-msg   { font-size: 14px; color: var(--txt-d); text-align: center; line-height: 1.5; margin-bottom: 20px; }

.wb-modal-actions {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}
.wb-modal-actions .wb-btn-ghost {
  flex: 1; padding: 12px; border-radius: 12px;
  border: 1.5px solid var(--bdr, rgba(90,30,48,.18));
  background: transparent; color: var(--txt);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.wb-modal-actions .wb-btn-primary {
  flex: 1; padding: 12px; border-radius: 12px;
  background: var(--p, #5a1e30); color: #fff;
  border: none; font-size: 14px; font-weight: 700; cursor: pointer;
}
.wb-modal-actions .wb-btn-danger {
  flex: 1; padding: 12px; border-radius: 12px;
  background: var(--err, #c0392b); color: #fff;
  border: none; font-size: 14px; font-weight: 700; cursor: pointer;
}
.wb-modal-input {
  width: 100%; padding: 12px 14px;
  border-radius: 12px; border: 1.5px solid var(--bdr, rgba(90,30,48,.18));
  background: var(--bg, #f5f0eb); color: var(--txt);
  font-size: 15px; font-family: inherit;
  box-sizing: border-box; outline: none; margin-bottom: 16px;
}
.wb-modal-input:focus { border-color: var(--p, #5a1e30); }

/* ── Sélecteur IA inline ── */
.wb-ia-selector-wrap {
  position: relative; display: inline-block;
}
.wb-ia-selector-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px;
  background: var(--p-lt, rgba(90,30,48,.08));
  border: 1.5px solid var(--p, #5a1e30);
  color: var(--p, #5a1e30); cursor: pointer;
  font-size: 13px; font-weight: 700;
  transition: background .12s;
}
.wb-ia-selector-btn:hover { background: var(--p-lt2, rgba(90,30,48,.14)); }
.wb-ia-selector-btn .wb-ia-chevron { font-size: 10px; opacity: .7; }

.wb-ia-dropdown {
  /* position:fixed permet d'échapper overflow:hidden de l'asm-header parent */
  position: fixed; top: 0; right: 0;
  background: var(--card, #fff);
  border: 1px solid var(--bdr, rgba(90,30,48,.14));
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  min-width: 220px; z-index: 8000;
  overflow: hidden;
  animation: wb-slide-up .14s ease;
}
.wb-ia-dropdown.hidden { display: none; }

.wb-ia-option {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--bdr, rgba(90,30,48,.06));
}
.wb-ia-option:last-child { border-bottom: none; }
.wb-ia-option:hover { background: var(--p-lt, rgba(90,30,48,.06)); }
.wb-ia-option.active { background: var(--p-lt, rgba(90,30,48,.08)); font-weight: 700; }
.wb-ia-option-icon  { font-size: 20px; flex-shrink: 0; }
.wb-ia-option-label { flex: 1; }
.wb-ia-option-name  { font-size: 13px; font-weight: 700; color: var(--txt); }
.wb-ia-option-sub   { font-size: 11px; color: var(--txt-d); margin-top: 1px; }
.wb-ia-option-check { font-size: 14px; color: var(--p); }
/* Badge compteur dans le dropdown (sous chaque option IA) */
.wb-ia-count-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  color: var(--p);
  background: var(--p-lt, rgba(90,30,48,.08));
  border: 1px solid var(--bdr, rgba(90,30,48,.14));
  border-radius: 8px;
  padding: 0px 5px;
  letter-spacing: .01em;
  white-space: nowrap;
}
.wb-ia-count-badge.warn   { color: var(--warn, #b87828); background: var(--warn-bg, #fdf3e2); border-color: var(--warn, #b87828); }
.wb-ia-count-badge.danger { color: var(--err, #b84444);  background: var(--err-bg, #fdf0f0);  border-color: var(--err, #b84444); }

/* Badge compteur dans le bouton principal (sur fond coloré du header) */
.wb-ia-count-inline {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  color: inherit;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 10px;
  padding: 1px 6px;
  letter-spacing: .02em;
  white-space: nowrap;
  opacity: .92;
}
.wb-ia-count-inline.warn   { background: rgba(184,120,40,.25);  border-color: rgba(184,120,40,.5); }
.wb-ia-count-inline.danger { background: rgba(184,68,68,.30);   border-color: rgba(184,68,68,.55); }

/* ── Éditeur de prompt ── */
.wb-prompt-editor-overlay { z-index: 8500; }
.wb-prompt-editor-box { max-width: 700px; max-height: 88vh; }

.wb-prompt-tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.wb-prompt-tab  {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 700;
  border: 1.5px solid var(--bdr); background: transparent; color: var(--txt-d);
  cursor: pointer; transition: all .12s;
}
.wb-prompt-tab.active {
  background: var(--p, #5a1e30); color: #fff; border-color: var(--p);
}

.wb-prompt-textarea {
  width: 100%; flex: 1; min-height: 260px;
  padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--bdr); background: var(--bg, #f5f0eb);
  color: var(--txt); font-size: 12px; font-family: 'SF Mono', 'Courier New', monospace;
  line-height: 1.6; resize: none; box-sizing: border-box; outline: none;
}
.wb-prompt-textarea:focus { border-color: var(--p); }

.wb-prompt-actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px;
}
.wb-prompt-name-input {
  flex: 1; padding: 8px 12px; border-radius: 10px;
  border: 1.5px solid var(--bdr); background: var(--bg);
  color: var(--txt); font-size: 13px; min-width: 120px;
}

/* ── Saved prompt rows ── */
.wb-saved-prompt-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--bdr, rgba(90,30,48,.06));
}
.wb-saved-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--txt); }
.wb-btn-xs     { padding: 5px 10px; border-radius: 8px; font-size: 11px; font-weight: 700;
                 border: none; cursor: pointer; }
.wb-btn-xs.wb-btn-primary { background: var(--p, #5a1e30); color: #fff; }
.wb-btn-xs.wb-btn-ghost   { background: var(--bg2, #f0e8e0); color: var(--txt); border: 1px solid var(--bdr); }
.wb-btn-xs.wb-btn-danger  { background: var(--err, #c0392b); color: #fff; }
