/*
 * custom-badges.css — [ÖZEL ROZET] Özel Rozetler sayfası (docs/design-system.md §7.85).
 * Yetki Düzenleme kalıbı (.rl, roles-page.css): solda öncelik sırasıyla rozetler,
 * sağda Tasarım / Üyeler. Tasarımın merkezi yapışkan canlı önizleme: sahte profil
 * kartı (efekt kartın içinde .pfx, arkasında .pfx-out; profile-fx.css) ve altında
 * auralı madalyon (reward-badge.css). Rozetin rengi --c ile taşınır.
 * Hareket: bu dosyada döngü yok; karolar durağan, hover yalnız ışık. Sonsuz döngü
 * yalnız önizleme sahnesinde (efekt + madalyon) ve sekme gizliyken .is-paused ile
 * durur (yalnız önizleme kökünde; genel kural yok). backdrop-filter yok.
 */

#view-custom-badges {
  font-family: var(--wf-font-text);
  color: var(--wf-text-1);
}
#view-custom-badges button:focus-visible {
  outline: 2px solid rgba(244, 236, 234, 0.6);
  outline-offset: -2px;
}
.cbg .rl-pane[hidden] { display: none; }

/* ============================================================
   [LİSTE] durağan madalyon · ad · profil efekti · üye sayısı
   ============================================================ */
.cbg-item .rwd-badge { flex-shrink: 0; }
.cbg-item.is-off .rwd-badge,
.cbg-item.is-off .rl-item-text b { opacity: 0.5; }
.cbg-item-draft,
.cbg-head-draft {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.22);
  color: var(--wf-text-2);
}
.cbg-item-draft { width: 34px; height: 34px; }
.cbg-item-draft svg { width: 15px; height: 15px; }
.cbg-head-draft { width: 52px; height: 52px; }
.cbg-head-draft svg { width: 22px; height: 22px; }
.cbg-list-empty { margin: 0; padding: 18px 12px; font-size: 0.84rem; text-align: center; color: var(--wf-text-4); }

/* ============================================================
   [BAŞLIK] madalyon (efektsiz) · ad · durum ve efekt çipleri
   ============================================================ */
.cbg-chip-fx {
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: color-mix(in srgb, var(--c) 72%, #ffffff);
}
.cbg-dirty {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 7px;
  border-radius: 50%;
  background: #f0b45a;
  vertical-align: 2px;
}
.cbg-dirty[hidden] { display: none; }
.rl-tabs button:disabled { opacity: 0.4; cursor: default; }

/* ============================================================
   [BOŞ / HATA]
   ============================================================ */
.cbg-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 28px;
  text-align: center;
}
.cbg-empty-medal { margin-bottom: 6px; }
.cbg-empty b { font-family: var(--wf-font-display); font-size: 1.25rem; font-weight: 600; color: var(--wf-text-1); }
.cbg-empty p { max-width: 440px; margin: 0 0 6px; font-size: 0.88rem; line-height: 1.55; color: var(--wf-text-3); }
.cbg-empty .dlg-btn svg { width: 15px; height: 15px; }

/* ============================================================
   [TASARIM] form + yapışkan canlı önizleme
   ============================================================ */
.cbg-design {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}
.cbg-form { min-width: 0; }
.cbg-form .dlg-sec-title em { margin-left: 2px; }

/* Profil efekti: karolar durağan (glif + ad + tek satır); canlı hâli önizlemede */
.cbg-fxs { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 6px; }
.cbg-fx {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.055);
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition:
    background-color var(--wf-dur-hover) ease,
    box-shadow var(--wf-dur-hover) ease,
    transform var(--wf-dur-press) var(--wf-ease-out);
}
.cbg-fx:active { transform: scale(0.97); }
.cbg-fx-ico {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--wf-text-3);
  transition: background-color var(--wf-dur-hover) ease, color var(--wf-dur-hover) ease;
}
.cbg-fx-ico svg { width: 16px; height: 16px; }
.cbg-fx-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cbg-fx-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.84rem; font-weight: 600; color: var(--wf-text-2); }
.cbg-fx-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.72rem; color: var(--wf-text-4); }
.cbg-fx.is-sel {
  background: color-mix(in srgb, var(--c) 9%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--c);
}
.cbg-fx.is-sel .cbg-fx-ico { background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); }
.cbg-fx.is-sel .cbg-fx-text b { color: var(--wf-text-1); }

