/* 三国·天命 — Personality & Bond System Styles */

/* ═══════════════════════════════════════
   BOND SECTION IN HERO DETAIL
   ═══════════════════════════════════════ */

.personality-bond-card,
.personality-status-card,
.personality-dialogue-card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.bond-section-icon {
  margin-right: 6px;
  font-size: 16px;
}

.bond-item {
  background: var(--card2);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.bond-item:last-child {
  margin-bottom: 0;
}

.bond-item.bond-active {
  border-color: var(--gold);
  box-shadow:
    0 0 12px rgba(212, 168, 67, 0.15),
    inset 0 0 20px rgba(212, 168, 67, 0.05);
  position: relative;
  overflow: hidden;
}

.bond-item.bond-active::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(212, 168, 67, 0.06) 60deg,
    transparent 120deg
  );
  animation: bondGlow 6s linear infinite;
  pointer-events: none;
}

@keyframes bondGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.bond-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.bond-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.bond-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.bond-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--card);
  color: var(--dim);
}

.bond-active .bond-status {
  background: rgba(212, 168, 67, 0.2);
  color: var(--gold);
  text-shadow: 0 0 6px rgba(212, 168, 67, 0.4);
}

.bond-desc {
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 8px;
  font-style: italic;
}

.bond-heroes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.bond-hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.bond-hero-tag.owned {
  color: var(--text);
  border-color: rgba(212, 168, 67, 0.3);
}

.bond-hero-tag.missing {
  color: var(--dim);
  opacity: 0.5;
  filter: grayscale(0.5);
}

.bond-bonus {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  padding: 4px 8px;
  background: rgba(212, 168, 67, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(212, 168, 67, 0.15);
}

/* ═══════════════════════════════════════
   MOOD & LOYALTY INDICATORS
   ═══════════════════════════════════════ */

.personality-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.personality-row + .personality-row {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.personality-label {
  font-size: 12px;
  color: var(--dim);
  min-width: 60px;
  flex-shrink: 0;
}

.personality-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.mood-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--mood-color) 15%, transparent);
  color: var(--mood-color);
  border: 1px solid color-mix(in srgb, var(--mood-color) 25%, transparent);
}

.mood-effects {
  font-size: 11px;
  color: var(--dim);
  margin-left: auto;
}

.loyalty-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--card2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.loyalty-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease, background 0.5s ease;
  box-shadow: 0 0 6px currentColor;
}

.loyalty-value {
  font-size: 13px;
  font-weight: 700;
  min-width: 42px;
  text-align: right;
}

.personality-idle-warning {
  font-size: 11px;
  color: #f59e0b;
  padding: 6px 10px;
  margin-top: 6px;
  background: rgba(245, 158, 11, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(245, 158, 11, 0.15);
}

/* ═══════════════════════════════════════
   DIALOGUE PREVIEW IN HERO DETAIL
   ═══════════════════════════════════════ */

.hero-dialogue-preview {
  text-align: center;
  padding: 8px 0;
}

.dialogue-quote {
  font-size: 13px;
  font-style: italic;
  color: var(--text);
  opacity: 0.85;
  line-height: 1.6;
}

/* ═══════════════════════════════════════
   BATTLE DIALOGUE BUBBLES
   ═══════════════════════════════════════ */

.battle-canvas-wrap {
  position: relative;
}

.dialogue-bubble {
  position: absolute;
  max-width: 150px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  transition: opacity 0.35s ease, transform 0.35s ease;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialogue-bubble.bubble-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dialogue-bubble.bubble-hide {
  opacity: 0;
  transform: translateY(-6px) scale(0.95);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Tail (speech pointer) */
.dialogue-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  width: 0;
  height: 0;
  border-style: solid;
}

/* Ally bubble: warm tones */
.bubble-ally {
  background: linear-gradient(135deg, #2d6a4f, #1a4f3a);
  color: #d9f2e6;
  border: 1px solid rgba(82, 183, 136, 0.3);
}

.bubble-ally::after {
  left: 20px;
  border-width: 6px 5px 0 5px;
  border-color: #2d6a4f transparent transparent transparent;
}

/* Enemy bubble: cold tones */
.bubble-enemy {
  background: linear-gradient(135deg, #6b1a1a, #4a1515);
  color: #f2d9d9;
  border: 1px solid rgba(200, 80, 80, 0.3);
}

.bubble-enemy::after {
  right: 20px;
  left: auto;
  border-width: 6px 5px 0 5px;
  border-color: #6b1a1a transparent transparent transparent;
}

/* ═══════════════════════════════════════
   BATTLE BOND BANNER
   ═══════════════════════════════════════ */

.battle-bond-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px;
  justify-content: center;
  animation: bondBannerIn 0.6s ease;
}

@keyframes bondBannerIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.battle-bond-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.15), rgba(212, 168, 67, 0.05));
  color: var(--gold);
  border: 1px solid rgba(212, 168, 67, 0.3);
  text-shadow: 0 0 8px rgba(212, 168, 67, 0.3);
  animation: bondTagPulse 3s ease-in-out infinite;
}

