/* ============================================
   LEAKS & UPCOMING — Barto Club
   Inherits theme variables from style.css:
   --bg --surface --border --text --text-muted --accent
   ============================================ */

:root {
  --card-ratio: 367 / 512;
  --leak-card-w: 150px;
}

.leaks-intro {
  max-width: 900px;
  margin: 16px auto 0;
  padding: 0 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

/* ---- TABS ---- */
.leak-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 20px 24px 12px;
  max-width: 1200px;
  margin: 0 auto;
}

.leak-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  height: 38px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.leak-tab:hover { border-color: var(--accent); }
.leak-tab.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  box-shadow: 0 0 0 1px var(--accent);
}

.leak-tab.add-tab {
  color: var(--accent);
  border-style: dashed;
}

/* ---- SET PANEL ---- */
.leak-set {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 24px 40px;
}

.leak-set-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.leak-set-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

.leak-set-blurb {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  flex: 1 1 300px;
  min-width: 260px;
}

.leak-set-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.leak-count-badge {
  font-size: 13px;
  color: var(--text-muted);
}
.leak-count-badge strong { color: var(--accent); }

/* ---- ADMIN CONTROLS ---- */
.admin-only { display: none !important; }
body.is-admin .admin-only { display: inline-flex !important; }
body.is-admin .admin-only-block { display: block; }

.admin-btn {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter 0.15s;
}
.admin-btn:hover { filter: brightness(1.15); }
.admin-btn.subtle {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-muted);
}

/* ---- CARD GRID (binder style) ---- */
.leak-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--leak-card-w), 1fr));
  gap: 12px;
}

/* Tile = card image + label underneath */
.leak-tile {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.leak-tile-label {
  font-size: 12px;
  text-align: center;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leak-tile-label.muted { opacity: 0.55; }

.leak-slot {
  position: relative;
  aspect-ratio: var(--card-ratio);
  border-radius: 8px;
  overflow: hidden;
}

/* Revealed card */
.leak-card {
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  background: var(--surface);
}
.leak-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.leak-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Empty slot placeholder */
.leak-slot.empty {
  border: 2px dashed var(--border);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.leak-slot.empty .slot-num {
  font-size: 22px;
  font-weight: 700;
  opacity: 0.9;
  z-index: 2;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
body.is-admin .leak-slot.empty { cursor: pointer; }
body.is-admin .leak-slot.empty:hover {
  border-color: var(--accent);
  color: var(--accent);
}
body.is-admin .leak-slot.empty:hover img { filter: none; }

/* Card-back placeholder images */
.leak-slot.is-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Empty slots: greyed-out back */
.leak-slot.empty.is-back {
  border: 1px solid var(--border);
  padding: 0;
  overflow: hidden;
}
.leak-slot.empty.is-back img {
  filter: grayscale(0.85) brightness(0.55);
  transition: filter 0.15s;
}
.leak-modal-art.is-back { aspect-ratio: var(--card-ratio); }
.leak-modal-art.is-back img { height: 100%; object-fit: contain; background: var(--surface); }

/* Card number label */
.leak-card-num {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  z-index: 2;
}

/* Alt-art count indicator */
.leak-alt-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: color-mix(in srgb, #06d6a0 85%, black);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  z-index: 2;
}

/* New/just-added flash */
.leak-card.is-new::after {
  content: "NEW";
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  z-index: 2;
}

/* ---- MODAL ---- */
.leak-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 24px;
}
.leak-modal-overlay.open { display: flex; }

.leak-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 1080px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

.leak-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}
.leak-modal-close:hover { color: var(--text); }

.leak-modal-body {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

/* Base + alt arts shown side by side */
.leak-modal-arts {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.leak-modal-art {
  width: 340px;
  max-width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border);
  position: relative;
  align-self: flex-start;
  line-height: 0;
}
/* single-card mode (cycle through versions) */
.leak-modal-art.single { width: 380px; }
.leak-modal-art.cyclable { cursor: pointer; }
.leak-modal-art img { width: 100%; height: auto; display: block; }

/* Black "click to view alt arts" bar, like the main card view */
.art-cycle-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.78);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 8px;
  line-height: 1.2;
  opacity: 0;
  transition: opacity 0.15s;
}
.leak-modal-art.cyclable:hover .art-cycle-hint { opacity: 1; }
.art-edit-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.15s;
  line-height: 1.2;
}
.leak-modal-art:hover .art-edit-hint { opacity: 1; }
.leak-modal-art .art-label {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
}

