/* [51-troops] Onglet Recrutement / formation des troupes */
/* ==========================================================================
   ONGLET RECRUTEMENT / FORMATION DES TROUPES (grille de portraits)
   ========================================================================== */
.training-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.troop-grid-col {
  flex-shrink: 0;
  width: 300px;
  max-height: 470px;
  overflow-y: auto;
  padding-right: 4px;
}

.troop-group-title {
  margin: 8px 0 5px;
  padding-bottom: 3px;
  font-family: 'Limelight', serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #cdac80;
  border-bottom: 1px solid #433523;
}

.troop-group-title:first-child {
  margin-top: 0;
}

.troop-grid {
  display: grid;
  grid-template-columns: repeat(4, 64px);
  gap: 8px;
}

.troop-tile {
  position: relative;
  width: 64px;
  height: 64px;
  border: 2px solid #5e4b33;
  background: #0b0a09;
  box-shadow: inset 0 0 0 1px #000, 0 2px 4px rgba(0, 0, 0, 0.8);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.troop-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.troop-tile:hover {
  border-color: var(--gold-amber);
}

.troop-tile.is-selected {
  border-color: #ba4134;
  box-shadow: 0 0 0 1px var(--gold-amber), 0 0 12px rgba(186, 65, 52, 0.8);
}

.troop-tile.is-locked img {
  filter: grayscale(1) brightness(0.45);
}

.troop-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

/* Quantité possédée sous la vignette, comme l'original */
.troop-cell-owned {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-amber);
}

.troop-tile-lock {
  position: absolute;
  left: 3px;
  top: 2px;
  font-size: 13px;
  text-shadow: 0 1px 3px #000;
}

.training-detail-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.troop-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.troop-portrait-frame {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border: 2px solid var(--gold-old);
  background: #0b0a09;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
}

.troop-portrait-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.troop-head-text h3 {
  font-family: 'Limelight', serif;
  font-size: 18px;
  color: #e2b983;
}

.troop-class-chip {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 8px;
  background: linear-gradient(180deg, #378168, #153b2e);
  border: 1px solid #b18f62;
  border-radius: 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff;
}

.troop-owned {
  margin-top: 5px;
  font-size: 11.5px;
  color: #c5b5a0;
}

.troop-stat-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.troop-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}

.troop-stat-label {
  width: 92px;
  color: #c9bfb3;
}

.troop-stat-track {
  flex: 1;
  height: 8px;
  background: #050403;
  border: 1px solid #342d23;
}

.troop-stat-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #755831, #bd8d4d);
}

.troop-stat-value {
  width: 62px;
  text-align: right;
  color: #fff;
}

.troop-extra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
  font-size: 11.5px;
  color: #c5b5a0;
}

.troop-extra strong {
  color: #fff;
}

.troop-strong-vs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.troop-chip-img {
  width: 24px;
  height: 24px;
  border: 1px solid #5e4b33;
}

.training-qty-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.training-qty-row label {
  margin-right: 4px;
  color: var(--gold-bright);
  font-weight: bold;
  font-size: 13px;
}

.qty-btn {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #342c22, #120e0a);
  border: 1px solid var(--gold-old);
  border-radius: 2px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.qty-btn:hover {
  border-color: #e9c9a0;
}

.qty-input {
  width: 74px;
  height: 26px;
  flex-shrink: 0;
  background: #14171a;
  border: 1px solid #413525;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  border-radius: 2px;
  outline: none;
  user-select: text;
}

.qty-input:focus {
  border-color: var(--gold-primary);
}

.qty-btn-max {
  height: 26px;
  padding: 0 10px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #b04236, #70241c);
  border: 1px solid #cda775;
  border-radius: 2px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.qty-slider {
  --fill: 0%;
  flex: 1;
  min-width: 0;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(90deg, #bd8d4d var(--fill), #050403 var(--fill));
  border: 1px solid #504331;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.qty-slider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.qty-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 22px;
  background: linear-gradient(180deg, #be4638, #70241c);
  border: 1px solid var(--gold-amber);
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.qty-slider::-moz-range-thumb {
  width: 14px;
  height: 20px;
  background: linear-gradient(180deg, #be4638, #70241c);
  border: 1px solid var(--gold-amber);
  border-radius: 3px;
}

.troop-warning {
  min-height: 0;
  font-size: 11px;
  color: #ed897d;
}

.troop-warning:empty {
  display: none;
}

.troop-train-btn {
  width: 100%;
  padding: 8px 10px;
}

/* Fiche compacte : tient dans la fenêtre sans scrollbar */
.training-detail-panel { gap: 5px; }
.training-detail-panel .troop-portrait-frame { width: 72px; height: 72px; }
.training-detail-panel .troop-head-text h3 { font-size: 16px; }
.training-detail-panel .troop-stat-bars { gap: 2px; }
.training-detail-panel .troop-stat-row,
.training-detail-panel .troop-extra { font-size: 11px; }
.training-detail-panel .troop-stat-track { height: 6px; }
.training-detail-panel .troop-desc {
  margin: 0;
  font-size: 11px;
  font-style: italic;
  line-height: 1.3;
  color: #c5b5a0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.training-detail-panel .troop-desc:empty { display: none; }
.training-detail-panel .research-cost-table { font-size: 11px; }
.training-detail-panel .research-cost-table th,
.training-detail-panel .research-cost-table td { padding: 3px 8px; }
.training-detail-panel .btn-big-red-build,
.training-detail-panel .btn-big-grey-instant {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.2;
  min-height: 0;
}
.troop-train-row { display: flex; gap: 6px; }
.troop-train-row .troop-train-btn { width: auto; flex: 1; }
.troop-train-row .troop-train-now-btn { flex: 1; }

/* Fiche sur deux colonnes en haut (portrait à gauche, barres à droite) : tout le bas (quantité, coûts, boutons) reste visible sans défiler */
.training-detail-panel {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  column-gap: 14px;
  align-items: center;
}
.training-detail-panel > :not(.troop-head):not(.troop-stat-bars) { grid-column: 1 / -1; }
.training-detail-panel .research-cost-table th,
.training-detail-panel .research-cost-table td { padding: 2px 8px; }

/* Prérequis de formation : dernière ligne du tableau des coûts */
.training-detail-panel .training-prereq-cell { padding: 4px 8px; border-top: 1px solid #433523; }
.training-detail-panel .training-prereq-cell .bm-prereq { margin-top: 0; }
.training-detail-panel .training-prereq-cell .bm-prereq { flex-direction: column; flex-wrap: nowrap; gap: 3px; font-size: 11px; }
.training-detail-panel .training-prereq-body tr:first-child td { border-top: 1px solid #433523; }
