/* 최근 본 상품 위젯 */
.recent-products-widget {
  margin: 32px auto;
  padding: 0 16px;
  max-width: 1280px;
  box-sizing: border-box;
}

.recent-products-widget .recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.recent-products-widget .recent-title {
  font-size: 18px;
  font-weight: 700;
  color: #111;
  margin: 0;
  letter-spacing: -0.3px;
}

.recent-products-widget .recent-clear {
  background: none;
  border: none;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.recent-products-widget .recent-clear:hover { color: #444; }

.recent-products-widget .recent-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.recent-products-widget .recent-scroll::-webkit-scrollbar { height: 6px; }
.recent-products-widget .recent-scroll::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
.recent-products-widget .recent-scroll::-webkit-scrollbar-track { background: transparent; }

.recent-products-widget .recent-card {
  flex: 0 0 auto;
  width: 160px;
  text-decoration: none;
  color: inherit;
  display: block;
}

.recent-products-widget .recent-thumb {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 1:1 정사각 */
  background: #f5f5f3;
  border-radius: 8px;
  overflow: hidden;
}
.recent-products-widget .recent-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recent-products-widget .recent-soldout {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.recent-products-widget .recent-info {
  padding: 10px 2px 0;
}

.recent-products-widget .recent-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}
.recent-products-widget .recent-price .discount {
  color: #d32f2f;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.3px;
}
.recent-products-widget .recent-price .price {
  color: #111;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.3px;
}

.recent-products-widget .recent-name {
  font-size: 13px;
  color: #333;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: 36px;
}

/* 모바일 */
@media (max-width: 768px) {
  .recent-products-widget {
    margin: 24px auto;
    padding: 0 12px;
  }
  .recent-products-widget .recent-title { font-size: 16px; }
  .recent-products-widget .recent-card { width: 130px; }
  .recent-products-widget .recent-name { font-size: 12px; min-height: 32px; }
  .recent-products-widget .recent-price .discount,
  .recent-products-widget .recent-price .price { font-size: 13px; }
}

/* ============================================================
   라이트레일 peek 카드 (최근 본 상품 — 클릭 시 패널 열림)
============================================================ */
.rail-recent {
  width: 56px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: all 0.2s;
}
.rail-recent:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.rail-recent[aria-expanded="true"] {
  border-color: #6ca041;
}
.rail-recent-thumb {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
}
.rail-recent-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rail-recent-label {
  font-size: 10.5px;
  font-weight: 500;
  color: #333;
  letter-spacing: -0.4px;
  line-height: 1;
}

/* 모바일 FAB의 최근 본 아이콘 (썸네일 모드) */
.fab-icon-recent {
  position: relative;
  overflow: hidden;
}
.fab-icon-recent .fab-recent-img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
}

.recent-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 10000; /* 헤더(1000)/사이드바(9999) 위에 깔리도록 */
  animation: rpFadeIn 0.18s ease;
}
@keyframes rpFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.recent-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
  z-index: 10001; /* 오버레이 위에 */
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.recent-panel.open {
  transform: translateX(0);
}

.recent-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}
.recent-panel-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #111;
}
.recent-panel-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #888;
  padding: 4px 8px;
}
.recent-panel-close:hover { color: #222; }

.recent-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.recent-panel-footer {
  padding: 10px 18px;
  border-top: 1px solid #eee;
  flex-shrink: 0;
  text-align: right;
}
.recent-panel-clear {
  background: none;
  border: none;
  font-size: 12px;
  color: #888;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 4px;
}
.recent-panel-clear:hover { color: #444; }

.recent-panel-empty,
.recent-panel-loading {
  padding: 40px 20px;
  text-align: center;
  color: #aaa;
  font-size: 14px;
}

/* 패널 안 카드 한 줄 */
.recent-panel .rp-item {
  display: flex;
  gap: 12px;
  padding: 10px 18px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f4f5f7;
}
.recent-panel .rp-item:last-child { border-bottom: none; }
.recent-panel .rp-item:hover { background: #fafafa; }

.recent-panel .rp-thumb {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  background: #f5f5f3;
}
.recent-panel .rp-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.recent-panel .rp-soldout {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.recent-panel .rp-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.recent-panel .rp-name {
  font-size: 13px;
  color: #222;
  line-height: 1.35;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.recent-panel .rp-price {
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.recent-panel .rp-disc {
  color: #d32f2f;
  font-weight: 800;
  font-size: 13px;
}
.recent-panel .rp-amt {
  color: #111;
  font-weight: 700;
  font-size: 13px;
}

/* 모바일에서는 라이트레일 자체가 숨겨지지만, 패널은 모바일에서도 동작.
   오버레이는 풀스크린 패널에 가려져 의미 없으므로 모바일에서만 숨김. */
@media (max-width: 1024px) {
  .recent-panel {
    width: 100%;
    max-width: 100%;
  }
  .recent-panel-header { padding: 14px 16px; }
  .recent-panel .rp-item { padding: 10px 16px; }
  .recent-panel-overlay { display: none !important; }
}