.leak-modal-info {
  flex: 1 1 280px;
  min-width: 260px;
}
.leak-modal-info h2 { font-size: 24px; margin: 0 0 2px; }
.leak-modal-info .modal-id {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.leak-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 20px;
  margin-bottom: 16px;
}
.leak-stat {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  font-size: 14px;
}
.leak-stat .label { color: var(--text-muted); }
.leak-stat .value { font-weight: 500; }

.leak-effect {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 10px;
}
.leak-effect-trigger { margin-top: 10px; }

/* ---- EDIT/UPLOAD FORM ---- */
.leak-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 600;
  padding: 24px;
}
.leak-form-overlay.open { display: flex; }

.leak-form {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}
.leak-form h3 { margin: 0 0 16px; font-size: 18px; }

/* Two-column form: image left, fields right */
.leak-form-cols {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 720px) {
  .leak-form-cols { grid-template-columns: 1fr; }
}
.leak-form-imgcol { position: sticky; top: 0; }
.leak-form-imgcol .img-preview img { width: 100%; max-width: 260px; }

.leak-form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.leak-form-row label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.leak-form-row input,
.leak-form-row textarea,
.leak-form-row select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}
.leak-form-row textarea { min-height: 70px; resize: vertical; }
.leak-form-row input:focus,
.leak-form-row textarea:focus,
.leak-form-row select:focus {
  outline: none;
  border-color: var(--accent);
}

.leak-form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.leak-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.form-btn {
  height: 38px;
  padding: 0 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.form-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.form-btn.primary:hover { filter: brightness(1.1); }
.form-btn.danger {
  border-color: #d46a6a;
  color: #d46a6a;
  background: none;
}

/* Image upload / preview */
.img-drop {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.img-drop:hover { border-color: var(--accent); }
.img-preview {
  margin-top: 10px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.img-preview img {
  width: 120px;
  aspect-ratio: var(--card-ratio);
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.img-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.empty-set-msg {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* Loading */
.leak-loading {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
}
.leak-loading::after {
  content: "";
  display: block;
  width: 30px;
  height: 30px;
  margin: 16px auto;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: leak-spin 0.8s linear infinite;
}
@keyframes leak-spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid #4ea87a;
  color: #4ea87a;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.3s ease;
  z-index: 700;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: #d46a6a; color: #d46a6a; }

/* Admin status in header */
.admin-status {
  font-size: 13px;
  color: var(--text-muted);
  align-self: center;
  margin-right: 4px;
}
.admin-status.ok { color: #4ea87a; font-weight: 600; }

/* Reprint section + badges */
.reprint-header {
  margin: 28px 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.leak-reprint-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0,0,0,0.72);
  color: #ffd166;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  z-index: 2;
}
.leak-reprint-note {
  font-size: 13px;
  color: #ffd166;
  margin-bottom: 10px;
  font-style: italic;
}

/* View-only elements (inverse of .admin-only) */
.view-only { display: inline-flex; }
body.is-admin .view-only { display: none; }

/* Clickable variant arts */
.clickable-art { cursor: pointer; transition: transform 0.12s, border-color 0.12s; }
.clickable-art:hover { transform: translateY(-3px); }
.art-action {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.12s;
}
.clickable-art:hover .art-action { opacity: 1; }

/* Release date under set title */
.leak-set-release {
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
  margin: 2px 0 6px;
}

/* Alt-art hover popup (grid) — mini card preview with effect text */
.alt-popup {
  position: fixed;
  z-index: 450;
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 12px;
  width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 28px rgba(0,0,0,0.55);
  pointer-events: none;
}
.alt-popup.show { display: flex; }
.alt-pop-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.alt-pop-item img {
  width: 150px;
  flex-shrink: 0;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.alt-pop-body { flex: 1 1 auto; min-width: 0; }
.alt-pop-head { margin-bottom: 6px; }
.alt-pop-name { font-size: 15px; font-weight: 600; display: block; }
.alt-pop-id { font-size: 12px; color: var(--text-muted); }
.alt-pop-effect {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  margin-top: 5px;
}
