/* ═══════════════════════════════════════════════════════════════════
   MODALS — game-detail modal + trailer modal
   ═══════════════════════════════════════════════════════════════════ */

/* ═════════════ GAME DETAIL MODAL ═════════════ */
.game-detail-modal {
  position: fixed; inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.game-detail-modal.active { opacity: 1; pointer-events: all; }

.game-detail-modal,
.game-detail-modal *,
.trailer-modal,
.trailer-modal *,
#cart-sidebar,
#cart-sidebar * { cursor: auto; }
.game-detail-modal button,
.trailer-modal button,
#cart-sidebar button,
.game-detail-modal .image-card-add,
.game-detail-modal .image-card-trailer { cursor: pointer; }

.game-detail-box {
  width: min(920px, 96vw);
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) 1.15fr;
  gap: 0;
  position: relative;
  background:
    radial-gradient(circle at 18% 18%, rgba(255,45,85,0.20), transparent 32%),
    radial-gradient(circle at 82% 72%, rgba(42,140,255,0.18), transparent 34%),
    rgba(8,8,22,0.98);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 0 70px rgba(204,0,0,0.32), 0 0 90px rgba(0,85,204,0.22);
  transform: translateY(18px) scale(0.96);
  transition: transform 0.25s ease;
}
.game-detail-modal.active .game-detail-box { transform: none; }

.game-detail-cover {
  position: relative;
  min-height: 340px;
  background: rgba(0,0,0,0.35);
  overflow: hidden;
}
.game-detail-cover::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 38%, rgba(5,5,16,0.88));
  pointer-events: none;
}
.game-detail-cover img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  padding: 12px;
  box-sizing: border-box;
}
.game-detail-cover.no-image { display: flex; align-items: center; justify-content: center; }
.game-detail-cover-icon {
  position: relative; z-index: 2;
  font-size: clamp(5rem, 13vw, 9rem);
  filter: drop-shadow(0 0 30px rgba(255,45,85,0.55));
}

.game-detail-platform {
  position: absolute; top: 16px; left: 16px;
  z-index: 2;
  font-family: 'Orbitron', monospace;
  font-size: 0.78rem; font-weight: 900;
  letter-spacing: 1px;
  color: white;
  background: linear-gradient(135deg, var(--red), var(--blue));
  padding: 8px 13px;
  border-radius: 999px;
  box-shadow: 0 0 22px rgba(204,0,0,0.45);
}

/* ── Gallery (multi-image detail view) ─────────────────────────── */
.game-detail-cover.has-gallery {
  min-height: 420px;
  padding-bottom: 100px;
  display: flex; flex-direction: column;
}
.game-detail-cover.has-gallery::after {
  background: linear-gradient(180deg, transparent 60%, rgba(5,5,16,0.95));
}
.detail-gallery {
  display: flex; flex-direction: column;
  width: 100%; height: 100%;
  position: relative;
}
.detail-gallery-main {
  flex: 1; min-height: 320px;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  position: relative;
}
.detail-gallery-main img {
  max-height: 320px; max-width: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.detail-gallery-thumbs {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex; gap: 15px;
  padding: 20px 24px;
  background: linear-gradient(180deg, transparent 0%, rgba(5,5,16,0.98) 20%);
  border-top: 2px solid rgba(255,255,255,0.15);
  overflow-x: auto;
  z-index: 10;
  scrollbar-width: thin;
  scrollbar-color: var(--red) rgba(255,255,255,0.1);
  justify-content: center;
  flex-wrap: nowrap;
}
.detail-gallery-thumbs::-webkit-scrollbar { height: 8px; }
.detail-gallery-thumbs::-webkit-scrollbar-thumb { background: linear-gradient(90deg, var(--red), var(--blue)); border-radius: 4px; }
.detail-gallery-thumbs::-webkit-scrollbar-track { background: rgba(255,255,255,0.1); border-radius: 4px; }

.detail-thumb {
  width: 80px; height: 80px;
  border-radius: 12px;
  object-fit: cover;
  cursor: pointer;
  border: 3px solid rgba(255,255,255,0.2);
  opacity: 0.85;
  transition: opacity 0.3s, transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  background: rgba(0,0,0,0.3);
}
.detail-thumb:hover {
  opacity: 1;
  border-color: var(--blue);
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 8px 25px rgba(42,140,255,0.4);
}
.detail-thumb.active {
  border-color: var(--red);
  opacity: 1;
  transform: scale(1.1);
  box-shadow: 0 0 25px rgba(204,0,0,0.6), 0 0 10px rgba(204,0,0,0.3);
}

/* ── Content (right side) ──────────────────────────────────────── */
.game-detail-content {
  position: relative;
  padding: 30px;
  display: flex; flex-direction: column;
  justify-content: center;
  gap: 16px;
}
.game-detail-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 20;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(0,0,0,0.45);
  transition: background 0.2s, transform 0.2s;
}
.game-detail-close:hover { background: var(--red); transform: scale(1.08); }

