/* ═══════════════════════════════════════════════════════════════
   vo-pow.css — Page CRUD des pouvoirs
   Reprend le langage visuel du panel Pouvoirs de vo-perso
   ═══════════════════════════════════════════════════════════════ */

/* ─── Spacer pour le header fixe du site ───────────────────── */
#main {
  padding-top: 70px;
  display: block !important;
}

/* ─── Bouton Nouveau ───────────────────────────────────────── */
.btn-nouveau {
  background: #c8e6c9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
  border-radius: 5px;
  padding: 5px 14px;
  font-size: 0.9em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-nouveau:hover { background: #a5d6a7; }

/* ─── Sticky Search Header ─────────────────────────────────── */
.pow-sticky-header {
  position: sticky;
  top: 56px;
  z-index: 5;
  background: #f5f5f5;
  border-bottom: 2px solid #ddd;
  border-radius: 8px 8px 0 0;
  max-width: 900px;
  margin: 0 auto;
}
.pow-filtres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px 10px 14px;
}
.pow-recherche-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 1 300px;
  min-width: 140px;
  gap: 4px;
}
/* ─── Bouton champ de recherche ────────────────────────────── */
.pow-champ-select-wrap {
  position: relative;
  flex: 0 0 auto;
}
.pow-champ-btn {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px 0 0 6px;
  background: #f0f0f0;
  cursor: pointer;
  font-size: 0.85em;
  white-space: nowrap;
  line-height: 1.35;
}
.pow-champ-btn:hover { background: #e4e4e4; }
.pow-champ-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 140px;
}
.pow-champ-menu.ouvert { display: block; }
.pow-champ-item {
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.85em;
  white-space: nowrap;
}
.pow-champ-item:hover { background: #e8f5e9; }
.pow-champ-item.actif { background: #c8e6c9; font-weight: 600; }

.pow-recherche-wrap input[type="text"] {
  flex: 1;
  padding: 6px 30px 6px 10px;
  border: 1px solid #ccc;
  border-left: none;
  border-radius: 0 6px 6px 0;
  font-size: 0.95em;
  max-width: none;
}
.pow-recherche-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2em;
  color: #888;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.pow-recherche-clear:hover { color: #333; }

/* Toggle switch (identique vo-perso) */
.pow-toggle-label {
  font-weight: normal;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  white-space: nowrap;
  cursor: pointer;
  font-size: 0.9em;
  user-select: none;
}
.pow-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  background: #bbb;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.pow-toggle-on {
  background: #4caf50;
}
.pow-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.pow-toggle-on .pow-toggle-knob {
  left: 20px;
}

/* ─── Liste container ──────────────────────────────────────── */
#pow-liste {
  max-width: 900px;
  margin: 0 auto;
}

/* ─── Cartes pouvoir (identique vo-perso) ──────────────────── */
.pow-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 4px 8px;
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
}
.pow-card:hover {
  background: #eef5ff;
  border-color: #aac8e8;
}
.pow-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.pow-card-nom {
  font-weight: bold;
  font-size: 0.95em;
}
.pow-card-niveau {
  font-size: 0.85em;
  color: #555;
  background: #eee;
  padding: 1px 6px;
  border-radius: 4px;
}
.pow-card-cout {
  font-size: 0.85em;
  color: #666;
}
.pow-card-desc {
  font-size: 0.88em;
  color: #444;
  margin: 4px 0 2px 0;
  padding-left: 4px;
  border-left: 2px solid #ddd;
}

/* Pastilles stats dans les cartes (vue detaillee) */
.pow-card-stats {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-left: 6px;
}
.pow-card-stat {
  display: inline-block;
  font-size: 0.82em;
  background: #e8eaf6;
  color: #333;
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
}

/* Badges classes preferees dans les cartes */
.pow-card-classpref {
  display: inline-flex;
  gap: 3px;
  flex-wrap: wrap;
}
.pow-badge-class {
  background: #e8e0d4;
  color: #5a4a3a;
  font-size: 0.72em;
  padding: 0 5px;
  border-radius: 3px;
  font-weight: bold;
}
.pow-badge-exclusif {
  background: #f3e5f5;
  color: #7b1fa2;
  font-size: 0.78em;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: bold;
}

