/**
 * Related Products Grid Widget — Frontend Styles
 * Visual style consistent with Fashion Product Grid Widget.
 */

:root {
  --rpgw-white:       #ffffff;
  --rpgw-bg:          #f8f7f5;
  --rpgw-text:        #1a1a1a;
  --rpgw-muted:       #888888;
  --rpgw-border:      #e5e5e5;
  --rpgw-accent:      #c8a96e;
  --rpgw-accent-dark: #9e7c44;
  --rpgw-koko:        #6c5ce7;
  --rpgw-ease:        cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Wrapper ─────────────────────────────────────────────────────────────────*/
.rpgw-wrapper {
  width: 100%;
  font-family: 'Jost', 'Segoe UI', sans-serif;
}

/* ── Section Header ──────────────────────────────────────────────────────────*/
.rpgw-header {
  text-align: center;
  margin-bottom: 36px;
  animation: rpgwFadeUp 0.6s var(--rpgw-ease) both;
}

.rpgw-heading {
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 400;
  color: var(--rpgw-text);
  letter-spacing: -0.3px;
  margin: 0 0 14px;
  line-height: 1.2;
}

.rpgw-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.rpgw-divider-line    { width: 50px; height: 1px; background: var(--rpgw-border); }
.rpgw-divider-diamond { width: 6px;  height: 6px; background: var(--rpgw-accent); transform: rotate(45deg); }

/* ── Grid ────────────────────────────────────────────────────────────────────*/
.rpgw-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.rpgw-cols-2 { grid-template-columns: repeat(2, 1fr); }
.rpgw-cols-3 { grid-template-columns: repeat(3, 1fr); }
.rpgw-cols-4 { grid-template-columns: repeat(4, 1fr); }
.rpgw-cols-5 { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 1024px) {
  .rpgw-tablet-1 { grid-template-columns: repeat(1, 1fr) !important; }
  .rpgw-tablet-2 { grid-template-columns: repeat(2, 1fr) !important; }
  .rpgw-tablet-3 { grid-template-columns: repeat(3, 1fr) !important; }
}

@media (max-width: 767px) {
  .rpgw-mobile-1 { grid-template-columns: repeat(1, 1fr) !important; }
  .rpgw-mobile-2 { grid-template-columns: repeat(2, 1fr) !important; }
  .rpgw-grid { gap: 12px; }
}

/* ── Card ────────────────────────────────────────────────────────────────────*/
.rpgw-card {
  display: flex;
  flex-direction: column;
  background: var(--rpgw-white);
  position: relative;
  transition: transform 0.38s var(--rpgw-ease), box-shadow 0.38s var(--rpgw-ease);
}

/* Scroll reveal */
.rpgw-sr {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s var(--rpgw-ease), transform 0.6s var(--rpgw-ease);
}
.rpgw-sr.rpgw-in { opacity: 1; transform: translateY(0); }

/* Card lift on hover */
.rpgw-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 48px rgba(0,0,0,0.11);
}

/* ── Image Wrap ──────────────────────────────────────────────────────────────*/
.rpgw-image-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: #ebe7e1;
}

.rpgw-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.65s var(--rpgw-ease);
}

.rpgw-card:hover .rpgw-zoom { transform: scale(1.06); }

/* Overlay darkening on hover */
.rpgw-img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.14) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
  z-index: 2;
}
.rpgw-card:hover .rpgw-img-overlay { opacity: 1; }

/* ── Badges ──────────────────────────────────────────────────────────────────*/
.rpgw-badge {
  position: absolute;
  top: 14px;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  z-index: 4;
  line-height: 1;
}

/* NEW — vertical, left side */
.rpgw-badge-new {
  left: 14px;
  background: var(--rpgw-text);
  color: #fff;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  padding: 8px 5px;
}

/* SALE — right of badge */
.rpgw-badge-sale {
  left: 34px;
  background: var(--rpgw-accent);
  color: #fff;
  padding: 5px 8px;
  border-radius: 2px;
}

/* ── SKU code ────────────────────────────────────────────────────────────────*/
.rpgw-sku-code {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #fff;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-radius: 2px;
  z-index: 4;
}

