/* ═══════════════════════════════════════════════════════════
   RepublicMC — Product & Store Card Component
   ═══════════════════════════════════════════════════════════ */

/* ── Store Card Base ────────────────────────────────────── */
.store-card,
.vote-card,
.rule-card,
.support-card,
.leaderboard-card {
  padding: 22px;
}

.store-card {
  position: relative;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease),
    background 150ms var(--ease), opacity 250ms var(--ease), transform 250ms var(--ease-expo-out);
}

.store-card.is-sorting {
  opacity: 0;
  transform: translateY(8px);
}

.store-card[data-category="ranks"] > * {
  position: relative;
  z-index: 1;
}

.store-card[data-category="ranks"] .item-top {
  align-items: center;
  justify-content: center;
}

.store-card[data-category="ranks"] .item-image.item-icon {
  margin-right: auto;
  margin-left: auto;
  display: block;
}

.item-top,
.vote-top,
.rule-top,
.support-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.price {
  color: var(--text);
  background: var(--accent-light);
  border: 1px solid rgba(14, 165, 201, 0.18);
  padding: 6px 13px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.1rem;
}

.item-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  object-fit: cover;
  margin-bottom: 14px;
}

.item-image.item-icon {
  width: 120px;
  aspect-ratio: 1 / 1;
  border-radius: 0;
  object-fit: contain;
  background: transparent;
  margin-bottom: 8px;
  display: block;
  margin-inline: auto;
}

.store-card[data-category="crystals"] .item-image,
.store-card[data-category="crates"] .item-image {
  object-fit: contain;
}

/* ── Popular Badge ──────────────────────────────────────── */
.popular-badge {
  position: absolute !important;
  top: 14px !important;
  right: 14px !important;
  z-index: 10 !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.popular-badge svg {
  width: 10px;
  height: 10px;
  fill: currentColor;
}

/* ── Actions ────────────────────────────────────────────── */
.store-actions,
.vote-actions,
.support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* ── Crate Quantity Stepper ─────────────────────────────── */
.crate-qty-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  margin: 12px 0 16px;
}

.crate-qty-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent) !important;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 1 !important;
}

.crate-qty-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

.crate-qty-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
  line-height: 1;
  user-select: none;
}

.crate-qty-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.crate-qty-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.crate-qty-input {
  width: 52px !important;
  height: 32px !important;
  line-height: 32px !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text) !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  text-align: center !important;
  outline: none !important;
  font-family: inherit !important;
  padding: 0 !important;
  margin: 0 !important;
  -moz-appearance: textfield !important;
  opacity: 1 !important;
  transition: border-color 150ms var(--ease) !important;
}

.crate-qty-input:focus {
  border-color: var(--accent) !important;
}

.crate-qty-input::-webkit-outer-spin-button,
.crate-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ── Rank Perks Accordion / List ────────────────────────── */
.store-card--rank {
  transition:
    border-color 300ms var(--ease-expo-out),
    box-shadow 300ms var(--ease-expo-out);
}

.store-card--rank.perks-open {
  border-color: rgba(14, 165, 201, 0.28);
}

.rank-perks-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}

.rank-perks-toggle-text {
  display: inline-block;
  transition: opacity 180ms var(--ease-smooth), transform 180ms var(--ease-smooth);
}

.rank-perks-toggle[aria-expanded="true"] .rank-perks-toggle-text {
  opacity: 1;
  transform: none;
}

.rank-perks-chevron {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 400ms var(--ease-expo-out);
  will-change: transform;
}

.rank-perks-chevron svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.store-card--rank.perks-open .rank-perks-chevron {
  transform: rotate(180deg);
}

.rank-perks-panel {
  height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transform-origin: top center;
  transition:
    height 400ms var(--ease-expo-out),
    opacity 280ms var(--ease-smooth),
    transform 340ms var(--ease-expo-out),
    margin-top 400ms var(--ease-expo-out);
  margin-top: 0;
  will-change: height, opacity, transform;
}

.store-card--rank.perks-open .rank-perks-panel {
  opacity: 1;
  transform: translateY(0);
  margin-top: 16px;
}

.store-card--rank.perks-open .rank-perks-list li {
  animation: perk-item-in 360ms var(--ease-expo-out) both;
}

.store-card--rank.perks-open .rank-perks-list li:nth-child(1) {
  animation-delay: 20ms;
}

.store-card--rank.perks-open .rank-perks-list li:nth-child(2) {
  animation-delay: 50ms;
}

.store-card--rank.perks-open .rank-perks-list li:nth-child(3) {
  animation-delay: 80ms;
}

.store-card--rank.perks-open .rank-perks-list li:nth-child(4) {
  animation-delay: 110ms;
}

.store-card--rank.perks-open .rank-perks-list li:nth-child(5) {
  animation-delay: 140ms;
}

.store-card--rank.perks-open .rank-perks-list li:nth-child(6) {
  animation-delay: 170ms;
}

.store-card--rank.perks-open .rank-perks-list li:nth-child(7) {
  animation-delay: 200ms;
}

.store-card--rank.perks-open .rank-perks-list li:nth-child(8) {
  animation-delay: 230ms;
}

.store-card--rank.perks-open .rank-perks-list li:nth-child(9) {
  animation-delay: 260ms;
}

.store-card--rank.perks-open .rank-perks-list li:nth-child(10) {
  animation-delay: 290ms;
}

.store-card--rank.perks-open .rank-perks-kit {
  animation: perk-kit-in 440ms var(--ease-expo-out) 200ms both;
}

.rank-perks-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.rank-perks-list li {
  position: relative;
  padding-left: 26px;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.6;
}

.rank-perks-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}

.rank-perks-kit {
  margin-top: 14px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 10px;
  text-align: center;
}

.rank-perks-kit img {
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 6px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.08));
  transition: transform 250ms var(--ease-smooth);
}

.rank-perks-kit:hover img {
  transform: scale(1.02);
}

/* ── Store Sort & Filter Bar ────────────────────────────── */
.store-sort-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.store-search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
}

.store-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.store-search-input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}

.store-search-input::placeholder {
  color: var(--text-faint);
}

.store-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.store-sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.store-sort-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.store-sort-select {
  padding: 9px 32px 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b68' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}

.store-sort-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.store-sort-select:hover {
  border-color: var(--border-strong);
}

/* ── No Results State ───────────────────────────────────── */
.store-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.store-no-results strong {
  display: block;
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 6px;
}

/* ── Responsive Card Actions ────────────────────────────── */
@media (max-width: 560px) {
  .store-actions,
  .vote-actions,
  .support-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

