/* ── DB 로드 전 동적 요소 숨김 ── */
#shopDynamicCategories,
.spd-name,
.spd-price,
.spd-qty-row,
.spd-actions {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.db-loaded #shopDynamicCategories,
.db-loaded .spd-name,
.db-loaded .spd-price,
.db-loaded .spd-qty-row,
.db-loaded .spd-actions {
  opacity: 1;
}

/* ── SHOP HERO ── */
.shop-hero {
  padding-top: calc(var(--nav-height) + 60px);
  padding-bottom: 60px;
  padding-left: 32px;
  padding-right: 32px;
  background: var(--white);
  text-align: center;
}

.shop-hero h1 {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 700;
  color: var(--black);
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.shop-hero-logo {
  height: 1em;
  width: auto;
  vertical-align: middle;
}

.shop-hero p {
  font-size: clamp(16px, 1.8vw, 22px);
  color: #666;
  font-weight: 400;
}

/* ── SHOP SECTION ── */
.shop-section {
  background: #f5f5f5;
  padding: 60px 32px 100px;
}

.shop-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* ── CATEGORY ── */
#shopDynamicCategories {
  margin-bottom: 60px;
}
.shop-category {
  margin-bottom: 60px;
}

.shop-category:last-child {
  margin-bottom: 0;
}

.shop-category-title {
  font-size: clamp(20px, 2.5vw, 32px);
  font-weight: 700;
  color: var(--black);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--black);
}

/* ── PRODUCT GRID ── */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* ── PRODUCT CARD ── */
.shop-card {
  text-decoration: none;
  color: var(--black);
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.shop-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
}

.shop-card--disabled {
  pointer-events: none;
  opacity: 0.6;
}

.shop-card-img {
  aspect-ratio: 1/1;
  overflow: hidden;
  position: relative;
  background: #f0f0f0;
}

.shop-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.shop-card:hover .shop-card-img img {
  transform: scale(1.05);
}

.shop-card-img--dark {
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-card-img--light {
  background: #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.shop-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--black);
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

.shop-card-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.shop-card-info h3 {
  font-size: clamp(16px, 1.5vw, 22px);
  font-weight: 600;
}

.shop-card-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

.shop-card-bottom {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.shop-card-price {
  font-size: 15px;
  font-weight: 600;
  color: var(--black);
}

.shop-card-status {
  display: none;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.shop-card-status.active {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
}

.shop-card-status.upcoming {
  display: inline-block;
  background: #fff3e0;
  color: #e65100;
}

.shop-card-status.out_of_stock {
  display: inline-block;
  background: #ffebee;
  color: #c62828;
}

.shop-card-status.inactive {
  display: inline-block;
  background: #f0f0f0;
  color: #999;
}

/* ── CART ICON ── */
.cart-icon-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  color: var(--black);
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--black);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── CART OVERLAY ── */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cart-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* 장바구니 열릴 때 body 스크롤 방지 */
body.cart-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* ── CART DRAWER ── */
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--white);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 32px rgba(0,0,0,0.12);
  -webkit-overflow-scrolling: touch;
}

.cart-drawer.open {
  transform: translateX(0);
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 20px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.cart-drawer-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--black);
}

.cart-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--black);
  display: flex;
  align-items: center;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.cart-close-btn:hover { opacity: 1; }

/* ── CART ITEMS ── */
.cart-items {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-empty {
  text-align: center;
  color: #999;
  font-size: 15px;
  margin-top: 60px;
}

.cart-item {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: #f8f8f8;
  border-radius: 10px;
}

.cart-item-img {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cart-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--black);
}

.cart-item-price {
  font-size: 13px;
  color: #888;
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #ddd;
  background: var(--white);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.qty-btn:hover { background: #f0f0f0; }

.qty-num {
  font-size: 15px;
  font-weight: 600;
  min-width: 20px;
  color: var(--black);
  text-align: center;
}

.cart-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  padding: 4px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.cart-item-remove:hover { color: var(--black); }

/* ── CART FOOTER ── */
.cart-drawer-footer {
  padding: 20px 24px calc(32px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eee;
  flex-shrink: 0;
}

.cart-total-count {
  font-size: 14px;
  color: #666;
  margin-bottom: 14px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  margin-bottom: 12px;
  border-top: 1px solid #eee;
}

.cart-total-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--black);
}

.cart-total-price {
  font-size: 17px;
  font-weight: 700;
  color: var(--black);
}

.btn-purchase {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--black);
  color: var(--white);
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}

.btn-purchase:hover { opacity: 0.8; }

/* ── PURCHASE MODAL ── */
.purchase-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.purchase-modal-backdrop.active,
.purchase-modal.open ~ .purchase-modal-backdrop { opacity: 1; pointer-events: auto; }

.purchase-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.96);
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--white);
  border-radius: 16px;
  padding: 32px 28px 28px;
  z-index: 301;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.purchase-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.purchase-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  padding: 4px;
  transition: color 0.2s;
}

.purchase-modal-close:hover { color: var(--black); }

.purchase-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 8px;
}

.purchase-modal-desc {
  font-size: 14px;
  color: #888;
  margin-bottom: 24px;
}

.purchase-modal-btns {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.purchase-opt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.purchase-opt--member {
  background: var(--black);
  color: var(--white);
}

.purchase-opt--guest {
  background: #f5f5f5;
  color: var(--black);
}

.purchase-opt:hover { transform: translateY(-2px); opacity: 0.88; }

.purchase-opt-title {
  font-size: 16px;
  font-weight: 700;
}

.purchase-opt-desc {
  font-size: 13px;
  opacity: 0.65;
}

/* ── SPD QTY ROW ── */
.spd-qty-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.spd-qty-btn {
  width: 36px;
  height: 36px;
  border: 1.5px solid #ddd;
  background: var(--white);
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.spd-qty-btn:hover { background: #f0f0f0; }

.spd-qty-num {
  font-size: 18px;
  font-weight: 600;
  min-width: 24px;
  text-align: center;
  color: var(--black);
}

/* ── ADD TO CART BUTTON ── */
.btn-add-to-cart {
  display: block;
  width: 100%;
  padding: 10px;
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  transition: opacity 0.2s;
  font-family: inherit;
}

.btn-add-to-cart:hover { opacity: 0.75; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .shop-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Shop nav: 모바일에서 불필요한 항목 숨김 */
  .nav-right > a[data-auth-guest],
  .nav-right > a[data-auth-member],
  .nav-right > span[data-auth-member],
  .nav-right > a[data-auth-order-link],
  .nav-right > .globe-icon {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .shop-hero {
    padding-top: calc(var(--nav-height) + 40px);
    padding-bottom: 40px;
  }

  .shop-section {
    padding: 40px 20px 80px;
  }

  .shop-card-info {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .shop-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .shop-hero {
    padding-left: 16px;
    padding-right: 16px;
  }

  .shop-section {
    padding: 32px 16px 60px;
  }
}