@keyframes bondTagPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(212, 168, 67, 0.1); }
  50% { box-shadow: 0 0 12px rgba(212, 168, 67, 0.25); }
}

/* ═══════════════════════════════════════
   MOOD ICON IN ROSTER GRID
   ═══════════════════════════════════════ */

.roster-mood-icon {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 12px;
  z-index: 5;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.roster-loyalty-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  z-index: 5;
  box-shadow: 0 0 4px currentColor;
}

/* ═══════════════════════════════════════
   DEFECTION EVENT MODAL
   ═══════════════════════════════════════ */

.defection-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: defectFadeIn 0.5s ease;
}

@keyframes defectFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.defection-card {
  background: linear-gradient(135deg, #1a0505, #2a0a0a);
  border: 2px solid #7f1d1d;
  border-radius: 20px;
  padding: 32px;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 0 40px rgba(127, 29, 29, 0.4);
  animation: defectSlide 0.5s ease;
}

@keyframes defectSlide {
  from { transform: translateY(30px) scale(0.9); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.defection-title {
  font-size: 20px;
  font-weight: 800;
  color: #ef4444;
  margin-bottom: 12px;
}

.defection-hero-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.defection-msg {
  font-size: 13px;
  color: var(--dim);
  line-height: 1.6;
  margin-bottom: 20px;
}

.defection-btn {
  padding: 10px 32px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ═══════════════════════════════════════
   BATTLE BOND ACTIVATION EFFECT
   ═══════════════════════════════════════ */

.bond-activation-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(212, 168, 67, 0.3), transparent 70%);
  pointer-events: none;
  z-index: 15;
  animation: bondFlash 1.2s ease-out forwards;
}

@keyframes bondFlash {
  0% { opacity: 0; transform: scale(0.5); }
  30% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}

.bond-activation-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(212, 168, 67, 0.6), 0 2px 8px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  z-index: 16;
  white-space: nowrap;
  animation: bondTextIn 1.5s ease-out forwards;
}

@keyframes bondTextIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  40% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

/* ═══════════════════════════════════════
   LOYALTY REFUSAL / FURY INDICATORS
   ═══════════════════════════════════════ */

.battle-refusal-msg {
  color: #f59e0b;
  font-weight: 600;
}

.battle-fury-msg {
  color: #ef4444;
  font-weight: 600;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 360px) {
  .dialogue-bubble {
    max-width: 120px;
    font-size: 10px;
    padding: 4px 8px;
  }

  .bond-hero-tag {
    font-size: 10px;
    padding: 2px 6px;
  }

  .battle-bond-tag {
    font-size: 10px;
    padding: 2px 8px;
  }
}
