/* ═══════════════════════════════════════════════════════════════
   vo-races.css — Page CRUD des races
   Adapte de vo-pow.css avec prefixe race-
   ═══════════════════════════════════════════════════════════════ */

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

/* ─── Sticky Search Header ─────────────────────────────────── */
.race-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;
}
.race-filtres {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: center;
  padding: 8px 14px 10px 14px;
}
.race-recherche-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 1 300px;
  min-width: 140px;
  gap: 4px;
}
.race-recherche-wrap input[type="text"] {
  flex: 1;
  padding: 6px 30px 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95em;
  max-width: none;
}
.race-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;
}
.race-recherche-clear:hover { color: #333; }

/* Toggle switch */
.race-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;
}
.race-toggle {
  position: relative;
  width: 40px;
  height: 22px;
  background: #bbb;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.race-toggle-on {
  background: #4caf50;
}
.race-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);
}
.race-toggle-on .race-toggle-knob {
  left: 20px;
}

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

/* ─── Cartes race ──────────────────────────────────────────── */
.race-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 4px 8px;
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
}
.race-card:hover {
  background: #eef5ff;
  border-color: #aac8e8;
}
.race-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.race-card-nom {
  font-weight: bold;
  font-size: 0.95em;
}
.race-card-badge {
  font-size: 0.82em;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: bold;
}
.race-card-badge-hidden {
  background: #ffecb3;
  color: #e65100;
}
.race-card-badge-pow {
  background: #e8eaf6;
  color: #333;
}
.race-card-badge-param {
  background: #e0f2f1;
  color: #004d40;
}
.race-card-desc {
  font-size: 0.88em;
  color: #444;
  margin: 4px 0 2px 0;
  padding-left: 4px;
  border-left: 2px solid #ddd;
}

/* ─── Popup detail ─────────────────────────────────────────── */
.race-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.race-popup-box {
  background: #fff;
  max-width: 700px;
  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;
}
.race-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd;
}
.race-popup-header strong {
  font-size: 1.15em;
}
.race-popup-fermer {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #888;
  line-height: 1;
  padding: 0 4px;
}
.race-popup-fermer:hover { color: #333; }

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

/* Texte long collapsible */
.race-texte-long {
  max-height: 80px;
  overflow: hidden;
  position: relative;
  transition: max-height 0.3s;
}
.race-texte-long.expanded {
  max-height: none;
}
.race-texte-long:not(.expanded)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(transparent, #f8f8f8);
}
.race-texte-toggle {
  background: none;
  border: none;
  color: #1976d2;
  cursor: pointer;
  font-size: 0.82em;
  padding: 0;
  margin-top: 2px;
}

/* Sections */
.race-popup-section {
  margin-bottom: 12px;
}

/* Pouvoirs raciaux badges */
.race-pow-badge {
  display: inline-block;
  background: #e8eaf6;
  color: #333;
  border-radius: 4px;
  padding: 2px 8px;
  margin: 2px 3px;
  font-size: 0.85em;
  font-weight: 500;
}
.race-pow-badge .pow-niv {
  color: #666;
  font-size: 0.9em;
}

/* Section parametres */
.race-section-params {
  margin-top: 12px;
}
.race-param-block {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  background: #fafafa;
}
.race-param-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.race-param-header strong {
  font-size: 0.95em;
}
.race-param-meta {
  font-size: 0.82em;
  color: #666;
}
.race-param-desc {
  font-size: 0.88em;
  color: #555;
  margin-bottom: 6px;
}

/* Options dans un param */
.race-option-row {
  border-bottom: 1px solid #eee;
  padding: 6px 0;
}
.race-option-row:last-child {
  border-bottom: none;
}
.race-option-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.race-option-nom {
  font-weight: 600;
  font-size: 0.9em;
}
.race-option-code {
  font-size: 0.78em;
  color: #999;
  font-family: monospace;
}
.race-badge-hidden {
  background: #ffecb3;
  color: #e65100;
  font-size: 0.72em;
  padding: 0 5px;
  border-radius: 3px;
  font-weight: bold;
}
.race-option-desc {
  font-size: 0.85em;
  color: #555;
  margin: 2px 0 4px 0;
}
.race-option-pows {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}

/* Admin actions dans popup */
.race-popup-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

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

/* ─── Formulaire creation / editeurs sous-sections ─────────── */
.race-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.race-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;
}
.race-form-card h2 {
  margin: 0 0 12px;
  font-size: 1.15em;
}
.race-form-group {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 200px;
}
.race-form-group label {
  font-size: 0.78em;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: bold;
}
.race-form-group input,
.race-form-group textarea,
.race-form-group select {
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95em;
}
.race-form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.race-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

/* Editeur sous-section card */
.race-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;
}
.race-editor-card h3 {
  margin: 0 0 10px;
  font-size: 1.05em;
}

/* Items repeater dans editeurs */
.race-editor-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
}
.race-editor-item .btn-remove {
  background: none;
  border: none;
  color: #c62828;
  cursor: pointer;
  font-size: 1em;
}

/* Options editor rows */
.race-opt-editor-row {
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 6px;
  background: #fafafa;
}
.race-opt-editor-row .race-form-row {
  margin-bottom: 4px;
}

/* ─── Toaster ──────────────────────────────────────────────── */
#race-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: race-toast-in 0.3s ease;
}
@keyframes race-toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

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