/* ── Hover Action Buttons ────────────────────────────────────────────────────*/
.rpgw-card-actions {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%) translateX(52px);
  display: flex;
  flex-direction: column;
  gap: 7px;
  opacity: 0;
  transition: transform 0.38s var(--rpgw-ease), opacity 0.3s;
  z-index: 6;
}

.rpgw-card:hover .rpgw-card-actions {
  transform: translateY(-50%) translateX(0);
  opacity: 1;
}

.rpgw-act-btn {
  width: 40px;
  height: 40px;
  background: var(--rpgw-white);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.14);
  transition: background 0.2s, color 0.2s, transform 0.2s;
  color: var(--rpgw-text);
  padding: 0;
}
.rpgw-act-btn:hover          { background: var(--rpgw-text); color: #fff; transform: scale(1.1); }
.rpgw-act-btn.wished         { background: var(--rpgw-accent); color: #fff; }

.rpgw-card-actions .rpgw-act-btn:nth-child(1) { transition-delay: 0s; }
.rpgw-card-actions .rpgw-act-btn:nth-child(2) { transition-delay: 0.04s; }
.rpgw-card-actions .rpgw-act-btn:nth-child(3) { transition-delay: 0.08s; }

/* ── Quick View Ribbon ───────────────────────────────────────────────────────*/
.rpgw-qv-ribbon {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.80);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-align: center;
  padding: 13px;
  transform: translateY(100%);
  transition: transform 0.35s var(--rpgw-ease);
  cursor: pointer;
  z-index: 6;
}
.rpgw-card:hover .rpgw-qv-ribbon { transform: translateY(0); }
.rpgw-qv-ribbon:hover             { background: var(--rpgw-text); letter-spacing: 4px; }

/* ── Card Body ───────────────────────────────────────────────────────────────*/
.rpgw-card-body {
  padding: 16px 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  border: 1px solid var(--rpgw-border);
  border-top: none;
  flex: 1;
}

.rpgw-name-link { text-decoration: none; }

.rpgw-name {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--rpgw-text);
  margin: 0;
  line-height: 1.4;
  transition: color 0.2s;
}
.rpgw-name-link:hover .rpgw-name { color: var(--rpgw-accent-dark); }

.rpgw-price {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--rpgw-text);
}
.rpgw-price .woocommerce-Price-amount { font-size: inherit; color: inherit; }
.rpgw-price del { color: var(--rpgw-muted); font-size: 0.8rem; }
.rpgw-price ins { text-decoration: none; font-weight: 600; }

.rpgw-installment {
  font-size: 0.7rem;
  color: var(--rpgw-muted);
  font-weight: 300;
  line-height: 1.5;
}
.rpgw-installment strong { font-weight: 600; }
.rpgw-koko {
  color: var(--rpgw-koko);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 500;
}

/* ── Wishlist Button ─────────────────────────────────────────────────────────*/
.rpgw-wishlist-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 5px;
  padding: 7px 0;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--rpgw-muted);
  transition: color 0.25s;
  position: relative;
}
.rpgw-wishlist-btn::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 1px;
  background: var(--rpgw-text);
  transition: width 0.35s var(--rpgw-ease);
}
.rpgw-wishlist-btn:hover         { color: var(--rpgw-text); }
.rpgw-wishlist-btn:hover::after  { width: 80%; }
.rpgw-wishlist-btn.wished        { color: var(--rpgw-accent-dark); }

.rpgw-wish-icon {
  flex-shrink: 0;
  transition: transform 0.3s var(--rpgw-ease);
}
.rpgw-wishlist-btn:hover .rpgw-wish-icon,
.rpgw-wishlist-btn.wished .rpgw-wish-icon { transform: scale(1.3); }

/* ── View All Button ─────────────────────────────────────────────────────────*/
.rpgw-footer {
  text-align: center;
  margin-top: 44px;
}
.rpgw-view-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 38px;
  border: 1.5px solid var(--rpgw-text);
  background: none;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--rpgw-text);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: color 0.3s, letter-spacing 0.3s;
}
.rpgw-view-all-btn::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--rpgw-text);
  transform: translateX(-100%);
  transition: transform 0.35s var(--rpgw-ease);
  z-index: 0;
}
.rpgw-view-all-btn:hover::before  { transform: translateX(0); }
.rpgw-view-all-btn:hover          { color: #fff; letter-spacing: 4px; }
.rpgw-view-all-btn span           { position: relative; z-index: 1; }
.rpgw-btn-arrow                   { position: relative; z-index: 1; transition: transform 0.3s; }
.rpgw-view-all-btn:hover .rpgw-btn-arrow { transform: translateX(5px); }

/* ── Quick View Modal ────────────────────────────────────────────────────────*/
.rpgw-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.58);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: rpgwFadeIn 0.25s var(--rpgw-ease) forwards;
}