/* Madalyon aurası: sıkı çip satırı */
.cbg-auras { display: flex; flex-wrap: wrap; gap: 5px; }
.cbg-aura {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.065);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--wf-text-3);
  cursor: pointer;
  transition:
    background-color var(--wf-dur-hover) ease,
    color var(--wf-dur-hover) ease,
    box-shadow var(--wf-dur-hover) ease,
    transform var(--wf-dur-press) var(--wf-ease-out);
}
.cbg-aura:active { transform: scale(0.96); }
.cbg-aura.is-sel {
  background: color-mix(in srgb, var(--c) 12%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--c);
  color: var(--wf-text-1);
}

/* Öncelik + durum */
.cbg-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: stretch; }
.cbg-prio {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.028);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.cbg-step { display: inline-flex; align-items: center; gap: 4px; }
.cbg-step-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  color: var(--wf-text-2);
  cursor: pointer;
  transition: background-color var(--wf-dur-hover) ease, color var(--wf-dur-hover) ease, transform var(--wf-dur-press) var(--wf-ease-out);
}
.cbg-step-btn:active { transform: scale(0.94); }
.cbg .cbg-step .dlg-input {
  width: 84px;
  height: 34px;
  padding: 0 6px;
  border-radius: 9px;
  text-align: center;
  font-family: var(--wf-font-display);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}
.cbg-prio .dlg-hint { line-height: 1.4; }
.cbg-active { min-height: 64px; }

