/* ==========================================================================
 * Effects Display Component
 * Styles for active effects (buffs/debuffs) on character sheet and game log
 * ========================================================================== */

/* Game Log specific - ADV/DIS badges */
.gl-adv-badge,
.gl-dis-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  margin-left: 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gl-adv-badge {
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: var(--accent-success, #4ade80);
}

.gl-dis-badge {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-danger, #ef4444);
}

/* Game Log - Effects display row */
.gl-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  margin-bottom: 4px;
}

.gl-effect-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(147, 112, 219, 0.15);
  border: 1px solid rgba(147, 112, 219, 0.3);
  border-radius: 4px;
  color: var(--accent-magic, #9370db);
  font-size: 10px;
  font-weight: 500;
}

/* Game Log - Modifier breakdown */
.gl-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color, #3a3a5a);
}

.gl-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.gl-breakdown-source {
  color: var(--text-muted, #666);
}

.gl-breakdown-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

.gl-breakdown-positive {
  color: var(--accent-success, #4ade80);
}

.gl-breakdown-negative {
  color: var(--accent-danger, #ef4444);
}

.gl-breakdown-dice {
  color: var(--accent-warning, #fbbf24);
}

/* Character Sheet - Active Effects Panel */
.cs-effects {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cs-effects-empty {
  color: var(--text-muted, #666);
  font-style: italic;
  font-size: 12px;
  padding: 8px 0;
}

.cs-effect-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-secondary, #252545);
  border: 1px solid var(--border-color, #3a3a5a);
  border-radius: 6px;
  transition: border-color 0.15s ease;
}

.cs-effect-item:hover {
  border-color: var(--accent-primary, #4a9eff);
}

.cs-effect-item.buff {
  border-left: 3px solid var(--accent-success, #4ade80);
}

.cs-effect-item.debuff {
  border-left: 3px solid var(--accent-danger, #ef4444);
}

.cs-effect-item.concentration {
  border-left: 3px solid var(--accent-warning, #fbbf24);
}

.cs-effect-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--bg-tertiary, #2a2a4a);
  border-radius: 4px;
  flex-shrink: 0;
}

.cs-effect-icon svg {
  width: 16px;
  height: 16px;
}

.cs-effect-content {
  flex: 1;
  min-width: 0;
}

.cs-effect-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.cs-effect-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary, #e0e0e0);
}

.cs-effect-conc-badge {
  padding: 1px 4px;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  color: var(--accent-warning, #fbbf24);
  text-transform: uppercase;
}

.cs-effect-source {
  font-size: 10px;
  color: var(--text-muted, #666);
  margin-bottom: 4px;
}

.cs-effect-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
}

.cs-effect-bonus {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: rgba(74, 158, 255, 0.1);
  border-radius: 3px;
  color: var(--accent-primary, #4a9eff);
  font-family: 'JetBrains Mono', monospace;
}

.cs-effect-duration {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: var(--bg-tertiary, #2a2a4a);
  border-radius: 3px;
  color: var(--text-secondary, #888);
}

.cs-effect-affects {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: rgba(147, 112, 219, 0.1);
  border-radius: 3px;
  color: var(--accent-magic, #9370db);
}

/* Advantage/Disadvantage indicators on effects */
.cs-effect-advantage,
.cs-effect-disadvantage {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.cs-effect-advantage {
  background: rgba(74, 222, 128, 0.15);
  color: var(--accent-success, #4ade80);
}

.cs-effect-disadvantage {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger, #ef4444);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .cs-effect-item {
    flex-direction: column;
    gap: 6px;
  }

  .cs-effect-icon {
    width: 24px;
    height: 24px;
  }

  .cs-effect-details {
    flex-direction: column;
    gap: 4px;
  }
}

/* ==========================================================================
 * State Change Animations (Cross-Panel Synchronization)
 * Provides visual feedback when character state changes
 * ========================================================================== */

/* HP Bar state change animations */
.cs-hp-bar,
.cs-hp-display {
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.cs-hp-bar.hp-damaged,
.cs-hp-display.hp-damaged {
  animation: hp-damage-flash 1.5s ease;
}

.cs-hp-bar.hp-healed,
.cs-hp-display.hp-healed {
  animation: hp-heal-flash 1.5s ease;
}

@keyframes hp-damage-flash {
  0%, 100% {
    background-color: var(--bg-tertiary, #2a2a4a);
    box-shadow: none;
  }
  25%, 75% {
    background-color: rgba(220, 38, 38, 0.3);
    box-shadow: 0 0 12px rgba(220, 38, 38, 0.4);
  }
}

@keyframes hp-heal-flash {
  0%, 100% {
    background-color: var(--bg-tertiary, #2a2a4a);
    box-shadow: none;
  }
  25%, 75% {
    background-color: rgba(34, 197, 94, 0.3);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
  }
}

/* Condition badge state change animations */
.cs-condition-badge {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cs-condition-badge.condition-added {
  animation: condition-appear 1.5s ease;
}

.cs-condition-badge.condition-pulse {
  animation: condition-pulse 2s ease;
}

@keyframes condition-appear {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  30% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes condition-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 var(--accent-warning, #fbbf24);
  }
  50% {
    box-shadow: 0 0 10px 3px var(--accent-warning, #fbbf24);
  }
}

/* Exhaustion display animations */
.cs-exhaustion-display {
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.cs-exhaustion-display.exhaustion-increased {
  animation: exhaustion-increase 1.5s ease;
}

.cs-exhaustion-display.exhaustion-decreased {
  animation: exhaustion-decrease 1.5s ease;
}

@keyframes exhaustion-increase {
  0%, 100% {
    background-color: transparent;
  }
  25%, 75% {
    background-color: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
  }
}

@keyframes exhaustion-decrease {
  0%, 100% {
    background-color: transparent;
  }
  25%, 75% {
    background-color: rgba(74, 222, 128, 0.2);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.3);
  }
}

/* Disabled action state (stunned, paralyzed, etc.) */
.rollable.action-disabled,
.cs-skill-item.action-disabled,
.cs-ability-score.action-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(50%);
}

/* No spell slots available */
.cs-spell-chip.no-slots:not(.cantrip),
.cs-spell-item.no-slots:not(.cantrip) {
  opacity: 0.35;
  text-decoration: line-through;
  pointer-events: none;
}
