/* ==========================================================================
   PERFECTOO PROTECTOR — PRODUCT DETAIL PANEL
   A right-hand drawer on desktop, a bottom sheet on mobile. Media scrolls on
   the left while the details stay in view on the right. The panel shows
   itself with a CSS entrance animation, so it does not depend on any class
   your JavaScript adds; if the panel exists in the page, it is visible.
   ========================================================================== */

/* ---------- 1. Tokens (same as other sections; move to :root later) ---------- */
.product-panel, .product-panel-backdrop {
  --bg:#F2F6F9; --bg-tint:#E4EEF4; --surface:#FFFFFF;
  --ink:#10202C; --ink-2:#46586A; --ink-3:#7A8B9A; --line:#D5E1EA;
  --accent:#0A6B78; --accent-hover:#085862; --accent-soft:#D8EEF0; --signal:#E8A33D;
  --deep:#06323A; --deep-2:#0A5560; --deep-3:#04222A;
  --font-display:"Bricolage Grotesque","Segoe UI",system-ui,sans-serif;
  --font-body:"Instrument Sans","Segoe UI",system-ui,sans-serif;
  --r-lg:26px; --r-xl:34px;
  --ease:cubic-bezier(.2,.7,.2,1);
}
.product-panel-root[hidden] { display: none !important; }

/* ---------- 2. Backdrop + drawer ---------- */
.product-panel-backdrop {
  position: fixed; inset: 0; z-index: 200; cursor: pointer;
  background: rgba(4,34,42,.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: panel-fade .3s var(--ease) both;
}
.product-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 210;
  width: min(1080px, 100%);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); color: var(--ink);
  border-radius: var(--r-xl) 0 0 var(--r-xl);
  box-shadow: -40px 0 80px -40px rgba(4,34,42,.6);
  font-family: var(--font-body); -webkit-font-smoothing: antialiased;
  animation: panel-in .45s var(--ease) both;
}
.product-panel *, .product-panel *::before, .product-panel *::after { box-sizing: border-box; }

@keyframes panel-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes panel-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }

/* ---------- 3. Header (sticky) ---------- */
.product-panel .product-panel-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 20px clamp(20px, 3vw, 36px);
  background: rgba(255,255,255,.88);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.product-panel .product-panel-title { min-width: 0; }
.product-panel .panel-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: .8125rem; font-weight: 600; color: var(--accent);
}
.product-panel .panel-eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--accent); }
.product-panel .product-panel-header h2 {
  margin: 6px 0 0;
  font: 800 clamp(1.4rem, 2.6vw, 2.1rem)/1.05 var(--font-display); letter-spacing: -.035em;
  color: var(--ink); overflow-wrap: anywhere;
}
.product-panel .panel-close {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; padding: 0 0 3px;
  border-radius: 50%; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink);
  font: 400 1.7rem/1 var(--font-body);
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .3s var(--ease);
}
.product-panel .panel-close:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: rotate(90deg); }
.product-panel .panel-close:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- 4. Body: media left, details right ---------- */
.product-panel .product-panel-body {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: clamp(20px, 3vw, 40px); align-items: start;
  padding: clamp(20px, 3vw, 36px);
}

/* Media */
.product-panel .product-panel-media { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.product-panel .panel-media-item {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--r-lg); padding: 10px;
  background:
    radial-gradient(70% 70% at 70% 10%, #fff 0%, transparent 65%),
    linear-gradient(180deg, var(--bg-tint) 0%, #D3E3EC 100%);
  border: 1px solid var(--line);
}
.product-panel .panel-media-item img {
  display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain;
  border-radius: calc(var(--r-lg) - 10px);
}
.product-panel .media-caption { margin: 12px 6px 4px; font-size: .8125rem; font-weight: 500; color: var(--ink-2); }
.product-panel .external-media {
  display: inline-flex; align-items: center; gap: 12px; margin: 6px;
  padding: 12px 20px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: .9375rem; font-weight: 600; color: var(--accent); text-decoration: none;
  transition: background-color .25s var(--ease), border-color .25s var(--ease);
}
.product-panel .external-media::after { content: "↗"; }
.product-panel .external-media:hover { background: var(--accent-soft); border-color: var(--accent); }
.product-panel .external-media:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.product-panel .media-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  min-height: 320px; border-radius: var(--r-lg);
  color: rgba(255,255,255,.75); font-size: .8125rem; font-weight: 500;
  background:
    radial-gradient(60% 70% at 70% 20%, rgba(120,220,230,.35) 0%, transparent 60%),
    linear-gradient(160deg, var(--deep-2) 0%, var(--deep) 100%);
}
.product-panel .media-placeholder::before {
  content: "PP"; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: #fff; color: var(--accent); font: 800 1.1rem/1 var(--font-display);
  box-shadow: 0 0 0 8px rgba(255,255,255,.14);
}

/* ---------- 5. Info (stays in view while media scrolls) ---------- */
.product-panel .product-panel-info {
  position: sticky; top: 108px; align-self: start; min-width: 0;
  display: flex; flex-direction: column; gap: 22px;
  max-height: calc(100dvh - 132px); overflow-y: auto; overscroll-behavior: contain;
  padding: 2px 2px 4px;
}
.product-panel .lead {
  margin: 0; font: 700 clamp(1.15rem, 1.7vw, 1.45rem)/1.3 var(--font-display);
  letter-spacing: -.02em; color: var(--ink); text-wrap: pretty;
}
.product-panel .description {
  font-size: 1rem; line-height: 1.75; color: var(--ink-2); white-space: pre-line; text-wrap: pretty;
}
.product-panel .product-panel-info > p:not(.lead) {
  margin: 0; padding: 16px 20px; border-radius: var(--r-lg);
  background: var(--accent-soft); font-size: .9375rem; line-height: 1.6; color: var(--ink);
}
.product-panel .product-panel-info > p:not(.lead) strong { color: var(--accent); font-weight: 700; }

/* Specs: label / value rows */
.product-panel .specs {
  list-style: none; margin: 0; padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.product-panel .specs li {
  display: flex; gap: 18px; padding: 14px 20px;
  font-size: .9375rem; font-weight: 600; color: var(--ink); overflow-wrap: anywhere;
}
.product-panel .specs li:nth-child(odd) { background: var(--bg); }
.product-panel .specs li span { flex: 0 0 40%; font-weight: 500; color: var(--ink-3); }

/* Tags */
.product-panel .product-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.product-panel .tag {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: .75rem; font-weight: 600; color: var(--ink-2);
}
.product-panel .tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tag-color, var(--accent)); }