/* ── Önizleme ── */
.cbg-side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.cbg-side .dlg-sec-title { margin: 0; }
.cbg-side .dlg-sec-title em {
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: color-mix(in srgb, var(--c) 70%, #ffffff);
}
/* Sahne: uygulamanın karanlık zemini; dış ışık (.pfx-out) burada görünür */
.cbg-scene {
  position: relative;
  padding: 22px 18px;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(90% 60% at 50% 0%, color-mix(in srgb, var(--c) 12%, transparent), transparent 72%),
    #0b0709;
}
.cbg-pv { position: relative; border-radius: 20px; }
.cbg-pv > .pfx-out { z-index: 0; }
.cbg-pv-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: 20px;
  background: #141013;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 18px 40px -18px rgba(0, 0, 0, 0.9);
}
.cbg-pv-banner {
  position: relative;
  height: 88px;
  background:
    radial-gradient(120% 140% at 12% 0%, color-mix(in srgb, var(--c) 40%, transparent), transparent 62%),
    radial-gradient(90% 120% at 100% 100%, color-mix(in srgb, var(--c) 14%, transparent), transparent 70%),
    linear-gradient(180deg, #221a1f, #161114);
}
.cbg-pv-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 16, 19, 0) 40%, rgba(20, 16, 19, 0.92) 100%);
}
.cbg-pv-id {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: -30px;
  padding: 0 16px;
}
.cbg-pv-ava {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #3a2a30, #1b1216);
  box-shadow: 0 0 0 3px #141013, 0 0 0 4.5px color-mix(in srgb, var(--c) 62%, transparent);
  font-family: var(--wf-font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--wf-text-2);
}
.cbg-pv-ava img { width: 100%; height: 100%; object-fit: cover; }
.cbg-pv-who { display: flex; flex-direction: column; min-width: 0; padding-bottom: 5px; }
.cbg-pv-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--wf-font-display);
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--wf-text-1);
}
.cbg-pv-handle { font-size: 0.74rem; color: var(--wf-text-4); }
.cbg-pv-chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 12px 16px 0; }
.cbg-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  height: 24px;
  padding: 0 9px 0 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 32%, transparent);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  color: color-mix(in srgb, var(--c) 80%, #ffffff);
}
.cbg-chip-ico { display: grid; place-items: center; flex-shrink: 0; width: 12px; height: 12px; }
.cbg-chip-ico svg,
.cbg-chip-ico .ri-img { width: 12px; height: 12px; }
.cbg-chip-ico .ri-img { border-radius: 50%; object-fit: cover; }
.cbg-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Bu rozet: çiplerin sonunda, rengiyle öne çıkar (üstüne eklendiği görünür) */
.cbg-chip.is-new {
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 32%, transparent), color-mix(in srgb, var(--c) 12%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 62%, transparent), 0 0 14px color-mix(in srgb, var(--c) 26%, transparent);
  color: #ffffff;
}
.cbg-chip.is-new .cbg-chip-ico { color: color-mix(in srgb, var(--c) 70%, #ffffff); }
/* Profilin geri kalanı: soluk yer tutucular */
.cbg-pv-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 14px 16px 16px; }
.cbg-pv-body i {
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.cbg-pv-body span {
  grid-column: 1 / -1;
  width: 72%;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
}
.cbg-pv-body span + span { width: 46%; margin-top: -1px; }

/* Madalyon: auralı, karanlık sahnede */
.cbg-medal {
  display: grid;
  place-items: center;
  height: 150px;
  border-radius: 14px;
  background:
    radial-gradient(60% 60% at 50% 46%, color-mix(in srgb, var(--c) 18%, transparent) 0%, transparent 72%),
    #0e090b;
}
.cbg-pv-meta { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; text-align: center; }
.cbg-pv-meta b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--wf-font-display);
  font-size: 1.06rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--c) 80%, #ffffff);
}
.cbg-pv-meta span { font-size: 0.76rem; color: var(--wf-text-3); }
.cbg-pv-meta p { margin: 4px 0 0; font-size: 0.8rem; line-height: 1.45; overflow-wrap: anywhere; color: var(--wf-text-2); }
.cbg-pv-meta p.is-empty { color: var(--wf-text-4); }
.cbg-pv-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 0.74rem; line-height: 1.45; color: var(--wf-text-4); }
.cbg-pv-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

/* Sekme gizliyken önizleme durur: yalnız bu kökte, yalnız efekt ve madalyon */
.cbg-side.is-paused .pfx,
.cbg-side.is-paused .pfx *,
.cbg-side.is-paused .pfx-out,
.cbg-side.is-paused .pfx-out *,
.cbg-side.is-paused .reward-badge,
.cbg-side.is-paused .reward-badge * { animation-play-state: paused; }

/* ============================================================
   [ÜYELER] ara + ekle · liste
   ============================================================ */
.cbg-add { margin-bottom: 18px; }
.cbg-add .usr-search { max-width: none; }
.cbg-sugs { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.cbg-sugs:empty { display: none; }
.cbg-sug {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.045);
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: background-color var(--wf-dur-hover) ease, transform var(--wf-dur-press) var(--wf-ease-out);
}
.cbg-sug:active:not(:disabled) { transform: scale(0.99); }
.cbg-sug:disabled { cursor: default; }
.cbg-sug.is-member { opacity: 0.6; }
.cbg-sug .usr-ava { width: 34px; height: 34px; border-radius: 10px; }
.cbg-sug .usr-who-text { flex: 1; }
.cbg-sug-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  height: 28px;
  padding: 0 10px 0 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  font-size: 0.78rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--c) 78%, #ffffff);
}
.cbg-sug-add svg { width: 13px; height: 13px; }
.cbg-sug-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-style: normal;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--wf-text-4);
}
.cbg-sug-state svg { width: 13px; height: 13px; color: var(--wf-success); }
.cbg-sug-state .dlg-spin { width: 12px; height: 12px; }
.cbg-sug-none { margin: 0; padding: 10px 12px; font-size: 0.82rem; color: var(--wf-text-4); }

