/* ===== battle-ui.css =====
   Popups, résultat, animations, debug combat
   Scripts/styles/battle-ui.css
*/

/* ----- Popup choix de deck ----- */
.battle-deck-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 260;
  display: none;
  align-items: center;
  justify-content: center;
}
.battle-deck-overlay.visible {
  display: flex;
}
.battle-deck-box {
  background: #1a1a1a;
  border: 1px solid #555;
  border-radius: 12px;
  padding: 28px 32px;
  min-width: 340px;
  max-width: 90vw;
  text-align: center;
}
.battle-deck-box h2 {
  margin-bottom: 16px;
  font-size: 20px;
  color: #eee;
}
.battle-deck-box select {
  width: 100%;
  padding: 10px 12px;
  margin: 12px 0 18px;
  background: #2a2a2a;
  border: 1px solid #555;
  color: #eee;
  border-radius: 6px;
  font-size: 15px;
}
.battle-deck-box button {
  display: block;
  width: 100%;
  margin: 8px 0;
  padding: 12px;
  background: #2a2a2a;
  border: 1px solid #555;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
}
.battle-deck-box button:hover {
  background: #3a3a3a;
  border-color: #888;
}
.battle-deck-box button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.battle-deck-box .battle-deck-cancel {
  background: transparent;
  border-color: #333;
  color: #888;
}

/* ----- Flash / hit fullart ----- */
.fullart-hit-red {
  animation: fullartHitRed 0.65s ease;
}
@keyframes fullartHitRed {
  0% {
    filter: brightness(1) saturate(1);
  }
  30% {
    filter: brightness(1.5) saturate(2.2) hue-rotate(-25deg);
    box-shadow: 0 0 28px rgba(231, 76, 60, 0.85);
  }
  100% {
    filter: brightness(1) saturate(1);
    box-shadow: none;
  }
}

.battle-float-dmg {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, 0);
  font-size: 34px;
  font-weight: bold;
  color: #e74c3c;
  text-shadow: 0 2px 6px #000, 0 0 12px rgba(231, 76, 60, 0.55);
  opacity: 1;
  pointer-events: none;
  z-index: 60;
  transition: transform 0.8s ease, opacity 0.8s ease;
}
.battle-float-dmg-go {
  transform: translate(-50%, -52px);
  opacity: 0;
}

/* ----- Aperçu défausse ----- */
.discard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 280;
  display: none;
  align-items: center;
  justify-content: center;
}
.discard-overlay.visible {
  display: flex;
}
.discard-box {
  background: #1a1a1a;
  border: 1px solid #555;
  border-radius: 12px;
  padding: 24px 28px;
  max-width: min(1100px, 94vw);
  max-height: 85vh;
  overflow-y: auto;
  text-align: center;
}
.discard-box h2 {
  margin-bottom: 16px;
  font-size: 20px;
  color: #eee;
}
.discard-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin-bottom: 18px;
}
.discard-grid .battle-played-card,
.discard-grid > div {
  transform: scale(0.45);
  transform-origin: top left;
  margin: 0 -40px -90px 0;
}
.discard-box .btn-discard-back {
  margin-top: 12px;
  padding: 12px 36px;
  background: #2a2a2a;
  border: 1px solid #888;
  color: #fff;
  font-size: 15px;
  border-radius: 6px;
  cursor: pointer;
}
.discard-box .btn-discard-back:hover {
  background: #3a3a3a;
  border-color: #aaa;
}

/* ----- Révélation cartes ----- */
.battle-card-back {
  width: 70px;
  height: 100px;
  border-radius: 8px;
  background: linear-gradient(145deg, #3a2a12, #1a1510);
  border: 2px solid #c9a227;
  box-shadow: 0 4px 10px #000;
}
.battle-card-flash {
  animation: cardFlash 0.9s ease;
}
@keyframes cardFlash {
  0% {
    filter: brightness(1);
    box-shadow: 0 0 0 transparent;
  }
  30% {
    filter: brightness(1.8);
    box-shadow: 0 0 24px #f0d78c;
  }
  100% {
    filter: brightness(1);
    box-shadow: 0 0 0 transparent;
  }
}

/* ----- Bannière fin ----- */
.battle-end-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  padding: 20px 48px;
  font-size: 36px;
  font-weight: bold;
  letter-spacing: 3px;
  border-radius: 12px;
  text-shadow: 0 2px 8px #000;
  pointer-events: none;
}
.battle-end-win {
  background: rgba(20, 60, 20, 0.9);
  border: 2px solid #2ecc71;
  color: #2ecc71;
}
.battle-end-lose {
  background: rgba(60, 20, 20, 0.9);
  border: 2px solid #e74c3c;
  color: #e74c3c;
}

/* ----- Debug ----- */
.battle-debug {
  position: absolute;
  left: 100px;
  bottom: 130px;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid #555;
  border-radius: 8px;
  padding: 8px 12px;
  max-width: 420px;
}
#battleDebugStep {
  font-size: 13px;
  color: #c9a227;
  flex: 1;
  min-width: 0;
}
#btnBattlePassStep {
  padding: 8px 14px;
  background: #2a2218;
  border: 1px solid #c9a227;
  color: #f0d78c;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
