/**
 * Combat System Styles
 */

/* Modal Overlay */
.combat-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  overflow-y: auto;
  padding: 1rem;
  box-sizing: border-box;
}

.combat-modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Combat Container */
.combat-container {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid #0f3460;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 0 40px rgba(15, 52, 96, 0.5);
  position: relative;
}

/* Header */
.combat-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.combat-header h2 {
  margin: 0;
  font-size: 2rem;
  color: #e94560;
  text-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
  letter-spacing: 0.2em;
}

.turn-indicator {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.25rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  color: #a8dadc;
  font-size: 0.9rem;
}

/* Combat Arena */
.combat-arena {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.combatant {
  flex: 1;
  padding: 1rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
}

.player-side {
  border: 1px solid #14b8a6;
}

.enemy-side {
  border: 1px solid #e94560;
}

.combatant-name {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.player-side .combatant-name {
  color: #14b8a6;
}

.enemy-side .combatant-name {
  color: #e94560;
}

.vs-divider {
  font-size: 1.5rem;
  font-weight: bold;
  color: #666;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

/* Health/Mana Bars */
.health-bar,
.mana-bar {
  height: 24px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  position: relative;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 4px;
}

.hp-fill {
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
}

.hp-fill.medium {
  background: linear-gradient(90deg, #eab308 0%, #ca8a04 100%);
}

.hp-fill.low {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.mp-fill {
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

.bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.75rem;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

/* Buffs */
.buffs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  min-height: 24px;
}

.buff-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  cursor: help;
}

.buff-icon.physical { color: #f59e0b; }
.buff-icon.mental { color: #8b5cf6; }
.buff-icon.defense { color: #14b8a6; }
.buff-icon.poison { color: #22c55e; background: rgba(34, 197, 94, 0.2); }

/* Combat Log */
.combat-log {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.5rem;
  margin-bottom: 1rem;
  max-height: 150px;
  overflow-y: auto;
}

.log-entries {
  font-size: 0.85rem;
  line-height: 1.5;
}

.log-entry {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

.log-entry.player {
  background: rgba(20, 184, 166, 0.15);
  border-left: 3px solid #14b8a6;
}

.log-entry.enemy {
  background: rgba(233, 69, 96, 0.15);
  border-left: 3px solid #e94560;
}

.log-entry.system {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid #666;
  color: #999;
}

/* Action Buttons */
.combat-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.combat-btn {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.combat-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.combat-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.attack-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
}

.abilities-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
}

.items-btn {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
}

.flee-btn {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
}

/* Subpanels */
.combat-subpanel {
  position: absolute;
  bottom: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  background: #1a1a2e;
  border: 2px solid #0f3460;
  border-radius: 8px;
  padding: 1rem;
  z-index: 10;
}

.combat-subpanel.hidden {
  display: none;
}

.combat-subpanel h4 {
  margin: 0 0 0.75rem 0;
  color: #a8dadc;
  font-size: 1rem;
}

.abilities-list,
.items-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 0.75rem;
}

.ability-btn,
.item-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e0;
  cursor: pointer;
  transition: all 0.2s;
}

.ability-btn:hover:not(:disabled),
.item-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #14b8a6;
}

.ability-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ability-name,
.item-name {
  font-weight: 500;
}

.ability-cost {
  font-size: 0.8rem;
  color: #3b82f6;
}

.item-qty {
  font-size: 0.8rem;
  color: #a8dadc;
}

.no-abilities,
.no-items {
  color: #666;
  text-align: center;
  padding: 1rem;
}

.close-panel-btn {
  width: 100%;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #333;
  border-radius: 6px;
  color: #e0e0e0;
  cursor: pointer;
}

.close-panel-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Result Screen */
.combat-result {
  text-align: center;
  padding: 2rem 1rem;
  position: relative;
  z-index: 10;
}

.combat-result.hidden {
  display: none !important;
}

/* Hide actions when result is shown */
.combat-actions.hidden {
  display: none !important;
}

.result-title {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
}

.result-title.victory {
  color: #22c55e;
  text-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
}

.result-title.defeat {
  color: #ef4444;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

.result-title.fled {
  color: #f59e0b;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
}

.result-message {
  color: #a8dadc;
  margin-bottom: 1rem;
}

.rewards-list {
  margin-bottom: 1.5rem;
}

.reward-item {
  padding: 0.5rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  color: #22c55e;
}

.continue-btn {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  color: white;
  padding: 0.75rem 2rem;
}

/* Responsive */
@media (max-width: 600px) {
  .combat-container {
    padding: 1rem;
  }

  .combat-arena {
    flex-direction: column;
    gap: 0.5rem;
  }

  .vs-divider {
    display: none;
  }

  .combatant {
    width: 100%;
  }

  .combat-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .combat-header h2 {
    font-size: 1.5rem;
  }
}
