/* GameDeck Card Component */

/* Card Rarity Colors */
:root {
  --rarity-common-glow: rgba(150, 150, 150, 0.4);
  --rarity-common-border: rgba(255, 255, 255, 0.1);

  --rarity-uncommon-glow: rgba(34, 197, 94, 0.5);
  --rarity-uncommon-border: #22c55e;

  --rarity-rare-glow: rgba(59, 130, 246, 0.5);
  --rarity-rare-border: #3b82f6;

  --rarity-epic-glow: rgba(168, 85, 247, 0.5);
  --rarity-epic-border: #a855f7;

  --rarity-legendary-glow: rgba(251, 191, 36, 0.6);
  --rarity-legendary-border: #fbbf24;

  --rarity-mythic-glow: rgba(236, 72, 153, 0.6);
  --rarity-mythic-border: #ec4899;
}

/* Card Container - 2.5:3.5 standard trading card ratio */
.card-container {
  position: relative;
  width: 300px;
  height: 420px;
  cursor: pointer;
  perspective: 1000px;
}

/* Flipper - holds front and back */
.card-flipper {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.card-container.flipped .card-flipper {
  transform: rotateY(180deg);
}

/* Disable hover effects when flipped or mid-flip */
.card-container.flipped .card-glow,
.card-container.flipped .card-shine,
.card-container.flipped .art-shine,
.card-container.flipping .card-glow,
.card-container.flipping .card-shine,
.card-container.flipping .art-shine {
  opacity: 0 !important;
}

.card {
  --shift-x: 0;
  --shift-y: 0;
  --glow-x: 50%;
  --glow-y: 50%;

  position: absolute;
  inset: 0;
  border-radius: 14px;
  transition: transform 0.15s ease-out;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-front {
  z-index: 2;
  cursor: pointer;
}

.card-back {
  transform: rotateY(180deg);
  z-index: 1;
}

/* Card border glow - varies by rarity */
.card-glow {
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  z-index: -1;
  opacity: 0;
  filter: blur(10px);
  transition: opacity 0.3s ease;
}

.card-container:hover .card-glow {
  opacity: 1;
}

/* Common (default) */
.card-glow {
  background: var(--rarity-common-glow);
}

/* Uncommon */
.card[data-rarity="uncommon"] ~ .card-glow,
.card.rarity-uncommon ~ .card-glow {
  background: radial-gradient(ellipse at 50% 50%, var(--rarity-uncommon-glow), transparent 70%);
}

/* Rare */
.card[data-rarity="rare"] ~ .card-glow,
.card.rarity-rare ~ .card-glow {
  background: radial-gradient(ellipse at 50% 50%, var(--rarity-rare-glow), transparent 70%);
}

/* Epic */
.card[data-rarity="epic"] ~ .card-glow,
.card.rarity-epic ~ .card-glow {
  background: linear-gradient(135deg, var(--rarity-epic-glow), rgba(168, 85, 247, 0.2), var(--rarity-epic-glow));
  background-size: 200% 200%;
  animation: borderGlow 3s ease infinite;
}

/* Legendary */
.card[data-rarity="legendary"] ~ .card-glow,
.card.rarity-legendary ~ .card-glow {
  background: linear-gradient(135deg, #ffd700 0%, #ff6b00 25%, #ff0080 50%, #00ffff 75%, #ffd700 100%);
  background-size: 300% 300%;
  animation: borderGlow 4s ease infinite;
  opacity: 0.7;
}

.card-container:hover .card.rarity-legendary ~ .card-glow {
  opacity: 0.9;
}

/* Mythic */
.card[data-rarity="mythic"] ~ .card-glow,
.card.rarity-mythic ~ .card-glow {
  background: conic-gradient(from 0deg, #ff0080, #ff8c00, #ffd700, #00ff88, #00ffff, #8b5cf6, #ff0080);
  background-size: 100% 100%;
  animation: mythicRotate 3s linear infinite;
  opacity: 0.8;
}

@keyframes borderGlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

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

/* Card Frame */
.card-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  padding: 6px;
  background: linear-gradient(160deg, #2a2a4a 0%, #1a1a2e 50%, #0f0f1a 100%);
  box-shadow:
    0 15px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Rarity border tint */
.card.rarity-uncommon .card-frame {
  box-shadow:
    0 15px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(34, 197, 94, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.card.rarity-rare .card-frame {
  box-shadow:
    0 15px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(59, 130, 246, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.card.rarity-epic .card-frame {
  box-shadow:
    0 15px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(168, 85, 247, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.card.rarity-legendary .card-frame {
  box-shadow:
    0 15px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(251, 191, 36, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.card.rarity-mythic .card-frame {
  box-shadow:
    0 15px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(236, 72, 153, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

/* Card Inner */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(180deg, #12121f 0%, #0a0a12 100%);
  border: 1px solid var(--rarity-common-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card.rarity-uncommon .card-inner { border-color: rgba(34, 197, 94, 0.3); }
.card.rarity-rare .card-inner { border-color: rgba(59, 130, 246, 0.3); }
.card.rarity-epic .card-inner { border-color: rgba(168, 85, 247, 0.3); }
.card.rarity-legendary .card-inner { border-color: rgba(251, 191, 36, 0.3); }
.card.rarity-mythic .card-inner { border-color: rgba(236, 72, 153, 0.3); }

/* Title Bar */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 8px;
}

.game-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin: 0;
}

.platform-badge {
  padding: 3px 6px;
  background: rgba(99, 102, 241, 0.3);
  border: 1px solid rgba(99, 102, 241, 0.5);
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* Art Window */
.art-window {
  position: relative;
  margin: 6px;
  height: 180px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Blurred background fill (hidden by default, available for other views) */
.card-art-bg {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(20px) saturate(1.2);
  opacity: 0;
  transform: scale(1.1);
}

/* Main cover art - full bleed */
.card-art {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

/* Art shine effect */
.art-shine {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 80% 80% at var(--glow-x) var(--glow-y),
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.08) 30%,
    transparent 70%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card-container:hover .art-shine {
  opacity: 1;
}

/* Enhanced shine for higher rarities */
.card.rarity-legendary .art-shine,
.card.rarity-mythic .art-shine {
  background:
    radial-gradient(
      ellipse 80% 80% at var(--glow-x) var(--glow-y),
      rgba(255, 255, 255, 0.3) 0%,
      rgba(255, 255, 255, 0.12) 30%,
      transparent 70%
    ),
    linear-gradient(
      135deg,
      rgba(255, 215, 0, 0.1) 0%,
      transparent 50%,
      rgba(255, 215, 0, 0.08) 100%
    );
}

/* Type Line */
.type-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.12), transparent);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}

.type-item {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}

.type-item svg {
  width: 10px;
  height: 10px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.type-divider {
  color: rgba(255, 255, 255, 0.2);
  font-size: 10px;
}

.genre-tag {
  font-weight: 600;
  color: #a5b4fc;
}

.type-item.developer {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Flavor Text */
.card-text {
  flex: 1;
  padding: 8px 10px;
  overflow: hidden;
}

.flavor-text {
  font-size: 11px;
  font-style: italic;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

/* Stats Bar */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.3) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 5px;
}

.stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #00ff88;
  line-height: 1;
}

.stat-value.rating {
  color: #fbbf24;
}

.stat-value.empty {
  color: rgba(255, 255, 255, 0.2);
  font-size: 12px;
}

.stat-label {
  font-size: 8px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Game modes */
.game-modes-box {
  display: flex;
  align-items: center;
  margin-left: auto;
}

.mode-tags {
  display: flex;
  gap: 4px;
}

.mode-tag {
  padding: 5px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.mode-tag.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

/* Collection indicator in header */
.collection-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: rgba(34, 197, 94, 0.3);
  border: 1px solid rgba(34, 197, 94, 0.6);
  border-radius: 50%;
  flex-shrink: 0;
}

.collection-indicator svg {
  width: 12px;
  height: 12px;
  stroke: #4ade80;
  fill: none;
  stroke-width: 3;
}

/* Card Footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
}

.card-number {
  font-family: 'Orbitron', sans-serif;
  font-size: 8px;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 1px;
}

.card-rarity {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Rarity label colors */
.card .card-rarity { color: rgba(255, 255, 255, 0.3); }
.card.rarity-uncommon .card-rarity { color: #22c55e; }
.card.rarity-rare .card-rarity { color: #3b82f6; }
.card.rarity-epic .card-rarity { color: #a855f7; }
.card.rarity-legendary .card-rarity { color: #fbbf24; }
.card.rarity-mythic .card-rarity { color: #ec4899; }

/* Holographic overlay for legendary+ */
.holo-overlay {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  mix-blend-mode: overlay;
  transition: opacity 0.3s ease;
}

.card.rarity-legendary .holo-overlay,
.card.rarity-mythic .holo-overlay {
  background: linear-gradient(
    135deg,
    rgba(255, 0, 128, 0.1) 0%,
    rgba(255, 128, 0, 0.1) 16%,
    rgba(255, 255, 0, 0.1) 33%,
    rgba(0, 255, 128, 0.1) 50%,
    rgba(0, 128, 255, 0.1) 66%,
    rgba(128, 0, 255, 0.1) 83%,
    rgba(255, 0, 128, 0.1) 100%
  );
  background-size: 400% 400%;
  opacity: 1;
  animation: holoShift 6s ease infinite;
}

.card.rarity-mythic .holo-overlay {
  opacity: 1;
  animation: holoShift 4s ease infinite;
  mix-blend-mode: color-dodge;
}

@keyframes holoShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Card shine overlay */
.card-shine {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: radial-gradient(
    ellipse 50% 50% at var(--glow-x) var(--glow-y),
    rgba(255, 255, 255, 0.05) 0%,
    transparent 60%
  );
  pointer-events: none;
  z-index: 11;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.card-container:hover .card-shine {
  opacity: 1;
}

/* ===================
   CARD BACK STYLES
   =================== */

.card-back .card-frame {
  background: linear-gradient(160deg, #1a1a2e 0%, #12121f 50%, #0a0a12 100%);
}

.card-back .card-inner {
  position: relative;
}

/* Blurred art background for card back */
.card-back-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(30px) saturate(1.3) brightness(0.4);
  transform: scale(1.2);
  z-index: 0;
}

.card-back-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
}

/* Back header */
.card-back-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.back-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.back-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.2s;
}

.back-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: rotate(-45deg);
}

.back-close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Description */
.card-back-description {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 4px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.card-back-description::-webkit-scrollbar {
  width: 4px;
}

.card-back-description::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
}

.card-back-description::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.card-back-description p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
  margin: 0;
}

/* Platform selector */
.platform-section {
  margin-bottom: 12px;
}

.section-label {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.platform-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.platform-option {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.platform-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.platform-option.selected {
  background: rgba(99, 102, 241, 0.3);
  border-color: #6366f1;
  color: #fff;
}

/* Collection action buttons */
.collection-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.collection-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
}

.collection-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.collection-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.collection-btn.wishlist:hover {
  background: rgba(236, 72, 153, 0.2);
  border-color: #ec4899;
  color: #ec4899;
}

.collection-btn.backlog:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: #fbbf24;
  color: #fbbf24;
}

.collection-btn.playing:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #22c55e;
}

.collection-btn.completed:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
  color: #6366f1;
}

/* Active/added state */
.collection-btn.active {
  background: rgba(99, 102, 241, 0.3);
  border-color: #6366f1;
  color: #fff;
}

.collection-btn.active svg {
  fill: currentColor;
}
