/* ═══════════════════════════════════════════════════════════
   ARCANE DUELS — Card Component Styles
   Ornate fantasy card design with element theming
   ═══════════════════════════════════════════════════════════ */

/* ─── Card Container ─────────────────────────────────────── */
.card {
  width: 130px;
  height: 185px;
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-style: preserve-3d;
  flex-shrink: 0;
  user-select: none;
}

.card:hover {
  transform: translateY(-12px) scale(1.08);
  z-index: 100;
}

.card.selected {
  transform: translateY(-20px) scale(1.12);
  z-index: 101;
}

.card.disabled {
  opacity: 0.5;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

.card.disabled:hover {
  transform: none;
}

/* ─── Card Face (Front) ──────────────────────────────────── */
.card-face {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 2px solid #5a4a2a;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

/* Rarity border colors */
.card.rarity-common .card-face {
  border-color: #6b7280;
}

.card.rarity-rare .card-face {
  border-color: #3b82f6;
  box-shadow: var(--shadow-md), 0 0 12px rgba(59, 130, 246, 0.3);
}

.card.rarity-epic .card-face {
  border-color: #a855f7;
  box-shadow: var(--shadow-md), 0 0 12px rgba(168, 85, 247, 0.3);
}

/* ─── Card Header (Name + Cost) ──────────────────────────── */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: linear-gradient(180deg, rgba(0,0,0,0.8), rgba(0,0,0,0.5));
  position: relative;
  z-index: 2;
}

.card-name {
  font-family: var(--font-heading);
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  letter-spacing: 0.02em;
}

.card-cost {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  border: 2px solid #93c5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

/* ─── Card Art Area ──────────────────────────────────────── */
.card-art {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Element-specific backgrounds */
.card.element-fire .card-art {
  background: var(--element-fire-bg);
}
.card.element-nature .card-art {
  background: var(--element-nature-bg);
}
.card.element-shadow .card-art {
  background: var(--element-shadow-bg);
}
.card.element-arcane .card-art {
  background: var(--element-arcane-bg);
}
.card.element-holy .card-art {
  background: var(--element-holy-bg);
}

/* Art overlay pattern */
.card-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.1) 0%, transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(0,0,0,0.2) 0%, transparent 50%);
  z-index: 1;
}

.card-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.6));
  z-index: 1;
}

.card-symbol {
  font-size: 3rem;
  z-index: 2;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  animation: card-symbol-float 3s ease-in-out infinite;
}

/* ─── Card Type Badge ────────────────────────────────────── */
.card-type-badge {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 8px;
  border-radius: var(--radius-round);
  font-size: 0.5rem;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  z-index: 3;
  color: #fff;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.2);
}