.game-detail-kicker {
  width: fit-content;
  font-family: 'Orbitron', monospace;
  color: var(--blue-bright);
  background: rgba(42,140,255,0.12);
  border: 1px solid rgba(42,140,255,0.22);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  letter-spacing: 1px;
}
.game-detail-condition {
  width: fit-content;
  color: #fff;
  background: linear-gradient(135deg, #ff8a00, #cc0000);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.8rem; font-weight: 900;
  box-shadow: 0 0 18px rgba(255,138,0,0.28);
}
.game-detail-condition.is-new {
  background: linear-gradient(135deg, #00b83a, #007a28);
  box-shadow: 0 0 18px rgba(0,184,58,0.42);
}
.game-detail-name {
  font-size: clamp(1.7rem, 4vw, 3.1rem);
  line-height: 1.08;
  color: white;
  font-weight: 900;
}
.game-detail-genre {
  color: rgba(255,255,255,0.58);
  font-family: 'Orbitron', monospace;
  letter-spacing: 1px;
  font-size: 0.85rem;
}
.game-detail-price {
  width: fit-content;
  color: #fff;
  font-family: 'Orbitron', monospace;
  font-size: 1.55rem; font-weight: 900;
  padding: 10px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(204,0,0,0.28), rgba(0,85,204,0.22));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 0 28px rgba(204,0,0,0.20);
  direction: ltr; unicode-bidi: embed;
}
.game-detail-price .price-old { font-size: 1.05rem; display: inline-block; margin-inline-end: 8px; vertical-align: middle; }
.game-detail-price .price-new { font-size: 1.55rem; display: inline-block; vertical-align: middle; }
.game-detail-desc {
  color: rgba(255,255,255,0.72);
  line-height: 1.8;
}
.game-detail-actions {
  display: flex; gap: 12px;
  flex-wrap: wrap; margin-top: 8px;
}
.game-detail-actions .image-card-add,
.game-detail-actions .image-card-trailer {
  min-width: 150px;
  justify-content: center;
  padding: 13px 18px;
  font-size: 0.95rem;
}

/* ═════════════ TRAILER MODAL ═════════════ */
.trailer-modal {
  position: fixed; inset: 0;
  z-index: 100000;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.trailer-modal.active { opacity: 1; pointer-events: all; }

.trailer-box {
  width: min(980px, 96vw);
  background:
    linear-gradient(135deg, rgba(204,0,0,0.18), rgba(0,85,204,0.18)),
    rgba(5,5,16,0.98);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 0 70px rgba(204,0,0,0.35), 0 0 90px rgba(0,85,204,0.25);
  transform: scale(0.96);
  transition: transform 0.25s ease;
}
.trailer-modal.active .trailer-box { transform: scale(1); }

.trailer-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 15px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.trailer-title { font-weight: 900; color: white; }
.trailer-close {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
}
.trailer-frame-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.trailer-frame-wrap iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  background: #000;
}

/* Fallback when YouTube blocks embedding */
.trailer-error-fallback {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
  background: rgba(0,0,0,0.9);
  text-align: center;
  padding: 20px; z-index: 10;
}
.trailer-error-fallback strong { font-size: 1.1rem; color: #ff6b6b; }
.trailer-error-fallback span { color: rgba(255,255,255,0.7); font-size: 0.85rem; max-width: 280px; }

.trailer-external-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #ff0000, #cc0000);
  color: white; font-weight: 700; font-size: 0.9rem;
  border-radius: 8px; text-decoration: none;
  transition: transform 0.3s, box-shadow 0.3s;
  margin-top: 8px;
}
.trailer-external-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255,0,0,0.4); }
