/* ============================================================
   In-Game Creations Library — overlay panel listing Bryce's
   custom shapes, bosses, and tank tweaks. Read-only; data comes
   from GET /api/custom/public_creations (no auth, visible items).
   Themed to match chat-panel.css (dark + cyan accent).
   ============================================================ */

:root {
  --cr-bg: rgba(10, 12, 18, 0.94);
  --cr-border: rgba(0, 200, 255, 0.25);
  --cr-accent: #00c8ff;
  --cr-accent-glow: rgba(0, 200, 255, 0.3);
  --cr-text: #d0d8e8;
  --cr-text-muted: #6a7a90;
  --cr-card-bg: rgba(20, 25, 40, 0.7);
  --cr-card-border: rgba(80, 100, 160, 0.25);
  --cr-shape: #00c8ff;
  --cr-boss: #c880ff;
  --cr-tweak: #e0c060;
  --cr-shadow: 0 0 30px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 200, 255, 0.1);
  --cr-font: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
  --cr-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Launcher button (sits to the right of the chat 🤖 button) --- */
#creations-toggle-btn {
  position: fixed;
  top: 24px;
  left: 84px;            /* 24 (chat) + 48 (chat width) + 12 (gap) */
  z-index: 10000;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid var(--cr-border);
  background: var(--cr-bg);
  color: var(--cr-accent);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--cr-shadow);
  transition: all var(--cr-transition);
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

#creations-toggle-btn:hover {
  border-color: var(--cr-accent);
  box-shadow: 0 0 20px var(--cr-accent-glow);
  transform: scale(1.08);
}

#creations-toggle-btn:active {
  transform: scale(0.95);
}

/* --- Panel container (slides in from the RIGHT) --- */
#creations-panel-container {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 94vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--cr-transition);
  font-family: var(--cr-font);
  background: var(--cr-bg);
  border-left: 1.5px solid var(--cr-border);
  box-shadow: var(--cr-shadow);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

#creations-panel-container.open {
  transform: translateX(0);
  pointer-events: auto;
}

/* --- Header --- */
.cr-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--cr-border);
  flex-shrink: 0;
}

.cr-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--cr-accent);
  text-shadow: 0 0 16px var(--cr-accent-glow);
  flex: 1;
}

.cr-header-btn {
  background: transparent;
  border: 1px solid var(--cr-border);
  color: var(--cr-text);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--cr-transition);
}

.cr-header-btn:hover {
  border-color: var(--cr-accent);
  color: var(--cr-accent);
}

/* --- Scrollable body --- */
.cr-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 28px;
}

.cr-body::-webkit-scrollbar { width: 8px; }
.cr-body::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
.cr-body::-webkit-scrollbar-thumb {
  background: rgba(0, 200, 255, 0.2);
  border-radius: 4px;
}

/* --- Section heading --- */
.cr-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 2px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--cr-text-muted);
}
.cr-section-title:first-child { margin-top: 4px; }

.cr-count {
  background: rgba(0, 200, 255, 0.12);
  color: var(--cr-accent);
  padding: 1px 8px;
  border-radius: 9px;
  font-size: 11px;
}

/* --- Cards --- */
.cr-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--cr-card-bg);
  border: 1px solid var(--cr-card-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: all var(--cr-transition);
}

.cr-card:hover {
  border-color: var(--cr-accent);
  transform: translateX(-3px);
}

/* Color/shape preview swatch */
.cr-swatch {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #0a0c12;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.cr-card-main { flex: 1; min-width: 0; }

.cr-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #e6ecf6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cr-card-meta {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--cr-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.cr-card-meta code {
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 11px;
  color: #e0c080;
}

.cr-type-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 8px;
}
.cr-type-badge.shape { background: rgba(0, 200, 255, 0.15); color: var(--cr-shape); }
.cr-type-badge.boss  { background: rgba(200, 128, 255, 0.15); color: var(--cr-boss); }
.cr-type-badge.tweak { background: rgba(224, 192, 96, 0.14); color: var(--cr-tweak); }

/* --- Empty / loading / error states --- */
.cr-empty, .cr-state {
  text-align: center;
  color: var(--cr-text-muted);
  font-size: 13px;
  padding: 18px 12px;
  line-height: 1.5;
}
.cr-state.error { color: #ff7a7a; }

.cr-empty-all {
  text-align: center;
  color: var(--cr-text-muted);
  padding: 48px 24px;
  font-size: 14px;
  line-height: 1.6;
}
.cr-empty-all .big { font-size: 32px; display: block; margin-bottom: 10px; }

/* --- Footer hint --- */
.cr-footer {
  flex-shrink: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--cr-border);
  font-size: 11px;
  color: var(--cr-text-muted);
  text-align: center;
}

/* --- Mobile --- */
@media (max-width: 600px) {
  #creations-toggle-btn { top: 12px; left: 72px; width: 42px; height: 42px; font-size: 19px; }
  #creations-panel-container { width: 100vw; }
}