/* ─── Card Footer (Description + Stats) ──────────────────── */
.card-footer {
  padding: 5px 7px;
  background: linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,0,0.85));
  position: relative;
  z-index: 2;
  min-height: 45px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-description {
  font-size: 0.48rem;
  color: #d1d5db;
  line-height: 1.3;
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-attack, .card-health {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.card-attack {
  background: linear-gradient(135deg, #dc2626, #f97316);
  border: 2px solid #fbbf24;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.card-health {
  background: linear-gradient(135deg, #059669, #10b981);
  border: 2px solid #6ee7b7;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* Spell cards don't show attack/health */
.card.type-spell .card-stats {
  display: none;
}

.card.type-spell .card-description {
  margin-bottom: 0;
  -webkit-line-clamp: 3;
}

/* ─── Card Abilities Tags ────────────────────────────────── */
.card-abilities {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.ability-tag {
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.45rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ability-tag.rush {
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.ability-tag.taunt {
  background: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.ability-tag.reborn {
  background: rgba(168, 85, 247, 0.3);
  color: #c4b5fd;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.ability-tag.battlecry {
  background: rgba(234, 179, 8, 0.3);
  color: #fde68a;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

/* ─── Card Back ──────────────────────────────────────────── */
.card-back {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background:
    repeating-conic-gradient(
      rgba(212, 168, 67, 0.1) 0deg 30deg,
      transparent 30deg 60deg
    ),
    linear-gradient(135deg, #1a1025, #0f0a1a, #1a1025);
  border: 2px solid var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.card-back::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid var(--gold-dark);
  border-radius: 6px;
}

.card-back::after {
  content: '⚔️';
  font-size: 2.2rem;
  opacity: 0.6;
  filter: drop-shadow(0 0 8px rgba(212, 168, 67, 0.5));
}

/* ─── Board Creature (smaller, on battlefield) ───────────── */
.board-creature {
  width: 90px;
  height: 110px;
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  transition: all 0.25s ease;
  transform-style: preserve-3d;
}

.board-creature:hover {
  transform: scale(1.1);
  z-index: 10;
}

.board-creature.can-attack {
  animation: creature-ready 1.5s ease-in-out infinite;
}

.board-creature.taunt-creature {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5), 0 0 15px rgba(59, 130, 246, 0.3);
}

.board-creature .creature-inner {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #5a4a2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.board-creature .creature-art {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.board-creature .creature-symbol {
  font-size: 2rem;
  z-index: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.board-creature .creature-name {
  font-family: var(--font-heading);
  font-size: 0.45rem;
  color: #fff;
  text-align: center;
  padding: 2px 4px;
  background: rgba(0,0,0,0.6);
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-creature .creature-stats {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 3px 6px;
  background: rgba(0,0,0,0.7);
}

.board-creature .stat-attack,
.board-creature .stat-health {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 900;
}

.board-creature .stat-attack {
  color: #fbbf24;
}

.board-creature .stat-health {
  color: #6ee7b7;
}

.board-creature .stat-health.damaged {
  color: #f87171;
}

.board-creature .stat-attack.buffed {
  color: #fde68a;
  text-shadow: 0 0 6px rgba(253, 230, 138, 0.5);
}

/* ─── Card in Hand (Game View) ───────────────────────────── */
.hand-card {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hand-card:hover {
  transform: translateY(-30px) scale(1.15) !important;
  z-index: 200 !important;
}

.hand-card.unplayable {
  filter: brightness(0.5) grayscale(0.3);
}

.hand-card.unplayable:hover {
  transform: translateY(-10px) scale(1.05) !important;
}

/* ─── Card Tooltip (Large Preview) ───────────────────────── */
.card-tooltip {
  position: fixed;
  width: 220px;
  height: 310px;
  z-index: 10000;
  pointer-events: none;
  animation: tooltip-in 0.2s ease;
}

.card-tooltip .card {
  width: 220px;
  height: 310px;
  cursor: default;
}

.card-tooltip .card:hover {
  transform: none;
}

.card-tooltip .card-name {
  font-size: 0.75rem;
}

.card-tooltip .card-symbol {
  font-size: 4.5rem;
}

.card-tooltip .card-description {
  font-size: 0.65rem;
  -webkit-line-clamp: 4;
}

.card-tooltip .card-cost {
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
}

.card-tooltip .card-attack,
.card-tooltip .card-health {
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
}

.card-tooltip .card-footer {
  min-height: 70px;
  padding: 8px 10px;
}

.card-tooltip .ability-tag {
  font-size: 0.55rem;
  padding: 2px 6px;
}

.card-tooltip .card-flavor {
  font-style: italic;
  font-size: 0.55rem;
  color: #9ca3af;
  margin-top: 4px;
}

/* ─── Collection Card (Deck Builder) ─────────────────────── */
.collection-card {
  position: relative;
}

.collection-card .card-count {
  position: absolute;
  bottom: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  color: #1a1a2e;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
  z-index: 5;
}

/* ─── Pack Card Reveal ───────────────────────────────────── */
.pack-card {
  animation: pack-reveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}

.pack-card:nth-child(1) { animation-delay: 0.2s; }
.pack-card:nth-child(2) { animation-delay: 0.6s; }
.pack-card:nth-child(3) { animation-delay: 1.0s; }

/* ─── Damage Number Float ────────────────────────────────── */
.damage-number {
  position: absolute;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 900;
  color: #ef4444;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.6), 0 2px 4px rgba(0,0,0,0.8);
  pointer-events: none;
  z-index: 500;
  animation: damage-float 1s ease-out forwards;
}

.damage-number.heal {
  color: #10b981;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.6), 0 2px 4px rgba(0,0,0,0.8);
}

/* ─── Card Play Slot Highlight ───────────────────────────── */
.slot-highlight {
  border: 2px dashed var(--gold);
  border-radius: 8px;
  background: rgba(212, 168, 67, 0.1);
  animation: slot-pulse 1.5s ease-in-out infinite;
}

.card.rarity-legendary .card-face {
  border-color: rgba(245, 158, 11, 0.78);
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.16), inset 0 0 24px rgba(245, 158, 11, 0.05);
}
