/* =====================================================
   Booking Code pop-up (js/codes.js, Book Bet in the bet slip)
   A centred card over the bet slip: tick, "Booking Code", the big code,
   selections / total odds, the share link, Share / Copy and OK.
   Sea blue, purple and white like the Bet Successful panel.
   ===================================================== */

/* The .sheet is the dark layer; the card sits in the middle of it */
.sheet.bk-pop {
  inset: 0;
  left: 0;
  bottom: 0;
  z-index: 75;               /* over the bet slip (70), under the toast (80) */
  display: grid;
  grid-template-columns: minmax(0, 380px);   /* the card never grows past the screen */
  place-content: center;
  width: auto;
  max-width: none;
  max-height: none;
  padding: 16px;
  border-radius: 0;
  background: rgba(6, 12, 30, 0.6);
  box-shadow: none;
  transform: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
  overflow-y: auto;
}
.sheet.bk-pop::before { display: none; }
.sheet.bk-pop.open { opacity: 1; visibility: visible; transform: none; }

.bk-card {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  padding: 22px 18px 18px;
  border-radius: 24px;
  background: var(--card);
  color: var(--text);
  text-align: center;
  box-shadow: 0 18px 40px rgba(20, 16, 70, 0.35);
  overflow: hidden;
  transform: scale(0.94);
  transition: transform 0.2s ease;
}
.bk-pop.open .bk-card { transform: scale(1); }
.theme-dark .sheet.bk-pop { background: rgba(2, 6, 16, 0.72); }
.theme-dark .bk-card { box-shadow: 0 0 0 1px rgba(143, 211, 255, 0.16), 0 18px 40px rgba(0, 0, 0, 0.55); }
/* A sea blue to purple strip along the top of the card */
.bk-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(115deg, #0a6ea8 0%, #3b52c9 55%, #7c3aed 100%);
}

.bk-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--sea-soft, #e9f4fc);
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.bk-badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 2px auto 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a6ea8, #7c3aed);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35);
  animation: bk-pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.bk-badge.bad { background: linear-gradient(135deg, #e0435a, #b3264a); box-shadow: 0 6px 16px rgba(224, 67, 90, 0.35); }
@keyframes bk-pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.bk-title { margin: 0 0 12px; font-size: 1.3rem; }

/* The code: big, spaced out, in a soft sea blue box with a copy button */
.bk-code-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 12px 12px 18px;
  border: 1.5px dashed color-mix(in srgb, var(--purple) 55%, transparent);
  border-radius: 16px;
  background: var(--sea-soft, #e9f4fc);
}
.bk-code {
  min-width: 0;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--purple-deep, #5b21b6);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.theme-dark .bk-code { color: #fff; }
.bk-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(76, 29, 149, 0.15);
}
.theme-dark .bk-icon { color: #8fd3ff; }
.bk-icon .icon { width: 18px; height: 18px; }

.bk-note { margin: 12px 4px; color: var(--muted); font-size: 0.9rem; line-height: 1.4; }

.bk-rows {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg);
  text-align: left;
}
.bk-rows dt { color: var(--muted); }
.bk-rows dd { margin: 0; font-variant-numeric: tabular-nums; }
.bk-rows strong { font-size: 1.05rem; }

/* The share link with its own copy button */
.bk-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: left;
}
.bk-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.85rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.theme-dark .bk-url { color: #8fd3ff; }
.bk-mini {
  flex: none;
  padding: 7px 12px;
  border: none;
  border-radius: 999px;
  background: var(--purple-soft, #f1ebff);
  color: var(--purple);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.bk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.bk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.bk-btn .icon { width: 17px; height: 17px; }
.bk-btn.soft { background: var(--sea-soft, #e9f4fc); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 35%, transparent); }
.theme-dark .bk-btn.soft { color: #8fd3ff; }
.bk-btn.bk-ok { background: linear-gradient(115deg, #0a6ea8 0%, #3b52c9 55%, #7c3aed 100%); color: #fff; font-size: 1.05rem; box-shadow: 0 6px 16px rgba(124, 58, 237, 0.3); }
.bk-btn.wide, .bk-actions.one .bk-btn { grid-column: 1 / -1; }
.bk-close:focus-visible, .bk-btn:focus-visible, .bk-icon:focus-visible, .bk-mini:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* Saving and errors */
.bk-loading { display: grid; justify-items: center; gap: 12px; padding: 18px 0 10px; color: var(--muted); }
.bk-loading p { margin: 0; }
.bk-spin {
  width: 38px;
  height: 38px;
  box-sizing: border-box;
  border: 4px solid var(--line);
  border-top-color: #0a6ea8;
  border-right-color: #7c3aed;
  border-radius: 50%;
  animation: bk-turn 0.8s linear infinite;
}
@keyframes bk-turn { to { transform: rotate(360deg); } }
.bk-status { min-height: 1.3em; margin: 10px 0 0; color: var(--purple); font-size: 0.88rem; font-weight: 700; overflow-wrap: anywhere; }
.bk-status:empty { min-height: 0; margin: 0; }
.bk-error { margin: 0 4px 4px; color: var(--text); line-height: 1.4; }

@media (max-width: 340px) {
  .bk-card { padding: 20px 14px 14px; }
  .bk-code { font-size: 1.6rem; letter-spacing: 0.1em; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet.bk-pop, .bk-card { transition: none; }
  .bk-badge { animation: none; }
  .bk-spin { animation-duration: 2s; }
}