.rpgw-modal {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 1000px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
  animation: rpgwSlideUp 0.35s var(--rpgw-ease) forwards;
}

/* Close button — no rotation */
.rpgw-modal-close {
  position: absolute;
  top: 14px; right: 18px;
  width: 32px; height: 32px;
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  color: #555;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  transform: none !important;
}
.rpgw-modal-close:hover { background: #1a1a1a; color: #fff; }

.rpgw-modal-body { overflow-y: auto; max-height: 92vh; }

/* Quick View Inner */
.rpgw-qv-inner {
  display: grid;
  grid-template-columns: 58% 42%;
  min-height: 580px;
}

.rpgw-qv-image {
  position: relative;
  background: #e8e4de;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.rpgw-qv-img-main {
  width: 100%; flex: 1;
  object-fit: cover; display: block;
  transition: opacity 0.3s ease;
  min-height: 0;
}
.rpgw-qv-img-badge {
  position: absolute;
  top: 14px; left: 14px;
  background: #1a1a1a; color: #fff;
  font-size: 0.55rem; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  writing-mode: vertical-rl; text-orientation: mixed;
  transform: rotate(180deg);
  padding: 8px 5px; line-height: 1; z-index: 3;
}
.rpgw-qv-img-meta {
  position: absolute; top: 12px; left: 40px;
  z-index: 2;
}
.rpgw-qv-img-sku {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 1.5px;
  color: #fff; background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px); padding: 3px 8px; display: inline-block;
}
.rpgw-qv-thumbs {
  display: flex; gap: 4px; padding: 6px;
  background: #fff; flex-shrink: 0;
}
.rpgw-qv-thumb {
  width: 60px; height: 72px;
  object-fit: cover; cursor: pointer;
  opacity: 0.55; border: 2px solid transparent;
  transition: opacity 0.2s, border-color 0.2s;
}
.rpgw-qv-thumb:hover         { opacity: 0.85; }
.rpgw-qv-thumb-active        { opacity: 1; border-color: #1a1a1a; }

.rpgw-qv-details {
  padding: 36px 36px 28px;
  display: flex; flex-direction: column; gap: 0;
  overflow-y: auto; background: #fff;
}
.rpgw-qv-title {
  font-family: 'Jost', inherit;
  font-size: 1.1rem; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: #1a1a1a; margin: 0 0 14px; line-height: 1.3;
  padding-right: 24px;
}
.rpgw-qv-price {
  font-size: 1.5rem; font-weight: 600; color: #1a1a1a; margin-bottom: 8px;
}
.rpgw-qv-price .woocommerce-Price-amount { font-size: inherit; color: inherit; }
.rpgw-qv-price del { color: #aaa; font-size: 1rem; margin-right: 6px; }
.rpgw-qv-price ins { text-decoration: none; }
.rpgw-qv-installment { font-size: 0.8rem; color: #666; margin-bottom: 16px; }
.rpgw-qv-installment strong { font-weight: 600; color: #333; }
.rpgw-qv-koko { color: #6c5ce7; font-weight: 600; text-decoration: underline; cursor: pointer; }
.rpgw-qv-koko-i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid #6c5ce7; color: #6c5ce7;
  font-size: 0.55rem; cursor: pointer; vertical-align: middle; font-style: normal;
}
.rpgw-qv-divider { height: 1px; background: #eee; margin: 2px 0 18px; }

/* Option buttons */
.rpgw-qv-attr-group { margin-bottom: 16px; }
.rpgw-qv-attr-label {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase; color: #888; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.rpgw-qv-selected-val { font-weight: 700; color: #1a1a1a; font-size: 0.75rem; letter-spacing: 1px; }
.rpgw-qv-options { display: flex; flex-wrap: wrap; gap: 8px; }
.rpgw-qv-opt-btn {
  min-width: 52px; padding: 8px 12px;
  border: 1.5px solid #ddd; background: #fff;
  font-family: inherit; font-size: 0.8rem; font-weight: 500; color: #444;
  cursor: pointer; border-radius: 2px;
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.15s;
}
.rpgw-qv-opt-btn:hover   { border-color: #999; color: #1a1a1a; transform: translateY(-1px); }
.rpgw-qv-opt-btn.selected { background: #1a1a1a; border-color: #1a1a1a; color: #fff; transform: translateY(-1px); }

/* Quantity */
.rpgw-qv-qty-wrap {
  display: flex; align-items: center;
  border: 1px solid #ddd; height: 50px;
  margin: 16px 0; overflow: hidden;
  background: #f5f3f0;
}
.rpgw-qv-qty-btn {
  width: 50px; height: 100%;
  background: none; border: none;
  font-size: 1.3rem; color: #888;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s; flex-shrink: 0; font-family: inherit;
}
.rpgw-qv-qty-btn:hover { background: #ece9e4; color: #1a1a1a; }
.rpgw-qv-qty-input {
  flex: 1; height: 100%;
  border: none; border-left: 1px solid #ddd; border-right: 1px solid #ddd;
  text-align: center; font-size: 1rem; font-family: inherit;
  color: #1a1a1a; outline: none; -moz-appearance: textfield;
  background: #f5f3f0; cursor: default;
}
.rpgw-qv-qty-input::-webkit-inner-spin-button,
.rpgw-qv-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* Buttons */
.rpgw-qv-buttons { display: flex; flex-direction: column; gap: 10px; }
.rpgw-qv-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 15px;
  font-family: inherit; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 2.5px; text-transform: uppercase;
  cursor: pointer; border: none; text-decoration: none;
  transition: background 0.25s, color 0.25s;
}
.rpgw-qv-btn-buy  { background: #7a7a7a; color: #fff; }
.rpgw-qv-btn-buy:hover { background: #555; }
.rpgw-qv-btn-cart { background: #eee; color: #1a1a1a; border: 1.5px solid #ddd; }
.rpgw-qv-btn-cart:hover   { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.rpgw-qv-btn-cart.loading { opacity: 0.55; pointer-events: none; }
.rpgw-qv-btn-cart.success { background: #2ecc71; color: #fff; border-color: #2ecc71; }

.rpgw-qv-full-link {
  display: inline-block; margin-top: 14px;
  font-size: 0.75rem; font-weight: 500; letter-spacing: 1.5px;
  color: #888; text-decoration: none; border-bottom: 1px solid #ddd;
  padding-bottom: 1px; align-self: flex-start;
  transition: color 0.2s, border-color 0.2s;
}
.rpgw-qv-full-link:hover { color: #1a1a1a; border-color: #1a1a1a; }

@media (max-width: 700px) {
  .rpgw-qv-inner    { grid-template-columns: 1fr; min-height: auto; }
  .rpgw-qv-image    { max-height: 70vw; }
  .rpgw-qv-img-main { max-height: 70vw; }
  .rpgw-qv-details  { padding: 22px 18px 24px; }
}

/* ── Toast ───────────────────────────────────────────────────────────────────*/
.rpgw-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #1a1a1a; color: #fff;
  font-family: inherit; font-size: 0.82rem; font-weight: 500;
  padding: 13px 20px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  transform: translateY(80px); opacity: 0;
  transition: all 0.35s var(--rpgw-ease);
  z-index: 99999; pointer-events: none;
  border-left: 3px solid var(--rpgw-accent);
  max-width: 320px;
}
.rpgw-toast.rpgw-toast-show { transform: translateY(0); opacity: 1; }

/* ── No products ─────────────────────────────────────────────────────────────*/
.rpgw-no-products {
  text-align: center; padding: 48px;
  color: var(--rpgw-muted); font-size: 0.88rem;
  border: 2px dashed var(--rpgw-border);
}

/* ── Keyframes ───────────────────────────────────────────────────────────────*/
@keyframes rpgwFadeUp  { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: none; } }
@keyframes rpgwFadeIn  { from { opacity:0; }  to { opacity:1; } }
@keyframes rpgwSlideUp { from { opacity:0; transform: translateY(40px); } to { opacity:1; transform: none; } }
