/* Card Details Page */
.cdp-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 32px 80px;
  min-height: calc(100vh - 76px);
}

.cdp-loading, .cdp-error {
  text-align: center;
  padding: 80px 20px;
  color: #94a3b8;
  font-size: 0.9rem;
}

/* Back button */
.cdp-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: #94a3b8;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  margin-bottom: 24px;
  transition: color 0.15s, border-color 0.15s;
}
.cdp-back:hover { color: #e2e8f0; border-color: rgba(255,255,255,0.2); }

/* Hero section */
.cdp-hero {
  display: flex;
  gap: 28px;
  margin-bottom: 32px;
}

.cdp-hero-image {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cdp-hero-aside {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cdp-hero-image img {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* Card flip in hero */
.cdp-hero-image .card-flip-container { perspective: 600px; }
.cdp-hero-image .card-flip-inner {
  position: relative;
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}
.cdp-hero-image .card-flip-inner.flipped { transform: rotateY(180deg); }
.cdp-hero-image .card-flip-front,
.cdp-hero-image .card-flip-back {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  backface-visibility: hidden;
}
.cdp-hero-image .card-flip-back {
  position: absolute;
  top: 0; left: 0;
  transform: rotateY(180deg);
}
.cdp-hero-image .card-flip-btn {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
}

/* Buy links */
.cdp-buy-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cdp-buy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 6px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #4a8eff;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  transition: background 0.15s;
  white-space: nowrap;
}
.cdp-buy-link:hover { background: rgba(255,255,255,0.1); }

/* Hero info */
.cdp-hero-info {
  flex: 1;
  min-width: 0;
}

.cdp-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: #e2e8f0;
  margin: 0 0 4px;
  line-height: 1.2;
}

.cdp-set-line {
  font-size: 0.82rem;
  color: #64748b;
  margin-bottom: 12px;
}

.cdp-rarity-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.cdp-rarity-mythic { background: #f59f00; }
.cdp-rarity-rare { background: #c9a227; }
.cdp-rarity-uncommon { background: #94a3b8; }
.cdp-rarity-common { background: #475569; }

.cdp-mana-line {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 8px;
}

.cdp-type {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-bottom: 12px;
  font-weight: 500;
}

.cdp-oracle {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.65;
  white-space: pre-line;
  margin-bottom: 12px;
}

.cdp-mana-sym {
  display: inline;
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin: 0 1px;
}

.cdp-pt {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 8px;
}

.cdp-flavor {
  font-size: 0.82rem;
  font-style: italic;
  color: #64748b;
  line-height: 1.5;
  border-left: 2px solid rgba(255,255,255,0.06);
  padding-left: 12px;
  margin-top: 8px;
}

/* Prices */
.cdp-prices {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.cdp-price-item {
  display: flex;
  flex-direction: column;
}
.cdp-price-label {
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cdp-price-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #2dd4bf;
}
.cdp-price-value.tix { color: #94a3b8; font-size: 0.95rem; }

/* Sections */
.cdp-section {
  padding: 24px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.cdp-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  margin-bottom: 16px;
}

/* Legality grid */
.cdp-legality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 16px;
}
.cdp-legality-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  padding: 4px 0;
}
.cdp-legality-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cdp-legal { background: #22c55e; }
.cdp-not-legal { background: #475569; }
.cdp-banned { background: #ef4444; }
.cdp-restricted { background: #eab308; }
.cdp-legality-format { color: #94a3b8; }
.cdp-legality-label { font-weight: 500; }
.cdp-legality-label.legal { color: #22c55e; }
.cdp-legality-label.not_legal { color: #64748b; }
.cdp-legality-label.banned { color: #ef4444; }
.cdp-legality-label.restricted { color: #eab308; }

/* Rulings (collapsible) */
.cdp-rulings-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  margin-bottom: 0;
}
.cdp-rulings-toggle::before {
  content: '\25B6';
  font-size: 0.65rem;
  transition: transform 0.2s;
}
.cdp-rulings-toggle.open::before {
  transform: rotate(90deg);
}
.cdp-rulings-list {
  display: none;
  margin-top: 12px;
}
.cdp-ruling {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex;
  gap: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
}
.cdp-ruling-date {
  color: #64748b;
  flex-shrink: 0;
  width: 80px;
}
.cdp-ruling-text { color: #cbd5e1; }

/* All Printings */
.cdp-printing-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 0.82rem;
}
.cdp-printing-row:hover { background: rgba(255,255,255,0.03); }
.cdp-printing-active {
  background: rgba(74,142,255,0.08) !important;
  border-left: 3px solid #4a8eff;
  padding-left: 9px;
}
.cdp-printing-set {
  font-weight: 600;
  color: #94a3b8;
  width: 44px;
}
.cdp-printing-num {
  color: #64748b;
  width: 56px;
}
.cdp-printing-name {
  flex: 1;
  color: #cbd5e1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cdp-printing-price {
  color: #2dd4bf;
  font-weight: 500;
  width: 64px;
  text-align: right;
}

/* Deck usage */
.cdp-deck-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 0.85rem;
}
.cdp-deck-row:hover { background: rgba(255,255,255,0.03); }
.cdp-deck-qty {
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}
.cdp-deck-name { color: #e2e8f0; font-weight: 500; }
.cdp-deck-format { color: #64748b; font-size: 0.78rem; }

/* Price history placeholder */
.cdp-price-placeholder {
  color: #475569;
  font-size: 0.85rem;
  font-style: italic;
  padding: 24px 0;
}

/* Compact legalities (in hero aside) */
.cdp-legalities-compact {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cdp-legality-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  padding: 2px 0;
}

.cdp-legality-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cdp-legality-fname {
  color: #94a3b8;
  width: 90px;
}

.cdp-legality-fstatus {
  font-weight: 500;
}
.cdp-legality-fstatus.legal { color: #22c55e; }
.cdp-legality-fstatus.not_legal { color: #475569; }
.cdp-legality-fstatus.banned { color: #ef4444; }
.cdp-legality-fstatus.restricted { color: #eab308; }

/* Metagame usage */
.cdp-metagame-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.85rem;
  color: #cbd5e1;
}

.cdp-metagame-format {
  font-weight: 600;
  color: #94a3b8;
  width: 70px;
  flex-shrink: 0;
}

.cdp-metagame-stat {
  color: #cbd5e1;
}

.cdp-metagame-stat strong {
  color: #e2e8f0;
}

/* Mobile */
@media (max-width: 768px) {
  .cdp-container {
    padding: 16px;
  }
  .cdp-hero {
    flex-direction: column;
    gap: 20px;
  }
  .cdp-hero-image {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }
  .cdp-hero-aside {
    width: 100%;
  }
  .cdp-hero-aside .cdp-prices {
    flex-direction: row;
  }
  .cdp-name { font-size: 1.3rem; }
  .cdp-legality-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cdp-ruling {
    flex-direction: column;
    gap: 4px;
  }
  .cdp-ruling-date { width: auto; }
}
