/* ==========================================================================
   Shop — Pixel Art Portal
   GP-DESIGN-002-B4
   Dark theme world (#3D2C1E), 3-col grid, preview panel, nav dark mode
   Uses CSS vars from design-tokens.css (A1) and nav.css (A2)
   ========================================================================== */

/* ---- Pixel art fade-in ---- */
@keyframes shop-fadein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- View root ---- */
#view-shop.active {
  display: flex;
  flex-direction: column;
  background: var(--pixel-dark);
  min-height: 100dvh;
  color: #fff;
  padding-bottom: 100px;
}

/* ---- Shop Header ---- */
.shop-header {
  background: var(--pixel-dark);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.shop-header__left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shop-finnets-icon {
  width: 22px;
  height: 22px;
  background: var(--xp-gold);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--pixel-dark);
  line-height: 1;
  user-select: none;
}

.shop-finnets-balance {
  font-size: 15px;
  font-weight: 700;
  color: var(--cta);
}

.shop-header__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--xp-gold);
}

.shop-header__avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid var(--xp-gold);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
}

.shop-header__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

/* ---- Sub-tabs ---- */
.shop-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 20px 16px;
}

.shop-stab {
  flex: 1;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.shop-stab.active {
  border-color: var(--xp-gold);
  color: var(--xp-gold);
  background: rgba(245, 158, 11, 0.1);
}

.shop-stab:active { transform: scale(0.96); }

/* ---- Welcome banner ---- */
.shop-welcome {
  margin: 0 20px 16px;
  background: linear-gradient(135deg, var(--cta), #FB923C);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: shop-fadein 0.3s ease forwards;
}

.shop-welcome__icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shop-welcome__icon .material-symbols-outlined {
  font-size: 28px;
  color: white;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.shop-welcome__text h4 {
  font-size: 15px;
  font-weight: 700;
  color: white;
}

.shop-welcome__text p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* ---- Category label ---- */
.shop-category-label {
  padding: 0 20px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
}

/* ---- 3-column grid ---- */
.shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 0 20px;
  margin-bottom: 20px;
}

.shop-item {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  position: relative;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  animation: shop-fadein 0.3s ease forwards;
}

.shop-item:active { transform: scale(0.95); }

.shop-item.selected {
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 0 2px var(--xp-gold);
}

.shop-sprite {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shop-sprite img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.shop-sprite--placeholder {
  background: rgba(255, 255, 255, 0.08);
  font-size: 28px;
  line-height: 1;
}

.shop-item-name {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

.shop-item-price {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cta);
}

.shop-price-coin {
  width: 14px;
  height: 14px;
  background: var(--xp-gold);
  border-radius: 50%;
  border: 1.5px solid var(--pixel-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 700;
  color: var(--pixel-dark);
  line-height: 1;
  flex-shrink: 0;
}

.shop-owned-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--tertiary);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

/* ---- Preview panel ---- */
.shop-preview {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0 20px 16px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.shop-preview.visible {
  display: flex;
  animation: shop-fadein 0.25s ease forwards;
}

.shop-preview__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-preview__avatar-initial {
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  user-select: none;
}

.shop-preview__name {
  font-size: 15px;
  font-weight: 700;
  color: white;
  text-align: center;
}

.shop-preview__hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.shop-buy-btn {
  background: linear-gradient(135deg, var(--cta), #FB923C);
  border: none;
  border-radius: 999px;
  color: white;
  padding: 12px 32px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  min-height: 56px;
}

.shop-buy-btn:active { transform: scale(0.95); }

.shop-buy-btn .shop-price-coin {
  width: 18px;
  height: 18px;
  font-size: 9px;
}

/* ---- Wishlist placeholder ---- */
.shop-wishlist-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: rgba(255, 255, 255, 0.4);
}

.shop-wishlist-placeholder .material-symbols-outlined {
  font-size: 48px;
  color: rgba(255, 255, 255, 0.2);
}

.shop-wishlist-placeholder p {
  font-size: 14px;
  text-align: center;
}

/* ---- Error / Loading ---- */
.shop-error {
  margin: 20px;
  padding: 16px;
  background: rgba(172, 52, 52, 0.15);
  border-radius: 12px;
  color: rgba(255, 200, 200, 0.9);
  font-size: 14px;
  text-align: center;
}

.shop-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
}

/* ---- Nav dark mode modifier ---- */
.glass-nav--pixel-dark {
  background: rgba(61, 44, 30, 0.85) !important;
  box-shadow: 0 -12px 32px -4px rgba(0, 0, 0, 0.3);
}

.glass-nav--pixel-dark .glass-nav__item {
  color: rgba(255, 255, 255, 0.4);
}

.glass-nav--pixel-dark .glass-nav__item.active {
  background: rgba(245, 158, 11, 0.2);
  color: var(--xp-gold);
}