/* Price */
.product-panel .product-price {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px;
  padding-top: 20px; border-top: 1px solid var(--line); font-family: var(--font-display);
}
.product-panel .price-old { font-size: 1rem; font-weight: 500; color: var(--ink-3); text-decoration: line-through; }
.product-panel .price-new, .product-panel .price-current {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; color: var(--accent);
}
.product-panel .product-price.large .price-new,
.product-panel .product-price.large .price-current { font-size: clamp(1.9rem, 3vw, 2.5rem); }

/* ---------- 6. Actions ---------- */
.product-panel .panel-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.product-panel .panel-actions .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 54px; padding: 6px 24px; border-radius: 999px; cursor: pointer;
  border: 1px solid transparent; text-decoration: none;
  font: 600 .9375rem/1 var(--font-body);
  transition: background-color .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
.product-panel .panel-actions .btn:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }

/* Inquire: the main action, takes the full row */
.product-panel .panel-actions .btn-primary {
  order: 3; flex: 1 1 100%; justify-content: space-between; padding: 6px 6px 6px 26px;
  background: var(--accent); color: #fff; box-shadow: 0 10px 24px -12px rgba(10,107,120,.7);
}
.product-panel .panel-actions .btn-primary::after,
.product-panel .panel-actions .btn-whatsapp::after {
  content: "↗"; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.18); font-size: 1rem; transition: transform .3s var(--ease);
}
.product-panel .panel-actions .btn-primary:hover { background: var(--accent-hover); }
.product-panel .panel-actions .btn-primary:hover::after,
.product-panel .panel-actions .btn-whatsapp:hover::after { transform: translate(2px, -2px); }

.product-panel .panel-actions .btn-whatsapp {
  order: 2; flex: 1 1 0; justify-content: space-between; padding: 6px 6px 6px 22px;
  background: #128C4A; color: #fff;
}
.product-panel .panel-actions .btn-whatsapp:hover { background: #0E7A3F; }

.product-panel .panel-actions .btn-ghost,
.product-panel .panel-actions .like-btn {
  order: 1; flex: 1 1 0; background: var(--surface); color: var(--ink); border-color: var(--line);
}
.product-panel .panel-actions .like-btn::before { content: "♥"; color: var(--accent); }
.product-panel .panel-actions .like-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.product-panel .panel-actions .like-btn.liked,
.product-panel .panel-actions .like-btn.is-liked,
.product-panel .panel-actions .like-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- 7. Responsive ---------- */
@media (max-width: 900px) {
  .product-panel .product-panel-body { grid-template-columns: 1fr; }
  .product-panel .product-panel-info { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 760px) {
  .product-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 94dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: 0 -30px 60px -30px rgba(4,34,42,.6);
    animation-name: panel-up;
  }
  .product-panel .product-panel-header { padding: 16px 20px; }
  .product-panel .panel-actions .btn-whatsapp,
  .product-panel .panel-actions .like-btn { flex: 1 1 100%; }
}
@keyframes panel-up { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }

/* ---------- 8. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .product-panel, .product-panel-backdrop { animation: none; }
  .product-panel .panel-close, .product-panel .external-media,
  .product-panel .panel-actions .btn, .product-panel .panel-actions .btn::after { transition: none; }
  .product-panel .panel-close:hover,
  .product-panel .panel-actions .btn:hover::after { transform: none; }
}