/* ============================================================
   STICKERBOOK ADMIN - CONTENT (admin-content.js)
   Builds on the Reports styles in admin-theme.css (rp-*) and the
   panel pieces in admin-users.css (us-stats, us-box, us-li, us-id, us-banner).
   ============================================================ */

/* Page */
.ct-search { max-width: 640px; }
.ct-hint { font-size: 11px; color: var(--sb-muted); margin: 6px 2px 18px; }
.ct-block { margin-bottom: 22px; }
.ct-block > .rp-lbl, #ct-body > .rp-lbl { display: flex; align-items: center; gap: 8px; }
.ct-back { margin-left: auto; }

.ct-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ct-card { background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: 12px; padding: 14px; min-width: 0; }
.ct-card b { display: block; font-size: 24px; font-weight: 700; line-height: 1.1; color: var(--sb-text); }
.ct-card span { font-size: 11px; color: var(--sb-muted); }
.ct-card small { display: block; font-size: 11px; color: var(--sb-text-2); margin-top: 6px; }
.ct-card small em { font-style: normal; color: #0F766E; font-weight: 600; }

.ct-seg { margin-left: auto; display: inline-flex; gap: 2px; background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: 8px; padding: 2px; }
.ct-seg button { border: none; background: none; font-family: inherit; font-size: 11px; font-weight: 600; color: var(--sb-muted); padding: 4px 9px; border-radius: 6px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.ct-seg button.on { background: var(--sb-text); color: #fff; }

.ct-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ct-box { background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: 12px; padding: 14px; min-width: 0; }
.ct-box h3 { font-size: 12px; font-weight: 600; color: var(--sb-text-2); margin: 0 0 10px; display: flex; justify-content: space-between; align-items: baseline; }
.ct-box h3 b { font-size: 18px; color: var(--sb-text); }
.ct-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--sb-surface-2); margin-bottom: 10px; }
.ct-bar i { display: block; height: 100%; }
.ct-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11px; color: var(--sb-text-2); }
.ct-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ct-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.ct-legend b { color: var(--sb-text); margin-left: 4px; }
.ct-gap { margin-top: 8px; }
.ct-c1 { background: #6D28D9; } .ct-c2 { background: #0F766E; } .ct-c3 { background: #db2777; }
.ct-c4 { background: #c2410c; } .ct-c5 { background: #047857; }

.ct-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.ct-tab { border: 1px solid var(--sb-border); background: var(--sb-surface); font-family: inherit; font-size: 11px; font-weight: 600; color: var(--sb-text-2); padding: 5px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.ct-tab.on { background: var(--sb-text); border-color: var(--sb-text); color: #fff; }

.ct-list { background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: 12px; overflow: hidden; }
.ct-row { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-top: 1px solid var(--sb-border); cursor: pointer; }
.ct-row:first-child { border-top: none; }
.ct-row:hover { background: var(--sb-surface-2); }
.ct-row.sel { background: var(--sb-accent-soft); }
.ct-rank { width: 18px; font-size: 11px; color: var(--sb-muted); text-align: right; flex-shrink: 0; }
.ct-name { flex: 1; min-width: 0; }
.ct-name b { display: block; font-size: 13px; font-weight: 600; color: var(--sb-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-name span { display: block; font-size: 11px; color: var(--sb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-num { font-size: 13px; font-weight: 700; text-align: right; color: var(--sb-text); flex-shrink: 0; }
.ct-num small { display: block; font-size: 10px; font-weight: 500; color: var(--sb-muted); }

.ct-thumb { width: 36px; height: 36px; border-radius: 8px; background: var(--sb-surface-2); display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.ct-thumb img { width: 100%; height: 100%; object-fit: contain; }
.ct-thumb.ct-bg { width: 28px; height: 44px; border-radius: 5px; }
.ct-thumb.ct-bg img { object-fit: cover; }
.ct-thumb.ct-none { font-size: 13px; font-weight: 700; color: var(--sb-muted); }

.ct-lines { display: flex; flex-direction: column; gap: 8px; }
.ct-line { display: flex; align-items: center; gap: 10px; background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: 12px; padding: 12px 14px; font-size: 12px; color: var(--sb-text-2); }
.ct-go { margin-left: auto; border: none; background: none; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--sb-accent); cursor: pointer; white-space: nowrap; }
.ct-go.ct-quiet { color: var(--sb-muted); cursor: default; }
.ct-empty { background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: 12px; padding: 30px 20px; text-align: center; font-size: 12px; color: var(--sb-muted); }
.ct-empty b { display: block; font-size: 13px; color: var(--sb-text); margin-bottom: 2px; }

/* Panel */
.ct-hero { display: grid; place-items: center; background: var(--sb-surface-2); border-radius: 14px; padding: 18px; }
.ct-thumb.ct-big { width: 150px; height: 150px; border-radius: 12px; background: transparent; }
.ct-thumb.ct-big.ct-bg { width: 120px; height: 200px; }
.ct-thumb.ct-big.ct-none { background: var(--sb-surface); font-size: 40px; }
.ct-htitle { display: flex; align-items: flex-start; gap: 10px; }
.ct-htitle > div { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ct-htitle b { font-size: 16px; color: var(--sb-text); word-break: break-word; }
.ct-creator { margin-left: 0; font-size: 12px; }
.ct-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.ct-li { align-items: center; cursor: pointer; }
.ct-li:hover { background: var(--sb-surface-2); }
.ct-li .ct-thumb { width: 28px; height: 28px; border-radius: 6px; }
.ct-li .ct-thumb.ct-bg { width: 20px; height: 32px; }

/* Desktop: the panel docks beside the page, so the page stays clickable */
@media (min-width: 769px) {
  body.ct-docked #modal-overlay { background: transparent; pointer-events: none; }
  body.ct-docked #modal-overlay.visible #modal { pointer-events: auto; }
  body.ct-docked .sb-main-scroll { padding-right: calc(var(--sb-panel-w) + 28px); }
}
@media (max-width: 1100px) {
  body.ct-docked .ct-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.ct-docked .ct-two { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .ct-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-two { grid-template-columns: 1fr; }
  .ct-tabs { flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; }
  .ct-card b { font-size: 21px; }
  .ct-row { padding: 9px 12px; gap: 10px; }
}

/* ============================================================
   Filters, picking, Browse images grid, downloads (admin-content-images.js)
   ============================================================ */
.ct-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -6px 0 16px; }
.ct-filters:empty { display: none; }
.ct-sel { position: relative; display: inline-flex; align-items: center; }
.ct-sel select { -webkit-appearance: none; appearance: none; border: 1px solid var(--sb-border); background: var(--sb-surface); color: var(--sb-text-2); font-family: inherit; font-size: 11px; font-weight: 600; padding: 6px 26px 6px 11px; border-radius: 999px; cursor: pointer; outline: none; }
.ct-sel select:hover { background: var(--sb-surface-2); }
.ct-sel select:focus-visible { box-shadow: 0 0 0 3px var(--sb-accent-soft); }
.ct-sel select.on { background: var(--sb-text); border-color: var(--sb-text); color: #fff; }
.ct-sel .sb-ico { position: absolute; right: 8px; width: 12px; height: 12px; pointer-events: none; color: var(--sb-muted); }
.ct-sel select.on + .sb-ico { color: #fff; }
.ct-clear { border: none; background: none; font-family: inherit; font-size: 11px; font-weight: 600; color: var(--sb-accent); cursor: pointer; white-space: nowrap; padding: 4px 6px; }
#ct-body > .rp-lbl .ct-browse { margin-left: auto; }
.ct-browse { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--sb-accent); background: var(--sb-accent); color: #fff; font-family: inherit; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.ct-browse:hover { background: #5B21B6; }
.ct-browse:disabled { opacity: 0.4; cursor: default; }
.ct-browse:disabled:hover { background: var(--sb-accent); }
.ct-browse .sb-ico { width: 14px; height: 14px; }

/* Row checkboxes: show on hover, and on every row while picking */
.ct-rck { width: 20px; height: 20px; flex-shrink: 0; border-radius: 6px; border: 1.5px solid #C4C4CC; background: #fff; display: grid; place-items: center; color: #fff; cursor: pointer; opacity: 0; }
.ct-rck .sb-ico { width: 12px; height: 12px; stroke-width: 3; }
.ct-row:hover .ct-rck, .ct-picking .ct-rck { opacity: 1; }
.ct-rck.on { background: var(--sb-accent); border-color: var(--sb-accent); }
.ct-rck.off { opacity: 0.25 !important; cursor: not-allowed; }
@media (hover: none) { .ct-rck { display: none; } .ct-picking .ct-rck { display: grid; } }
.ct-pickbar { position: sticky; bottom: 12px; z-index: 5; margin-top: 14px; display: flex; align-items: center; gap: 8px; background: #18181B; color: #fff; border-radius: 12px; padding: 10px 12px; font-size: 12px; font-weight: 600; box-shadow: 0 10px 24px rgba(0,0,0,0.18); }
.ct-pickbar .ct-grow { flex: 1; }
.ct-pickbar .btn.rp-b { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); color: #fff; }
.ct-pickbar .btn.rp-b-go { background: var(--sb-accent); border-color: var(--sb-accent); }

/* Thumbnails: pages are tall like backgrounds, profile photos are round */
.ct-thumb.ct-round { border-radius: 50%; }
.ct-thumb.ct-round img { object-fit: cover; }
.ct-thumb.ct-big.ct-round { width: 150px; height: 150px; border-radius: 50%; }
.ct-li .ct-thumb.ct-round { border-radius: 50%; }

/* What a download gives you */
.ct-dl { border: 1px solid var(--sb-border); border-radius: 12px; padding: 10px 12px; font-size: 12px; color: var(--sb-text-2); line-height: 1.5; display: flex; flex-direction: column; gap: 4px; }
.ct-dl .rp-lbl { margin-bottom: 0; }
.ct-dl code { align-self: flex-start; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; background: var(--sb-surface-2); color: var(--sb-text); padding: 2px 6px; border-radius: 5px; word-break: break-all; }

/* The grid */
.ct-gtop { font-size: 12px; color: var(--sb-muted); }
.ct-gtop b { color: var(--sb-text); }
.ct-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@container panel (min-width: 560px) { .ct-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container panel (min-width: 820px) { .ct-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@container panel (min-width: 1100px) { .ct-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.ct-tile { position: relative; display: flex; flex-direction: column; border: 1.5px solid var(--sb-border); border-radius: 12px; background: #fafafa; overflow: hidden; cursor: pointer; min-width: 0; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.ct-tile:hover { border-color: #C4B5FD; }
.ct-tile.on { border-color: var(--sb-accent); box-shadow: 0 0 0 2px var(--sb-accent) inset; }
.ct-tile.off { opacity: 0.45; cursor: not-allowed; }
.ct-timg { position: relative; aspect-ratio: 1; display: grid; place-items: center; padding: 8%; }
.ct-timg img { width: 100%; height: 100%; object-fit: contain; display: block; -webkit-user-drag: none; }
.ct-timg.ct-tall { aspect-ratio: 9 / 16; padding: 0; }
.ct-timg.ct-tall img { object-fit: cover; }
.ct-timg.ct-tround { padding: 14%; }
.ct-timg.ct-tround img { border-radius: 50%; object-fit: cover; }
.ct-tnone { font-size: 22px; font-weight: 700; color: var(--sb-muted); }
.ct-tbadge { position: absolute; top: 6px; left: 6px; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 999px; background: rgba(255,255,255,0.92); color: var(--sb-text-2); box-shadow: 0 1px 2px rgba(0,0,0,0.08); max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-tck { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(24,24,27,0.3); display: grid; place-items: center; color: #fff; cursor: pointer; opacity: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.ct-tck .sb-ico { width: 12px; height: 12px; stroke-width: 3; }
.ct-tile:hover .ct-tck, .ct-picking .ct-tck { opacity: 1; }
.ct-tile.on .ct-tck { background: var(--sb-accent); }
@media (hover: none) { .ct-tck { display: none; } .ct-picking .ct-tck { display: grid; } }
.ct-tdl { position: absolute; right: 6px; bottom: 6px; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--sb-border); background: rgba(255,255,255,0.95); color: var(--sb-text-2); display: none; place-items: center; cursor: pointer; padding: 0; }
.ct-tdl .sb-ico { width: 15px; height: 15px; }
.ct-tdl:hover { color: var(--sb-accent); }
@media (hover: hover) { .ct-tile:hover .ct-tdl { display: grid; } }
.ct-picking .ct-tdl { display: none !important; }
.ct-tcap { padding: 6px 8px 7px; background: #fff; border-top: 1px solid var(--sb-border); min-width: 0; }
.ct-tcap b { display: block; font-size: 11px; font-weight: 600; color: var(--sb-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-tcap span { display: block; font-size: 10px; color: var(--sb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 13px; }
.ct-fnote { flex: 1; min-width: 0; font-size: 11px; color: var(--sb-muted); align-self: center; }
.ct-row { -webkit-touch-callout: none; }

@media (max-width: 768px) {
  .ct-filters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-right: -14px; padding-right: 14px; }
  .ct-sel select { font-size: 16px; padding: 7px 28px 7px 12px; }
  #modal .modal-footer > .ct-fnote { flex: 1 1 100%; text-align: center; min-height: 0; }
}