/* ─── Popup detail (identique vo-perso) ────────────────────── */
.pow-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pow-popup-box {
  background: #fff;
  max-width: 650px;
  width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  padding: 20px 24px;
}
.pow-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd;
}
.pow-popup-header strong {
  font-size: 1.15em;
}
.pow-popup-header .pow-popup-cat {
  font-size: 0.9em;
  color: #888;
  font-weight: normal;
}
.pow-popup-fermer {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #888;
  line-height: 1;
  padding: 0 4px;
}
.pow-popup-fermer:hover { color: #333; }

/* Infos pouvoir — grille 2 colonnes */
.pow-popup-infos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: #f8f8f8;
  border-radius: 6px;
}
.pow-popup-info-item {
  display: flex;
  flex-direction: column;
}
.pow-popup-info-label {
  font-size: 0.78em;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pow-popup-info-val {
  font-size: 0.92em;
  color: #333;
  font-weight: 500;
}
.pow-popup-info-val .edit-btn-inline {
  font-size: 0.9em;
  cursor: pointer;
  opacity: 0.6;
  margin-left: 4px;
  background: none;
  border: none;
  padding: 0;
}
.pow-popup-info-val .edit-btn-inline:hover { opacity: 1; }

/* Prerequis — deux colonnes */
.pow-popup-prereq-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  margin-bottom: 12px;
}
.pow-popup-prereq-col ul {
  margin: 4px 0 0 0;
  padding-left: 20px;
}
.pow-popup-prereq-col li {
  margin-bottom: 2px;
}
.pow-popup-section {
  margin-bottom: 12px;
}
.pow-popup-section ul {
  margin: 4px 0 0 0;
  padding-left: 20px;
}
.pow-popup-section li {
  margin-bottom: 2px;
}
.pow-popup-lien {
  cursor: pointer;
  text-decoration: none;
}
.pow-popup-lien:hover {
  text-decoration: underline;
}

/* Classes preferees badges dans popup */
.pow-popup-classes-pref .badge {
  display: inline-block;
  background: #e8e0d4;
  color: #5a4a3a;
  border-radius: 4px;
  padding: 1px 7px;
  margin: 1px 2px;
  font-size: 0.85em;
  font-weight: bold;
}

