/**
 * @file        sg-badges.css
 * @description Styles of the badges module: generated badge images with tier rings, badge grid, detail, sets, pin slots, profile section, certificates; Phase 7 mockup layout of Q7-05 to Q7-09 (mobile first, light and dark)
 *
 * @author      Thomas Dobler - SYNTHETIXMIND LTD
 * @company     SYNTHETIXMIND LTD, Paphos, Cyprus
 * @url         https://synthetixmind.com
 *
 * @uid         5d7e2b94-0a6c-4f31-8e2d-6c9b4f1a7e35
 * @version     0.2.0.2
 * @created     2026-12-02
 * @updated     2026-12-04
 *
 * @copyright   (c) 2026 by SYNTHETIXMIND LTD
 * @license     Proprietary — All rights reserved
 */

/* Tier rings: neutral content colours, not the orange focal point. Dark mode lifts them a little. */
.sg-bdg-img { flex: none; color: var(--ink-muted); }
.sg-bdg-img__ring { stroke: var(--border-strong); }
.sg-bdg-img__face { fill: transparent; }
.sg-bdg-img--bronze { --sg-bdg-tier: #a8692e; }
.sg-bdg-img--silver { --sg-bdg-tier: #7d8893; }
.sg-bdg-img--gold { --sg-bdg-tier: #b8860b; }
.sg-bdg-img--platinum { --sg-bdg-tier: #4f8296; }
.sg-bdg-img--none { --sg-bdg-tier: #6b7680; }
.sg-bdg-img .sg-bdg-img__ring { stroke: var(--sg-bdg-tier); }
.sg-bdg-img--earned { color: #fff; }
.sg-bdg-img--earned .sg-bdg-img__face { fill: var(--sg-bdg-tier); }
/* Dark: the system preference unless the visitor chose light, or the explicit dark choice of the theme switch. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sg-bdg-img--bronze { --sg-bdg-tier: #c98a4f; }
  :root:not([data-theme="light"]) .sg-bdg-img--silver { --sg-bdg-tier: #a3adb7; }
  :root:not([data-theme="light"]) .sg-bdg-img--gold { --sg-bdg-tier: #d6a737; }
  :root:not([data-theme="light"]) .sg-bdg-img--platinum { --sg-bdg-tier: #79aec2; }
  :root:not([data-theme="light"]) .sg-bdg-img--none { --sg-bdg-tier: #8b96a1; }
}
:root[data-theme="dark"] .sg-bdg-img--bronze { --sg-bdg-tier: #c98a4f; }
:root[data-theme="dark"] .sg-bdg-img--silver { --sg-bdg-tier: #a3adb7; }
:root[data-theme="dark"] .sg-bdg-img--gold { --sg-bdg-tier: #d6a737; }
:root[data-theme="dark"] .sg-bdg-img--platinum { --sg-bdg-tier: #79aec2; }
:root[data-theme="dark"] .sg-bdg-img--none { --sg-bdg-tier: #8b96a1; }

/* Shared pieces of the Phase 7 mockups: page head, eyebrow, tags, pill, banner, section head, segmented filter. */
.sg-bdg-icon { width: 20px; height: 20px; flex: none; }
.sg-bdg-head { margin: 0 0 16px; }
.sg-bdg-head h1 { margin-bottom: 4px; }
.sg-bdg-head .sg-lead { margin: 0; }
.sg-bdg-eyebrow { display: block; margin: 0 0 6px; font-family: var(--font-mono); font-size: .75rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.sg-bdg-tag { display: inline-block; padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: .75rem; font-weight: 500; color: var(--ink-muted); white-space: nowrap; }
.sg-bdg-tag--solid { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.sg-bdg-tag--warn { border-style: dashed; }
.sg-bdg-tag--warm { background: var(--beige); border-color: var(--border-warm); color: var(--warm-ink); }
.sg-bdg-pill { display: inline-block; padding: 2px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-size: .8rem; color: var(--ink); white-space: nowrap; }
.sg-bdg-banner { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid var(--border-warm); border-radius: var(--radius); background: var(--beige); color: var(--warm-ink); }
.sg-bdg-section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 0 0 12px; }
.sg-bdg-section-head h2 { font-size: 1.15rem; margin: 0; }
.sg-bdg-section-head .sg-hint { margin: 0; }
.sg-bdg-section-head .sg-mono { color: var(--ink-muted); font-size: .85rem; }
.sg-bdg-more { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 500; }
.sg-bdg-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 6px 10px; font-size: .9rem; }
.sg-bdg-btn--navy { background: var(--ink); border: 1px solid var(--ink); color: var(--bg); border-radius: var(--radius-sm); cursor: pointer; }
.sg-bdg-btn[disabled] { opacity: .5; cursor: not-allowed; }
.sg-button .sg-bdg-icon { margin-right: 2px; }

/* Q7-05 toolbar: segmented filter (navy when chosen), secret count and earned count. */
.sg-bdg-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 20px; }
.sg-bdg-seg { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sg-bdg-seg a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: var(--radius-sm); color: var(--ink-muted); text-decoration: none; font-weight: 500; }
.sg-bdg-seg a[aria-current] { background: var(--ink); color: var(--bg); }
.sg-bdg-toolbar__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0; font-size: .85rem; color: var(--ink-muted); }
.sg-bdg-secret { display: inline-flex; align-items: center; gap: 6px; }
.sg-bdg-summary { text-transform: uppercase; letter-spacing: .04em; }

/* Q7-05 groups and cards: one column at 360 px, two from 768 px; the whole card opens the detail. */
.sg-bdg-group { margin: 0 0 24px; }
.sg-bdg-group__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.sg-bdg-group__head h2 { font-size: 1.2rem; margin: 0; }
.sg-bdg-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 768px) { .sg-bdg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sg-bdg-tile { position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); min-width: 0; }
.sg-bdg-tile:hover { border-color: var(--border-strong); }
.sg-bdg-tile:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.sg-bdg-tile__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sg-bdg-tile__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.sg-bdg-tile__name { font-family: var(--font-head); font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.sg-bdg-tile__name::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.sg-bdg-tile__name:focus-visible { outline: none; }
.sg-bdg-tile:not(.sg-bdg-tile--earned) .sg-bdg-tile__name { color: var(--ink-muted); }
.sg-bdg-tile__tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.sg-bdg-tile__rarity, .sg-bdg-tile__meta, .sg-bdg-tile__date { margin: 0; font-size: .85rem; color: var(--ink-muted); }
.sg-bdg-tile__date { color: var(--warm-ink); }
.sg-bdg-tile .sg-pts-bar { width: 100%; margin: 2px 0 0; }

/* Q7-06 detail: emblem with tier pill, then group, rarity, name, description, rule, progress and the earned footer. */
.sg-bdg-detail__card { display: flex; flex-direction: column; gap: 20px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--surface); }
@media (min-width: 768px) { .sg-bdg-detail__card { flex-direction: row; align-items: flex-start; padding: 28px; } }
.sg-bdg-detail__emblem { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.sg-bdg-detail__emblem .sg-bdg-img { width: min(144px, 40vw); height: auto; }
.sg-bdg-detail__body { flex: 1; min-width: 0; }
.sg-bdg-detail__body h1 { margin: 0 0 8px; overflow-wrap: anywhere; }
.sg-bdg-detail__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 6px; }
.sg-bdg-detail__meta .sg-bdg-eyebrow { margin: 0; }
.sg-bdg-detail__rarity { font-size: .8rem; color: var(--ink-muted); }
.sg-bdg-detail__desc { color: var(--ink-muted); }
.sg-bdg-rule { display: flex; align-items: flex-start; gap: 10px; padding: 12px; margin: 0 0 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.sg-bdg-rule p { margin: 0; }
.sg-bdg-rule .sg-bdg-eyebrow { margin-bottom: 2px; }
.sg-bdg-detail__rule { font-weight: 600; }
.sg-bdg-progress { margin: 0 0 16px; }
.sg-bdg-progress__head { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-weight: 500; }
.sg-bdg-progress__head .sg-mono { color: var(--ink-muted); font-weight: 500; }
.sg-bdg-detail__ended { margin: 0 0 16px; }
.sg-bdg-detail__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--border); }
.sg-bdg-detail__date, .sg-bdg-pinned { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--warm-ink); font-weight: 500; }
.sg-bdg-pinned { flex-wrap: wrap; color: var(--ink); }
.sg-bdg-detail .sg-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sg-bdg-detail .sg-actions .sg-button { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
.sg-bdg-detail .sg-actions .sg-button[hidden] { display: none; }
.sg-bdg-share { margin: 16px 0 0; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.sg-bdg-share__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.sg-bdg-share__head .sg-bdg-eyebrow { margin: 0; }
.sg-bdg-share__head .sg-mono { font-size: .8rem; color: var(--ink-muted); }
.sg-bdg-share__card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius); background: #1C2C37; color: #F2F4F6; }
.sg-bdg-share__text { flex: 1 1 160px; display: flex; flex-direction: column; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.sg-bdg-share__text .sg-mono { font-size: .8rem; color: #B4BEC8; }
.sg-bdg-share__name { font-family: var(--font-head); font-weight: 600; }
.sg-bdg-share__brand { font-family: var(--font-mono); font-size: .8rem; }

/* Q7-07 sets: list rows with bars; the set page puts the list beside the set from 1,024 px. */
.sg-bdg-sets { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sg-bdg-set { position: relative; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sg-bdg-set--current { border-color: var(--ink); }
.sg-bdg-set__link { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; min-height: 28px; color: var(--ink); text-decoration: none; }
.sg-bdg-set__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.sg-bdg-set__link .sg-mono { color: var(--ink-muted); font-size: .85rem; }
.sg-bdg-set__name { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.sg-bdg-set:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.sg-bdg-set__link:focus-visible { outline: none; }
.sg-bdg-set .sg-pts-bar { margin: 6px 0 0; }
.sg-bdg-setpage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1024px) { .sg-bdg-setpage { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: start; } .sg-bdg-setside { order: -1; } }
.sg-bdg-setcard__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.sg-bdg-setcard__head h1 { margin: 0; overflow-wrap: anywhere; }
.sg-bdg-map { margin: 16px 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); max-width: 100%; overflow: hidden; }
.sg-bdg-map svg { width: 100%; height: auto; }
.sg-bdg-map__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 0 0 8px; }
.sg-bdg-map__head .sg-bdg-eyebrow { margin: 0; }
.sg-bdg-legend { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; color: var(--ink-muted); }
.sg-bdg-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sg-bdg-sw { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--border-strong); border-radius: 2px; background: var(--bg); }
.sg-bdg-sw--visited { background: repeating-linear-gradient(45deg, #6B2D19 0 3px, #8A4A33 3px 5px); border-color: #6B2D19; }
.sg-bdg-sw--visited.sg-bdg-sw--region { background: #A0502F; }
.sg-bdg-areas { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0 0 16px; }
@media (min-width: 640px) { .sg-bdg-areas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sg-bdg-areas h2.sg-bdg-eyebrow { font-size: .75rem; margin: 0 0 6px; }
.sg-bdg-members { margin: 0; padding-left: 1.2em; overflow-wrap: anywhere; }
.sg-bdg-members--done { color: var(--ink-muted); }
.sg-bdg-reward { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-warm); border-radius: var(--radius); background: var(--beige); }
.sg-bdg-reward__text { flex: 1 1 160px; display: flex; flex-direction: column; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.sg-bdg-reward__text .sg-bdg-eyebrow { margin: 0; }
.sg-bdg-reward__name { font-weight: 600; }
.sg-bdg-reward__tier { color: var(--ink-muted); font-weight: 400; }
.sg-bdg-reward__status { margin: 0; font-size: .85rem; color: var(--warm-ink); }

/* Q7-09 picker: numbered slots with move and remove, locked extra slots, earned badges as rows of cards. */
.sg-bdg-slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sg-bdg-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-height: 56px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.sg-bdg-slot__num { width: 2em; flex: none; color: var(--ink-muted); font-size: .85rem; }
.sg-bdg-slot__text, .sg-bdg-pick__text { flex: 1 1 120px; display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.sg-bdg-slot__name, .sg-bdg-pick__name { font-weight: 600; }
.sg-bdg-slot__meta, .sg-bdg-pick__meta { font-size: .8rem; color: var(--ink-muted); }
.sg-bdg-slot__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.sg-bdg-slot--free { border-style: dashed; border-color: var(--border-strong); background: transparent; color: var(--ink-muted); }
.sg-bdg-slot--locked { color: var(--ink-muted); }
.sg-bdg-pickgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 640px) { .sg-bdg-pickgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sg-bdg-pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.sg-bdg-slot form, .sg-bdg-pick form { margin: 0; }

/* Q7-08 profile section: head with count and "All badges", pinned cards large, recent badges as a row. */
.sg-bdg-profile__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 0 0 12px; }
.sg-bdg-profile__head h2 { margin: 0; }
.sg-bdg-profile h2 .sg-mono { font-family: var(--font-mono); color: var(--ink-muted); font-weight: 400; font-size: .85rem; }
.sg-bdg-pins { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 640px) { .sg-bdg-pins { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sg-bdg-pin { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-warm); border-radius: var(--radius-lg); background: var(--beige); min-width: 0; }
.sg-bdg-pin__text { min-width: 0; overflow-wrap: anywhere; }
.sg-bdg-pin__name { font-size: 1rem; margin: 4px 0 2px; }
.sg-bdg-pin__date { margin: 0; font-size: .85rem; color: var(--warm-ink); }
.sg-bdg-recent { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 640px) { .sg-bdg-recent { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .sg-bdg-recent { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sg-bdg-recent__item { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sg-bdg-recent__text { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.sg-bdg-recent__name { font-weight: 500; }
.sg-bdg-recent__text .sg-mono { font-size: .8rem; color: var(--ink-muted); }

.sg-bdg-cert { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.sg-bdg-cert__title { font-weight: 600; flex: 1 1 160px; }
.sg-bdg-cert .sg-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Admin: rule builder and member picker. */
.sg-bdg-state { display: flex; align-items: center; gap: 12px; }
.sg-bdg-editor fieldset { border: 1px solid var(--border); border-radius: 12px; margin: 0 0 16px; padding: 12px; min-width: 0; }
.sg-bdg-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; max-height: 360px; overflow-y: auto; }
.sg-bdg-checks .sg-check { min-height: 32px; }
