/* ========================================================
   E-004c — Cabinet badges card
   Переиспользует переменные из cabinet.css
   ======================================================== */

.cabinet-badges .cb-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.cabinet-badges .cb-header .cb-header-icon {
  width: 24px;
  height: 24px;
  color: var(--pink-accent);
  flex-shrink: 0;
}

.cabinet-badges .cb-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.cabinet-badges .cb-header .cb-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-muted);
  padding: 4px 10px;
  background: var(--pink-50);
  border-radius: 999px;
  font-weight: 600;
}
.cabinet-badges .cb-header .cb-count strong {
  color: var(--pink-accent-hover);
}

/* ---- сетка ---- */
.cabinet-badges .cb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 10px;
  padding: 4px 0;
}

/* ---- бейдж (ячейка) ---- */
.cabinet-badges .cb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  position: relative;
  cursor: default;
}

.cabinet-badges .cb-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.cabinet-badges .cb-circle svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
  fill: none;
}

/* earned */
.cabinet-badges .cb-item.cb-earned .cb-circle {
  background: linear-gradient(135deg, #FFD4E0, #FFE4EC);
  border: 2px solid var(--pink-accent);
  box-shadow: 0 4px 16px rgba(255, 123, 163, 0.3);
}
.cabinet-badges .cb-item.cb-earned .cb-circle svg {
  stroke: var(--pink-accent-hover);
}
.cabinet-badges .cb-item.cb-earned .cb-name {
  color: var(--ink);
  font-weight: 600;
}

/* locked */
.cabinet-badges .cb-item.cb-locked .cb-circle {
  background: rgba(255, 228, 236, 0.3);
  border: 2px dashed rgba(156, 163, 175, 0.35);
  filter: grayscale(0.7);
  opacity: 0.55;
}
.cabinet-badges .cb-item.cb-locked .cb-circle svg {
  stroke: var(--ink-faint);
}
.cabinet-badges .cb-item.cb-locked .cb-name {
  color: var(--ink-muted);
  font-weight: 500;
}

/* ---- имя бейджа ---- */
.cabinet-badges .cb-name {
  font-size: 11px;
  line-height: 1.25;
  color: var(--ink-muted);
  max-width: 88px;
  word-wrap: break-word;
  hyphens: auto;
}

/* ---- hover: earned ---- */
.cabinet-badges .cb-item.cb-earned:hover .cb-circle {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 20px rgba(255, 123, 163, 0.4);
}

/* ---- hover: locked ---- */
.cabinet-badges .cb-item.cb-locked:hover .cb-circle {
  opacity: 0.75;
}

/* ---- tooltip (pure CSS) ---- */
.cabinet-badges .cb-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: #fff;
  padding: 7px 11px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.cabinet-badges .cb-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -4px;
  border: 4px solid transparent;
  border-top-color: var(--ink);
}
.cabinet-badges .cb-tooltip .cb-tooltip-desc {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: rgba(255,255,255,0.78);
  margin-top: 2px;
}
.cabinet-badges .cb-item:hover .cb-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- разделитель earned / locked (тонкий fade-line) ---- */
.cabinet-badges .cb-divider {
  grid-column: 1 / -1;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--border) 30%,
    var(--border) 70%,
    transparent 100%);
  margin: 4px 0 2px;
}

/* ---- collapse "Подробнее" ---- */
.cabinet-badges .cb-collapse {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.cabinet-badges .cb-collapse-btn {
  background: none;
  border: none;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}
.cabinet-badges .cb-collapse-btn:hover {
  color: var(--pink-accent);
}
.cabinet-badges .cb-collapse-btn::after {
  content: "▾";
  display: inline-block;
  transition: transform .2s ease;
}
.cabinet-badges .cb-collapse[open] .cb-collapse-btn::after {
  transform: rotate(180deg);
}
.cabinet-badges .cb-collapse-body {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink-muted);
}
.cabinet-badges .cb-collapse-body .cb-row-check {
  color: var(--success);
  margin-right: 4px;
  font-weight: 700;
}
.cabinet-badges .cb-collapse-body .cb-row-lock {
  color: var(--ink-faint);
  margin-right: 4px;
}
.cabinet-badges .cb-collapse-body b { color: var(--ink); }

/* ---- анимация появления (stagger) ---- */
@keyframes cbPop {
  from { opacity: 0; transform: translateY(6px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cabinet-badges .cb-item {
  animation: cbPop .36s cubic-bezier(.22,.61,.36,1) both;
}
.cabinet-badges .cb-item:nth-child(1)  { animation-delay: .02s; }
.cabinet-badges .cb-item:nth-child(2)  { animation-delay: .06s; }
.cabinet-badges .cb-item:nth-child(3)  { animation-delay: .10s; }
.cabinet-badges .cb-item:nth-child(4)  { animation-delay: .14s; }
.cabinet-badges .cb-item:nth-child(5)  { animation-delay: .18s; }
.cabinet-badges .cb-item:nth-child(6)  { animation-delay: .22s; }
.cabinet-badges .cb-item:nth-child(7)  { animation-delay: .26s; }
.cabinet-badges .cb-item:nth-child(8)  { animation-delay: .30s; }
.cabinet-badges .cb-item:nth-child(9)  { animation-delay: .34s; }
.cabinet-badges .cb-item:nth-child(10) { animation-delay: .38s; }
.cabinet-badges .cb-item:nth-child(11) { animation-delay: .42s; }
.cabinet-badges .cb-item:nth-child(12) { animation-delay: .46s; }
.cabinet-badges .cb-item:nth-child(13) { animation-delay: .50s; }

/* ---- адаптив ---- */
@media (max-width: 900px) {
  .cabinet-badges .cb-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .cabinet-badges .cb-circle {
    width: 52px;
    height: 52px;
  }
}

@media (max-width: 420px) {
  .cabinet-badges .cb-grid {
    gap: 10px 6px;
  }
  .cabinet-badges .cb-circle {
    width: 46px;
    height: 46px;
  }
  .cabinet-badges .cb-circle svg {
    width: 20px;
    height: 20px;
  }
  .cabinet-badges .cb-name {
    font-size: 10px;
    max-width: 72px;
  }
  /* На малых экранах tooltip может вылезать за край — отключаем */
  .cabinet-badges .cb-tooltip { display: none; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .cabinet-badges .cb-item {
    animation: none;
  }
  .cabinet-badges .cb-item.cb-earned:hover .cb-circle {
    transform: none;
  }
}
