/* css/pages/stat-builder.css */

.sb-page { background: #f1f5f9; min-height: 100vh; }

/* ---- Layout ---- */
.sb-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 20px 48px;
  align-items: start;
}

/* ---- Config panel ---- */
.sb-panel {
  background: #fff;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(15,23,42,.08);
  overflow: hidden;
  position: sticky;
  top: 16px;
}

.sb-panel-header {
  padding: 18px 20px 16px;
  background: linear-gradient(135deg, #07162c 0%, #1a3a6e 100%);
  border-bottom: none;
}
.sb-panel-title {
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -.02em;
}
.sb-panel-sub {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,.60);
  margin-top: 3px;
}

.sb-section {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(15,23,42,.05);
}
.sb-section:last-child { border-bottom: none; }

.sb-label {
  font-size: 11px;
  font-weight: 900;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}

/* ---- Search ---- */
.sb-search { position: relative; }
.sb-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px 10px 36px;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.sb-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
  background: #fff;
}
.sb-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 15px;
  pointer-events: none;
}
.sb-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(15,23,42,.12);
  z-index: 100;
  overflow: hidden;
  display: none;
}
.sb-suggestions.open { display: block; }
.sb-sug-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .1s;
}
.sb-sug-item:hover { background: #f1f5f9; }
.sb-sug-item img {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(15,23,42,.08);
  background: #e2e8f0;
}
.sb-sug-name { font-size: 13px; font-weight: 800; color: #0f172a; }
.sb-sug-team { font-size: 11px; font-weight: 700; color: #64748b; }

/* Selected player chip */
.sb-player-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f0f7ff;
  border: 1px solid rgba(59,130,246,.18);
  border-radius: 12px;
  margin-top: 8px;
}
.sb-player-chip img {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(15,23,42,.08);
}
.sb-player-chip-name { font-size: 13px; font-weight: 800; color: #1e40af; }
.sb-player-chip-team { font-size: 11px; font-weight: 700; color: #64748b; }
.sb-player-chip-clear {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #94a3b8;
  padding: 2px 4px;
  line-height: 1;
}
.sb-player-chip-clear:hover { color: #ef4444; }

/* ---- Period pills ---- */
.sb-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sb-pill {
  border: 1px solid rgba(15,23,42,.12);
  background: #f8fafc;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
  transition: all .12s;
}
.sb-pill:hover { background: #e0e7ff; border-color: rgba(99,102,241,.3); color: #4338ca; }
.sb-pill.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,.3);
}

/* ---- Photo upload ---- */
.sb-photo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.sb-photo-thumb {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: #e2e8f0;
  border: 2px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
  transition: border-color .12s;
}
.sb-photo-thumb:hover { border-color: #3b82f6; }
.sb-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sb-photo-actions { display: flex; flex-direction: column; gap: 6px; }
.sb-upload-label {
  display: inline-block;
  background: #f0f7ff;
  border: 1px solid rgba(59,130,246,.25);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 800;
  color: #1d4ed8;
  cursor: pointer;
  transition: background .12s;
}
.sb-upload-label:hover { background: #dbeafe; }
.sb-photo-note { font-size: 11px; font-weight: 700; color: #94a3b8; }
.sb-btn-ghost-sm {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  padding: 0;
  text-decoration: underline;
}
.sb-btn-ghost-sm:hover { color: #ef4444; }

/* ---- Color picker ---- */
.sb-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sb-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid rgba(15,23,42,.12);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}
.sb-color-swatch input[type=color] {
  width: 200%;
  height: 200%;
  margin: -25%;
  border: none;
  cursor: pointer;
  padding: 0;
}
.sb-color-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.sb-preset {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.sb-preset:hover { transform: scale(1.15); }
.sb-preset.active { border-color: #0f172a; }
.sb-color-auto {
  background: none;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
}
.sb-color-auto:hover { background: #f1f5f9; }

/* ---- Theme selector ---- */
.sb-theme-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

/* ---- Preview panel ---- */
.sb-preview { display: flex; flex-direction: column; gap: 14px; }

.sb-canvas-wrap {
  position: relative;
  background: #0b1b33;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(15,23,42,.20);
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
}
#sbCanvas {
  width: 100%;
  height: auto;
  display: block;
}
.sb-canvas-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7,22,44,.85);
  backdrop-filter: blur(2px);
  z-index: 10;
}
.sb-canvas-overlay.hidden { display: none; }
.sb-empty-state {
  text-align: center;
  color: #fff;
}
.sb-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .7; }
.sb-empty-title { font-size: 18px; font-weight: 900; letter-spacing: -.02em; margin-bottom: 6px; }
.sb-empty-sub { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.55); }

.sb-loading-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #3b82f6);
  background-size: 200% 100%;
  animation: sbSlide 1s linear infinite;
  display: none;
}
.sb-loading-bar.active { display: block; }
@keyframes sbSlide {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* ---- Preview meta ---- */
.sb-preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 2px;
}
.sb-preview-info { font-size: 12px; font-weight: 700; color: #64748b; }
.sb-preview-info span { color: #0f172a; font-weight: 900; }

/* ---- Actions ---- */
.sb-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.sb-btn-primary {
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: background .12s, box-shadow .12s, transform .1s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sb-btn-primary:hover { background: #1e40af; box-shadow: 0 6px 20px rgba(29,78,216,.3); transform: translateY(-1px); }
.sb-btn-primary:active { transform: translateY(0); box-shadow: none; }
.sb-btn-primary:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.sb-btn-secondary {
  background: #fff;
  color: #0f172a;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background .12s, box-shadow .12s;
}
.sb-btn-secondary:hover { background: #f8fafc; box-shadow: 0 4px 12px rgba(15,23,42,.08); }
.sb-btn-secondary:disabled { opacity: .45; cursor: default; }

/* ---- Status message ---- */
.sb-status {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-align: center;
  padding: 6px 0;
  min-height: 24px;
}
.sb-status.ok   { color: #16a34a; }
.sb-status.err  { color: #dc2626; }
.sb-status.info { color: #2563eb; }

/* ---- Game picker ---- */
.sb-game-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}
.sb-game-list::-webkit-scrollbar { width: 4px; }
.sb-game-list::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
.sb-game-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.sb-game-loading { font-size: 12px; font-weight: 700; color: #94a3b8; padding: 8px 0; }
.sb-game-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background .1s, border-color .1s;
}
.sb-game-item:hover { background: #eff6ff; border-color: rgba(59,130,246,.25); }
.sb-game-item.selected { background: #eff6ff; border-color: #3b82f6; }
.sb-game-date { color: #64748b; font-size: 11px; min-width: 56px; }
.sb-game-matchup { color: #0f172a; flex: 1; }
.sb-game-result { font-size: 11px; font-weight: 800; }
.sb-game-result.w { color: #16a34a; }
.sb-game-result.l { color: #dc2626; }
.sb-game-pts { color: #0f172a; }

/* Checkbox multi-game */
.sb-game-item--check { cursor: pointer; }
.sb-game-item--check:not(.selected) { opacity: .55; }
.sb-game-check {
  width: 15px;
  height: 15px;
  accent-color: #3b82f6;
  flex-shrink: 0;
  cursor: pointer;
}

/* ---- Hashtags ---- */
.sb-tags-auto {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
  min-height: 4px;
}
.sb-auto-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity .12s;
  background: rgba(59,130,246,.10);
  border: 1px solid rgba(59,130,246,.22);
  color: #1d4ed8;
  user-select: none;
}
.sb-auto-tag.off {
  background: #f1f5f9;
  border-color: rgba(15,23,42,.10);
  color: #94a3b8;
  text-decoration: line-through;
  opacity: .65;
}
.sb-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 7px;
  min-height: 4px;
}
.sb-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(139,92,246,.10);
  border: 1px solid rgba(139,92,246,.22);
  color: #7c3aed;
}
.sb-tag-chip button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #a78bfa;
  padding: 0;
  line-height: 1;
  margin-left: 2px;
}
.sb-tag-chip button:hover { color: #dc2626; }
.sb-tag-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.sb-tag-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
  outline: none;
}
.sb-tag-input:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139,92,246,.10); }
.sb-tag-add-btn {
  background: #8b5cf6;
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  font-weight: 700;
  transition: background .12s;
}
.sb-tag-add-btn:hover { background: #7c3aed; }

/* ---- Disclaimer ---- */
.sb-disclaimer {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  max-width: 1240px;
  margin: 0 auto 40px;
  padding: 14px 18px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 14px;
  font-size: 12px;
  color: #78350f;
  line-height: 1.55;
}

@media (max-width: 1272px) {
  .sb-disclaimer { margin-left: 20px; margin-right: 20px; }
}

.sb-disclaimer__icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.sb-disclaimer__text strong {
  display: block;
  font-weight: 900;
  margin-bottom: 4px;
  color: #92400e;
  font-size: 13px;
}

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .sb-layout {
    grid-template-columns: 1fr;
    padding: 12px 14px 32px;
  }
  .sb-panel {
    position: static;
  }
  .sb-preview { order: -1; }
  .sb-disclaimer { margin-left: 14px; margin-right: 14px; }
}