/* Niveaux dans popup */
.pow-popup-niv {
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 8px 10px;
  margin: 6px 0;
}
.pow-popup-niv-head {
  font-weight: bold;
  font-size: 0.95em;
  margin-bottom: 4px;
}
.pow-popup-niv-desc {
  font-size: 0.9em;
  color: #444;
  margin-top: 2px;
}
.pow-popup-niv-stats {
  font-size: 0.85em;
  color: #555;
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pow-popup-stat {
  background: #f0f0f0;
  padding: 1px 6px;
  border-radius: 3px;
}
.pow-popup-niv-choix {
  margin-top: 4px;
  font-size: 0.85em;
  color: #555;
}
.pow-popup-niv-choix select {
  padding: 2px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9em;
}
.pow-popup-choix-tag {
  display: inline-block;
  background: #e8f4fd;
  border: 1px solid #b3d9f2;
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.85em;
  margin: 1px 2px;
}
.pow-popup-choix-group {
  margin-top: 4px;
}

/* Admin actions dans popup */
.pow-popup-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}
.btn-admin-action {
  background: #e8e8e8;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 4px 12px;
  font-size: 0.85em;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.15s;
}
.btn-admin-action:hover { background: #d0d0d0; }
.btn-supprimer {
  background: #ffcdd2;
  color: #b71c1c;
  border: 1px solid #ef9a9a;
  border-radius: 5px;
  padding: 4px 12px;
  font-size: 0.85em;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-supprimer:hover { background: #ef9a9a; }

/* Inline editor dans popup */
.pow-inline-editor {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 2px;
}
.pow-inline-editor input[type="text"],
.pow-inline-editor textarea {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9em;
}
.pow-inline-editor textarea { min-height: 40px; }
.pow-inline-editor .select2-container { min-width: 180px; }
.pow-inline-editor .btn-ie {
  border: 1px solid #ccc;
  background: #f8f8f8;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 0.85em;
}
.pow-inline-editor .btn-ie:hover { background: #eee; }

/* ─── Formulaire creation (popup-like card) ────────────────── */
.pow-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pow-form-card {
  background: #fff;
  max-width: 650px;
  width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  padding: 20px 24px;
}
.pow-form-card h2 {
  margin: 0 0 12px;
  font-size: 1.15em;
}
.pow-form-group {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 200px;
}
.pow-form-group label {
  font-size: 0.78em;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: bold;
}
.pow-form-group input,
.pow-form-group textarea,
.pow-form-group select {
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95em;
}
.pow-form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.pow-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}
.btn-save-pow {
  background: #c8e6c9;
  color: #1b5e20;
  border: 1px solid #a5d6a7;
  border-radius: 5px;
  padding: 5px 16px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.15s;
}
.btn-save-pow:hover { background: #a5d6a7; }
.btn-cancel-pow {
  background: #eee;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background 0.15s;
}
.btn-cancel-pow:hover { background: #ddd; }

/* ─── Niveaux Repeater (dans formulaire) ───────────────────── */
.niveaux-repeater { margin-bottom: 6px; }
.niveau-row {
  margin-bottom: 4px;
  padding: 6px 8px;
  background: #f8f8f8;
  border: 1px solid #eee;
  border-radius: 6px;
}
.niveau-row-head {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.niveau-row-head input[type="number"] { width: 60px; }
.niveau-row-head textarea { flex: 1; min-height: 36px; resize: vertical; }
.niveau-row-head .btn-remove-niv {
  background: none;
  border: none;
  color: #c62828;
  cursor: pointer;
  font-size: 1.1em;
  padding: 2px;
}
.btn-add-niveau {
  background: #f0f0f0;
  border: 1px dashed #bbb;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85em;
  transition: background 0.15s;
}
.btn-add-niveau:hover { background: #e6e6e6; }

/* ─── Stats dans chaque niveau ─────────────────────────────── */
.niveau-stats-wrap {
  margin-top: 4px;
  padding-left: 10px;
  border-left: 3px solid #ddd;
}
.niveau-stats-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82em;
  font-weight: 600;
  color: #555;
  margin-bottom: 2px;
}
.niveau-stats-label .btn-add-stat {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  padding: 0 6px;
  line-height: 1.5;
  color: #2e7d32;
}
.niveau-stats-label .btn-add-stat:hover { background: #c8e6c9; }
.stat-row {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 2px;
}
.stat-row select.stat-type { flex: 1; min-width: 100px; font-size: 0.85em; }
.stat-row .stat-valnum { width: 50px; font-size: 0.85em; }
.stat-row .stat-valtxt { width: 80px; font-size: 0.85em; }
.stat-row .stat-niv { width: 45px; font-size: 0.85em; }
.stat-row .btn-remove-stat {
  background: none;
  border: none;
  color: #c62828;
  cursor: pointer;
  font-size: 1em;
  padding: 0 2px;
}

/* ─── Editeurs sous-sections (prereq, classes pref) ────────── */
.pow-editor-card {
  background: #fff;
  max-width: 700px;
  width: 92vw;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  padding: 20px 24px;
}
.pow-editor-card h3 {
  margin: 0 0 10px;
  font-size: 1.05em;
}
.pow-niveaux-warning {
  color: #b71c1c;
  background: #ffebee;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85em;
  margin-bottom: 10px;
}
.ppe-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}
.ppe-item .btn-remove-prereq {
  background: none;
  border: none;
  color: #c62828;
  cursor: pointer;
  font-size: 1em;
}

/* ─── Toaster ──────────────────────────────────────────────── */
#pow-toaster {
  position: fixed;
  top: 50px;
  left: 25%;
  width: 50%;
  padding: 10px 16px;
  background: #f8e5c5;
  color: #000;
  z-index: 2000;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: pow-toast-in 0.3s ease;
}
@keyframes pow-toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 650px) {
  .pow-sticky-header { top: 36px; }
  .pow-filtres { flex-direction: row; align-items: center; gap: 6px 10px; padding: 6px 10px; }
  .pow-recherche-wrap { max-width: 100%; flex-basis: 100%; }
  .pow-toggle-label { font-size: 0.82em; gap: 5px; }
  .pow-toggle { width: 34px; height: 18px; }
  .pow-toggle-knob { width: 14px; height: 14px; }
  .pow-toggle-on .pow-toggle-knob { left: 18px; }
  .btn-nouveau { padding: 4px 10px; font-size: 0.82em; }
  .pow-popup-infos { grid-template-columns: 1fr; }
  .pow-popup-prereq-row { grid-template-columns: 1fr; }
  .pow-popup-box, .pow-form-card, .pow-editor-card { width: 96vw; padding: 14px 16px; }
  .pow-form-row { flex-direction: column; }
  .niveau-row-head { flex-direction: column; }
  .stat-row { flex-wrap: wrap; }
}