#btnBattlePassStep:hover:not(:disabled) {
  background: #3a3218;
}
#btnBattlePassStep:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ----- Popup résultat combat ----- */
.battle-result-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.battle-result-box {
  background: #1a1510;
  border: 1px solid #555;
  border-radius: 14px;
  padding: 28px 32px 24px;
  max-width: min(960px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  text-align: center;
  color: #eee;
}
.battle-result-box h2 {
  font-size: 32px;
  margin-bottom: 16px;
  letter-spacing: 2px;
}
.result-win {
  color: #2ecc71;
}
.result-lose {
  color: #e74c3c;
}
.result-draw {
  color: #c9a227;
}

.battle-result-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin-bottom: 20px;
}
.result-score-side {
  min-width: 100px;
}
.result-score-label {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 4px;
}
.result-score-value {
  font-size: 28px;
  font-weight: bold;
  color: #f0d78c;
}
.result-score-vs {
  font-size: 16px;
  color: #666;
}

.battle-result-cols {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.battle-result-col {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  min-width: 200px;
}

.result-char {
  width: 110px;
  text-align: center;
}
.result-char-art {
  width: 96px;
  height: 120px;
  margin: 0 auto 6px;
  background-size: contain;
  background-position: center top;
  background-repeat: no-repeat;
  border-radius: 8px;
  background-color: #111;
  border: 1px solid #444;
}
.result-char-dead .result-char-art {
  filter: grayscale(1) brightness(0.55);
  border-color: #a33;
  box-shadow: 0 0 10px rgba(231, 76, 60, 0.35);
}
.result-char-name {
  font-size: 12px;
  color: #ddd;
  line-height: 1.2;
}
.result-char-dead .result-char-name {
  color: #e74c3c;
}
.result-char-hp {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}

.battle-result-rewards {
  margin: 12px 0 16px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  border: 1px solid #333;
}
.result-reward-line {
  font-size: 15px;
  color: #f0d78c;
  margin: 2px 0;
}
.result-reward-level {
  font-size: 14px;
  color: #2ecc71;
  margin-top: 4px;
  min-height: 1.2em;
}

.result-xp-bar-wrap {
  margin-top: 10px;
}
.result-xp-bar-track {
  height: 12px;
  background: #2a2a2a;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #555;
}
.result-xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c9a227, #e8c84a);
  border-radius: 6px;
  transition: width 0.85s ease;
}
.result-xp-bar-label {
  margin-top: 4px;
  font-size: 12px;
  color: #aaa;
}

.battle-result-details {
  text-align: left;
  margin: 12px 0 16px;
  max-height: 220px;
  overflow-y: auto;
  padding: 8px;
  background: #12100c;
  border-radius: 8px;
  border: 1px solid #333;
}
.battle-result-details h3 {
  font-size: 14px;
  color: #c9a227;
  margin: 8px 0 6px;
}
.result-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
}
.result-detail-table th,
.result-detail-table td {
  padding: 4px 8px;
  border-bottom: 1px solid #2a2a2a;
  text-align: left;
}
.result-detail-table th {
  color: #888;
  font-weight: normal;
}
.result-detail-table .row-dead td {
  color: #e74c3c;
}

.result-btn-primary,
.result-btn-secondary {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 10px auto 0;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-family: Georgia, serif;
}
.result-btn-primary {
  background: #2a2218;
  border: 1px solid #c9a227;
  color: #f0d78c;
}
.result-btn-primary:hover {
  background: #3a3218;
  border-color: #e8c84a;
}
.result-btn-secondary {
  background: transparent;
  border: 1px solid #555;
  color: #ccc;
}
.result-btn-secondary:hover {
  border-color: #888;
  color: #fff;
}

.battle-char-selectable {
  cursor: pointer;
  outline: 2px solid #2ecc71;
  outline-offset: 2px;
}
.battle-hand-dimmed {
  opacity: 0.35;
}
.battle-char-unselectable {
  opacity: 0.4;
}
.battle-hand-plaie,
.battle-hand-card.battle-hand-disabled {
  opacity: 0.4;
  filter: grayscale(0.6);
  cursor: pointer !important;
}
.battle-hand-card,
.battle-hand-card .card,
.battle-hand-card .card * {
  pointer-events: auto !important;
}

#chooseEquipGrid .battle-played-card,
#chooseEquipGrid > div {
  transform: scale(0.85);
  transform-origin: top center;
  margin: 0 8px 12px;
}

.discard-split-box {
  max-width: min(1200px, 96vw);
}
.discard-split-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}
.discard-split-pane h3 {
  color: #f0d78c;
  font-size: 15px;
  margin: 0 0 8px;
  border-bottom: 1px solid #555;
  padding-bottom: 4px;
}

.result-flavor {
  color: #ccc;
  font-size: 15px;
  margin: -8px 0 16px;
  font-style: italic;
}

/* Boss / perso seul : PNG agrandi, derrière stats + équipement */
.fullart.fullart-solo {
  overflow: visible;
}
.fullart.fullart-solo .fullart-art {
  transform: translateX(-48px) scale(1.6);
  transform-origin: center top;
  z-index: 1;
  box-shadow: none;
  background-color: transparent;
  border-radius: 0;
}
.fullart.fullart-solo .fullart-text,
.fullart.fullart-solo .fullart-stats {
  position: relative;
  z-index: 8;
}
.fullart.fullart-solo .fullart-equip {
  z-index: 9;
}