/* BizBarrel badges — icons, tiers, grids */

.bb-badge {
  --bb-badge-size: 40px;
  --bb-badge-fg: #fff;
  --bb-badge-bg: linear-gradient(145deg, #b45309 0%, #92400e 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--bb-badge-size);
  height: var(--bb-badge-size);
  border-radius: 50%;
  background: var(--bb-badge-bg);
  color: var(--bb-badge-fg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 3px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  position: relative;
}

.bb-badge--compact {
  --bb-badge-size: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.15);
}

.bb-badge--prestige {
  border-radius: 6px 6px 10px 10px;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 50% 100%, 0 72%);
  padding-bottom: 4px;
}

.bb-badge--tier-bronze { --bb-badge-bg: linear-gradient(145deg, #d97706 0%, #92400e 100%); }
.bb-badge--tier-silver { --bb-badge-bg: linear-gradient(145deg, #94a3b8 0%, #64748b 100%); }
.bb-badge--tier-gold { --bb-badge-bg: linear-gradient(145deg, #fbbf24 0%, #b45309 100%); }
.bb-badge--tier-special { --bb-badge-bg: linear-gradient(145deg, #1e3a8a 0%, #ca8a04 100%); }

.bb-badge--category-founding { box-shadow: inset 0 0 0 2px rgba(250, 204, 21, 0.55), inset 0 1px 0 rgba(255,255,255,0.25), 0 1px 3px rgba(0,0,0,0.2); }

.bb-badge__glyph {
  font-size: calc(var(--bb-badge-size) * 0.42);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
  pointer-events: none;
}

.bb-badge--compact .bb-badge__glyph { font-size: calc(var(--bb-badge-size) * 0.55); }

.bb-badge--locked {
  filter: grayscale(1);
  opacity: 0.45;
}

.bb-badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.bb-badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}

html[data-theme="light"] .bb-badge-card {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(148, 163, 184, 0.45);
}

.bb-badge-card__name {
  font-size: 11px;
  line-height: 1.25;
  color: inherit;
  opacity: 0.92;
}

.bb-badge-card__actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.bb-badge-card__btn {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.bb-badge-card__btn:hover { background: rgba(148, 163, 184, 0.15); }
.bb-badge-card__btn.is-active { border-color: #2563eb; color: #2563eb; }

.account-badges-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(148, 163, 184, 0.35); }
.account-badges-section__title { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.account-badges-empty { margin: 8px 0 0; font-size: 13px; opacity: 0.75; font-style: italic; }

.pf-display-badge { display: inline-flex; vertical-align: middle; margin-left: 4px; }
.pf-member-profile__badges { margin-top: 12px; }
.pf-member-profile__badges .bb-badges-grid { justify-items: center; }

.dashboard-section--achievements .dashboard-section-body { min-height: 48px; }
.dash-badge-next { margin: 0 0 10px; font-size: 13px; opacity: 0.9; }
.dash-badge-recent { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.bb-badge--custom {
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.bb-badge__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.bb-badge--compact.bb-badge--custom {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.admin-badge-graphics-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.admin-badge-graphics-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(62vh, 520px);
  overflow: auto;
  padding-right: 4px;
}

.admin-badge-graphic-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--dialog-border, rgba(148, 163, 184, 0.35));
  border-radius: 10px;
  background: var(--surface-muted, rgba(255, 255, 255, 0.03));
  color: var(--text, inherit);
}

html[data-theme="light"] .admin-badge-graphic-row {
  background: rgba(248, 250, 252, 0.95);
}

html[data-theme="dark"] .admin-badge-graphic-row,
html[data-theme="soft"] .admin-badge-graphic-row {
  background: rgba(0, 0, 0, 0.18);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="glass"] .admin-badge-graphic-row {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-edge, rgba(255, 255, 255, 0.22));
  color: var(--text);
}

.admin-badge-graphic-row__preview {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}

.admin-badge-graphic-row__preview .bb-badge {
  --bb-badge-size: 44px;
}

.admin-badge-graphic-row__head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  margin-bottom: 6px;
}

.admin-badge-graphic-row__name {
  font-weight: 700;
  font-size: 14px;
}

.admin-badge-graphic-row__slug {
  font-size: 11px;
  opacity: 0.65;
  font-family: ui-monospace, monospace;
}

.admin-badge-graphic-row__meta {
  font-size: 11px;
  opacity: 0.7;
  text-transform: capitalize;
}

.admin-badge-graphic-row__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-badge-graphic-row__controls select,
.admin-badge-graphic-row__controls input[type="text"] {
  min-width: 140px;
  font-size: 13px;
}

.admin-badge-graphic-row__path {
  flex: 1 1 200px;
  min-width: 180px;
}

.admin-badge-graphic-row__file {
  max-width: 220px;
  font-size: 12px;
}