.cbg-mlist {
  --usr-cols: minmax(0, 1fr) 140px 44px;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.055);
}
.cbg-mcap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.84rem;
  color: var(--wf-text-3);
}
.cbg-mcap:empty { display: none; }
.cbg-mcap b { font-family: var(--wf-font-display); font-size: 0.98rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--wf-text-1); }
.cbg-mrow { min-height: 58px; cursor: default; }
.cbg-mrow .usr-who { padding: 9px 0; }
.cbg-mdate { font-size: 0.82rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--wf-text-3); }
.cbg-mempty { min-height: 200px; }
.cbg-mempty b + span b { font-family: inherit; font-size: inherit; font-weight: 600; color: var(--wf-text-2); }

/* ============================================================
   [ÜYE DETAYI] Erişim sekmesindeki "Özel rozetler" anahtarları (detail.js)
   ============================================================ */
.ud-cbadges .dlg-toggle-ico .reward-badge { --badge-size: 28px; transition: opacity var(--wf-dur-state) ease; }
.ud-cbadges .dlg-toggle:not(.is-on) .reward-badge { opacity: 0.5; }
.ud-cb-note { margin: 10px 2px 0; font-size: 0.74rem; line-height: 1.45; color: var(--wf-text-4); }

/* ============================================================
   [HOVER] yalnız ışık
   ============================================================ */
@media (hover: hover) and (pointer: fine) {
  .cbg-fx:not(.is-sel):hover {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 42%, transparent);
  }
  .cbg-fx:not(.is-sel):hover .cbg-fx-ico { color: var(--c); }
  .cbg-fx:not(.is-sel):hover .cbg-fx-text b { color: var(--wf-text-1); }
  .cbg-aura:not(.is-sel):hover { background: rgba(255, 255, 255, 0.07); color: var(--wf-text-1); }
  .cbg-step-btn:hover { background: rgba(255, 255, 255, 0.09); color: var(--wf-text-1); }
  .cbg-sug:not(:disabled):hover { background: rgba(255, 255, 255, 0.055); }
  .cbg-mrow .usr-who:hover .usr-name b { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(255, 255, 255, 0.35); }
}

/* ============================================================
   [ERİŞİLEBİLİRLİK] hareket istemeyen: küçülme ve geçişler yok
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .cbg-fx,
  .cbg-fx-ico,
  .cbg-aura,
  .cbg-step-btn,
  .cbg-sug,
  .ud-cbadges .dlg-toggle-ico .reward-badge { transition: none; }
  .cbg-fx:active,
  .cbg-aura:active,
  .cbg-step-btn:active,
  .cbg-sug:active:not(:disabled) { transform: none; }
}

/* ============================================================
   [DUYARLI]
   ============================================================ */
@media (max-width: 1600px) {
  .cbg-design { grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
  .cbg-fxs { grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); }
}
/* Dar düzenleyicide önizleme üstte, kart ve madalyon yan yana */
@media (max-width: 1360px) {
  .cbg-design { grid-template-columns: minmax(0, 1fr); }
  .cbg-side {
    position: static;
    order: -1;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: start;
  }
  .cbg-side > .dlg-sec-title,
  .cbg-side > .cbg-pv-note { grid-column: 1 / -1; }
  .cbg-side > .cbg-scene { grid-row: span 2; }
  .cbg-medal { height: 168px; }
}
@media (max-width: 900px) {
  .cbg-side { grid-template-columns: minmax(0, 1fr); }
  .cbg-side > .cbg-scene { grid-row: auto; }
  .cbg-pv { max-width: 440px; margin: 0 auto; }
  .cbg-medal { height: 132px; }
  .cbg-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .cbg-fxs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .cbg-scene { padding: 16px 12px; }
  .cbg-mlist { --usr-cols: minmax(0, 1fr) 44px; }
  .cbg-mlist .usr-head > :nth-child(2),
  .cbg-mdate { display: none; }
  .cbg-empty { padding: 32px 18px; }
}
