/* Modal Backdrop */
.spirit-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.spirit-modal.visible {
  display: flex;
}

.modal-box {
  position: relative;
  background: #141822;
  border: 3px solid var(--smash-gold);
  width: 100%;
  max-width: 540px;
  display: flex;
  box-shadow: 0 15px 40px rgba(0,0,0,0.95);
  border-radius: 4px;
  overflow: hidden;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
}
.modal-close:hover { color: #fff; }

/* Left Column: Zoom Inspector & Authenticity Proof */
.modal-card-col {
  width: 48%;
  background: #0a0d14;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border-right: 2px solid #222;
}

.zoom-container {
  position: relative;
  width: 100%;
  height: 270px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: crosshair;
  background: #000;
  border: 1px solid #333;
  border-radius: 4px;
}

.zoom-container img {
  max-width: 90%;
  max-height: 95%;
  object-fit: contain;
  transition: transform 0.1s ease-out;
}

.zoom-lens {
  position: absolute;
  width: 70px;
  height: 70px;
  border: 2px solid var(--smash-gold);
  border-radius: 50%;
  background: rgba(251, 215, 67, 0.15);
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
}

.proof-toggle-bar {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
}

.tab-btn {
  flex: 1;
  background: #1e2536;
  color: #aaa;
  border: 1px solid #3d4963;
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: bold;
  padding: 6px;
  border-radius: 3px;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--smash-gold);
  color: #000;
  border-color: #000;
}

.zoom-tip {
  font-family: Arial, sans-serif;
  font-size: 0.65rem;
  color: #77849c;
  margin-top: 6px;
}

.modal-tier {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--smash-gold);
}

/* Right Column: Information & Actions */
.modal-data-col {
  width: 52%;
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.modal-data-col h2 {
  font-size: 1.45rem;
  font-style: italic;
  margin-bottom: 6px;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.modal-tags .tag {
  background: #252e42;
  font-family: Arial, sans-serif;
  font-size: 0.68rem;
  padding: 3px 7px;
  border-radius: 2px;
  color: #cbd5e1;
}

.modal-specs {
  font-family: Arial, sans-serif;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #232938;
  padding-bottom: 4px;
}

/* "display: flex" above would otherwise beat the hidden attribute
   (used to hide the "Sold:" row on cards that aren't sold) */
.spec-item[hidden] { display: none; }

.spec-item .label { color: #8a96aa; }
.spec-item .price { color: #00ff88; font-weight: bold; font-size: 1.05rem; }

.modal-ctas {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spirit-btn {
  padding: 9px;
  font-family: 'Arial Black', sans-serif;
  font-size: 0.82rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transform: skew(-10deg);
  border: 2px solid #000;
}

.spirit-btn.buy {
  background: var(--smash-gold);
  color: #000;
}
.spirit-btn.buy:hover { background: #ffe47a; }

.spirit-btn.sold-test {
  background: var(--sold-red);
  color: #fff;
}
.spirit-btn.sold-test:hover { background: #ff3333; }

@media (max-width: 768px) {
  .modal-box {
    flex-direction: column;
    /* Taller photo below can make the window taller than the screen: scroll it */
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
  }
  .modal-card-col, .modal-data-col {
    width: 100%;
  }
  .zoom-container {
    height: min(52vh, 420px);
  }
  /* The close button sits over the photo on phones: give it a solid circle */
  .modal-box > .modal-close {
    width: 36px;
    height: 36px;
    top: 6px;
    right: 6px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
  }
  .zoom-container img {
    max-width: 100%;
    max-height: 100%;
  }
}

/* Only show the zoom tip that matches the device */
.zoom-tip-touch { display: none; }

@media (hover: none), (pointer: coarse) {
  .zoom-tip-mouse { display: none; }
  .zoom-tip-touch { display: inline; }
  .zoom-container { cursor: zoom-in; }
  .zoom-lens { display: none !important; }
}

/* Full-screen photo viewer (touch screens) */
.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 300; /* above the card window */
  background: #000;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none; /* we handle pinch and drag ourselves */
  user-select: none;
  -webkit-user-select: none;
}

.photo-viewer.visible {
  display: flex;
}

.photo-viewer img {
  /* Fit the whole photo on screen with nothing cut off */
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  -webkit-user-drag: none;
}

/* Shown until the full-size photo has downloaded */
.photo-viewer-loading {
  position: absolute;
  color: #bbb;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  display: none;
  pointer-events: none;
}

.photo-viewer.loading .photo-viewer-loading { display: block; }
.photo-viewer.loading img { visibility: hidden; }

.photo-viewer-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
}

.photo-viewer-tip {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #ddd;
  font-family: 'Open Sans', sans-serif;
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
}
/* Stripe checkout modal (Stripe's form is light, so the box is white) */
.checkout-box {
  position: relative;
  background: #fff;
  border: 3px solid var(--smash-gold);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 40px 8px 8px;
  border-radius: 4px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.95);
}

.checkout-box .modal-close:hover { color: #000; }

.checkout-status {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.9rem;
  color: #333;
  text-align: center;
  padding: 0 40px 10px;
}

.checkout-queue {
  font-family: 'Open Sans', sans-serif;
  color: #222;
  text-align: center;
  padding: 16px 20px 24px;
}

.checkout-queue h3 {
  font-family: 'Montserrat', sans-serif;
  margin: 0 0 8px;
}

.checkout-queue .queue-place {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  margin: 12px 0;
}

/* Sold card details: "Sold: 3 days ago" row and a dead SOLD button */
.sold-ago {
  color: #ff5a5a;
  font-weight: bold;
}

.spirit-btn.buy.sold,
.spirit-btn.buy:disabled.sold {
  background: var(--sold-red);
  color: #fff;
  cursor: not-allowed;
}

/* "Card has been sold" notice for people who were in the queue */
.checkout-queue .sold-notice-stamp {
  display: inline-block;
  margin: 4px 0 14px;
  padding: 4px 22px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1.6rem;
  font-weight: 900;
  font-style: italic;
  color: #fff;
  background: var(--sold-red);
  border-top: 3px solid #fff;
  border-bottom: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--sold-red);
  transform: rotate(-6deg);
}

/* Breathing room above LEAVE QUEUE / BACK TO BOARD */
.checkout-queue .spirit-btn {
  margin-top: 16px;
}
