/* ============================================
   BROWSE-ONLY STICKER SHOP
   Styles for web/js/shop.js
   ============================================ */

.shop-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  position: relative;
}

/* Header rules moved to shop-header.css */

.shop-category-dropdown {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 199;
  display: none;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  overflow: hidden;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.shop-category-dropdown.visible {
  display: flex;
}

.shop-category-option {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  color: #18181b;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  text-align: left;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.shop-category-option:last-child {
  border-bottom: none;
}

.shop-category-option:hover {
  background: #f9f9f9;
}

.shop-swipe-container {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.shop-swipe-container::-webkit-scrollbar {
  display: none;
}

.shop-swipe-panel {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  scroll-snap-align: start;
  overflow-y: auto;
  overflow-x: hidden;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
  box-sizing: border-box;
}

.shop-sticker {
  aspect-ratio: 4 / 5;
  position: relative;
  border-radius: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  cursor: pointer;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}

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

.shop-sticker img {
  width: 100%;
  height: 80%;
  object-fit: contain;
}

.shop-sticker-badge {
  font-size: 12.65px;
  font-weight: 700;
  color: #18181b;
}

/* Shimmer skeleton */
.shop-skeleton {
  aspect-ratio: 4 / 5;
  border-radius: 12px;
  background: linear-gradient(110deg, #f0f0f0 30%, #e0e0e0 50%, #f0f0f0 70%);
  background-size: 200% 100%;
  animation: shop-shimmer 1.4s infinite linear;
}

@keyframes shop-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.shop-sheets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  box-sizing: border-box;
}

.shop-sheet-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  background: #f9f9f9;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease;
}

.shop-sheet-card:active {
  transform: scale(0.97);
}

.shop-sheet-card img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  display: block;
}

.shop-sheet-card__label {
  padding: 6px 6px 8px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: #18181b;
}

/* ========== Sticker Detail Overlay ========== */
.shop-sticker-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.shop-sticker-detail-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.shop-sticker-detail-panel {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px;
  width: 100%;
  max-width: 640px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.shop-sticker-detail-overlay.visible .shop-sticker-detail-panel {
  transform: scale(1);
}

.shop-sticker-detail-panel img {
  width: 320px;
  height: 320px;
  object-fit: contain;
}

@media (max-width: 768px) {
  .shop-sticker-detail-panel { max-width: 340px; }
  .shop-sticker-detail-panel img { width: 180px; height: 180px; }
}

/* ========== Sheet Detail Overlay ========== */
.shop-sheet-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.shop-sheet-detail-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.shop-sheet-detail-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85vh;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  z-index: 501;
  padding: 24px;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.shop-sheet-detail-overlay.visible .shop-sheet-detail-panel {
  transform: translateY(0);
}

/* ========== Inline Search Bar ========== */
.shop-search-bar {
  display: none;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 0 8px;
}

.shop-search-input {
  flex: 1;
  border: 1px solid #e5e5e5;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

/* ========== Mobile full-screen search overlay ========== */
.shop-search-overlay {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 700;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.shop-search-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.shop-search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.shop-search-input-mobile {
  flex: 1;
  border: 1px solid #e5e5e5;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}

.shop-search-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  align-content: start;
}

/* ========== Shared detail close / CTA ========== */
.shop-detail-close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #52525b;
  line-height: 1;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
}

.shop-cta-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(to top right, #6D28D9, #14B8A6);
  color: #ffffff;
  border: none;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s ease;
}

.shop-cta-btn:active {
  opacity: 0.85;
}

/* ========== Coin Balance Display ========== */
#shop-coin-balance {
  display: flex;
  align-items: center;
  gap: 4px;
}

#shop-coin-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

#shop-coin-amount {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #6D28D9;
  line-height: 1;
}

/* ========== Basket Button + Badge ========== */
.shop-basket-btn {
  position: relative;
}

.shop-basket-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #6D28D9;
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 10px;
  border-radius: 10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}


/* ========== Basket Panel ========== */
.basket-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.basket-overlay.hidden {
  display: none;
}

.basket-panel {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e4e4e7;
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.basket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.basket-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.12em;
  color: #6D28D9;
}

.basket-close-btn {
  background: #f4f4f5;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #71717a;
}

.basket-items-list {
  padding: 16px 20px 0;
}

.basket-empty-msg {
  text-align: center;
  color: #a1a1aa;
  font-size: 14px;
  padding: 24px 0;
}

.basket-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f4f4f5;
}

.basket-item-row:last-child {
  border-bottom: none;
}

.basket-item-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 8px;
  background: #f4f4f5;
  flex-shrink: 0;
}

.basket-item-info {
  flex: 1;
  min-width: 0;
}

.basket-item-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: #18181b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.basket-item-price {
  font-size: 12px;
  color: #6D28D9;
  font-weight: 700;
  margin-top: 2px;
}

.basket-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #a1a1aa;
  padding: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.basket-item-remove svg {
  width: 16px;
  height: 16px;
}

.basket-footer {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.basket-total-row,
.basket-balance-row,
.basket-credit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #71717a;
}

.basket-total-row span:last-child {
  font-size: 15px;
  font-weight: 700;
  color: #18181b;
}

.basket-checkout-btn {
  width: 100%;
  background: #6D28D9;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: #ffffff;
  cursor: pointer;
  margin-top: 8px;
}

.basket-buy-coins-btn {
  width: 100%;
  background: transparent;
  border: 1.5px solid #6D28D9;
  border-radius: 10px;
  padding: 11px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: #6D28D9;
  cursor: pointer;
}

/* ========== Shop Toast ========== */
.shop-toast-msg {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: #18181b;
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 100px;
  z-index: 900;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  pointer-events: none;
}

.shop-toast-msg.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Mobile header rules moved to shop-header.css */

/* ========== Desktop: 8-column sticker grid, 6-column sheets/backgrounds ========== */
@media (min-width: 769px) {
  .shop-grid {
    grid-template-columns: repeat(8, 1fr);
  }
  .shop-sheets-grid,
  .shop-backgrounds-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

#feed-area {
  background: #ffffff;
  padding-top: 44px;
}

@media (max-width: 768px) {
  body.shop-active #feed-area {
    padding-top: 0;
  }
}
