/* ============================================================
   Refurb Grade Pro — PDP Badge UI v2.0
   ============================================================ */

/* ── CSS Variables ── */
:root {
  --rg-font:      'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --rg-radius:    14px;
  --rg-shadow:    0 2px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
  --rg-shadow-lg: 0 8px 40px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.07);
  --rg-border:    1px solid rgba(0,0,0,.09);
  /* Grade A — emerald */
  --rg-a-bg:   #f0fdf4; --rg-a-border:#bbf7d0; --rg-a-dot:#16a34a; --rg-a-text:#14532d; --rg-a-pill:#dcfce7;
  /* Grade B — sky */
  --rg-b-bg:   #f0f9ff; --rg-b-border:#bae6fd; --rg-b-dot:#0284c7; --rg-b-text:#0c4a6e; --rg-b-pill:#e0f2fe;
  /* Grade C — amber */
  --rg-c-bg:   #fffbeb; --rg-c-border:#fde68a; --rg-c-dot:#d97706; --rg-c-text:#78350f; --rg-c-pill:#fef3c7;
}

/* ════════════════════════════════════════
   PDP BADGE BLOCK
   ════════════════════════════════════════ */
.wma-refurb-box {
  display: flex;
  align-items: stretch;
  margin: 10px 0 18px;
  border-radius: var(--rg-radius);
  border: var(--rg-border);
  background: #fff;
  box-shadow: var(--rg-shadow);
  overflow: hidden;
  font-family: var(--rg-font);
  animation: wmaSlideIn .3s cubic-bezier(.22,.68,0,1.2) both;
}

@keyframes wmaSlideIn {
  from { opacity:0; transform:translateY(-5px); }
  to   { opacity:1; transform:translateY(0); }
}

/* Coloured left accent strip */
.wma-refurb-box .wma-grade-accent {
  flex: 0 0 5px;
  border-radius: 2px 0 0 2px;
}
.wma-grade-a .wma-grade-accent { background: var(--rg-a-dot); }
.wma-grade-b .wma-grade-accent { background: var(--rg-b-dot); }
.wma-grade-c .wma-grade-accent { background: var(--rg-c-dot); }

/* Inner layout */
.wma-refurb-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

/* ── Grade circle ── */
.wma-grade-circle {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 20px;
  font-family: var(--rg-font);
  line-height: 1;
  transition: transform .15s ease;
}
.wma-refurb-box:hover .wma-grade-circle { transform: scale(1.07); }

.wma-grade-a .wma-grade-circle { background: var(--rg-a-pill); color: var(--rg-a-dot); }
.wma-grade-b .wma-grade-circle { background: var(--rg-b-pill); color: var(--rg-b-dot); }
.wma-grade-c .wma-grade-circle { background: var(--rg-c-pill); color: var(--rg-c-dot); }

/* ── Main content ── */
.wma-grade-main { flex: 1; min-width: 0; }

/* Pill badge (Ricondizionato · Grado X) */
.wma-grade-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .1px;
  font-family: var(--rg-font);
  margin-bottom: 4px;
}
.wma-grade-a .wma-grade-badge { background: var(--rg-a-pill); color: var(--rg-a-text); }
.wma-grade-b .wma-grade-badge { background: var(--rg-b-pill); color: var(--rg-b-text); }
.wma-grade-c .wma-grade-badge { background: var(--rg-c-pill); color: var(--rg-c-text); }

.wma-grade-title {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  font-family: var(--rg-font);
  line-height: 1.3;
  margin-bottom: 2px;
}
.wma-grade-desc {
  font-size: 12.5px;
  color: #666;
  font-family: var(--rg-font);
  line-height: 1.4;
}
.wma-grade-note {
  margin-top: 5px;
  font-size: 12px;
  color: #777;
  font-style: italic;
  font-family: var(--rg-font);
}
.wma-grade-note-2 { color: #999; }

/* ── Meta row ── */
.wma-grade-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Verified pill */
.wma-verified-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #166534;
  background: #dcfce7;
  font-family: var(--rg-font);
  white-space: nowrap;
}

/* "Cosa significa?" button */
.wma-grade-btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(0,0,0,.03);
  font-size: 11.5px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  font-family: var(--rg-font);
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.wma-grade-btn:hover { background: rgba(0,0,0,.07); border-color: rgba(0,0,0,.2); }

.wma-grade-link {
  font-size: 12px;
  font-weight: 600;
  color: #0284c7;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Defect chips */
.wma-chiprow { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; }
.wma-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  background: #f4f4f4;
  border: 1px solid rgba(0,0,0,.08);
  font-family: var(--rg-font);
}

/* Defect thumbs */
.wma-thumbrow { display:flex; flex-wrap:wrap; gap:7px; margin-top:10px; }
.wma-thumb {
  display: block;
  width: 52px; height: 52px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.10);
  transition: transform .15s, box-shadow .15s;
}
.wma-thumb:hover { transform:scale(1.07); box-shadow:0 4px 12px rgba(0,0,0,.15); }
.wma-thumb img { width:100%; height:100%; object-fit:cover; display:block; }


/* ════════════════════════════════════════
   ARCHIVE BADGE
   ════════════════════════════════════════ */
.wma-refurb-archive { margin: 5px 0 4px; }
.wma-grade-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--rg-font);
}
.wma-grade-pill.wma-grade-a { background: var(--rg-a-pill); color: var(--rg-a-text); }
.wma-grade-pill.wma-grade-b { background: var(--rg-b-pill); color: var(--rg-b-text); }
.wma-grade-pill.wma-grade-c { background: var(--rg-c-pill); color: var(--rg-c-text); }


/* ════════════════════════════════════════
   MODAL
   ════════════════════════════════════════ */
.wma-modal {
  position: fixed; inset: 0; z-index: 99999;
  display: none; align-items: center; justify-content: center;
}
.wma-modal.is-open { display: flex; }

.wma-modal__backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  animation: wmaFadeIn .2s ease both;
}
@keyframes wmaFadeIn { from{opacity:0;} to{opacity:1;} }

.wma-modal__panel {
  position: relative; z-index: 1;
  max-width: 660px;
  width: calc(100% - 32px);
  max-height: 88vh;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--rg-shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: wmaModalIn .28s cubic-bezier(.22,.68,0,1.2) both;
}
@keyframes wmaModalIn {
  from { opacity:0; transform:scale(.95) translateY(12px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}

.wma-modal__close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.95);
  font-size: 17px; line-height:1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #555;
  transition: background .15s;
}
.wma-modal__close:hover { background: #f0f0f0; }

.wma-modal__content {
  padding: 22px 22px 18px;
  overflow-y: auto;
  flex: 1;
}
.wma-modal__loading {
  text-align: center; padding: 28px 0;
  color: #999; font-size: 14px;
  font-family: var(--rg-font);
}


/* ════════════════════════════════════════
   LEGEND (shortcode + modal)
   ════════════════════════════════════════ */
.wma-legend { font-family: var(--rg-font); }
.wma-legend h2 { font-size: 19px; font-weight: 800; color: #111; margin: 0 0 6px; }
.wma-legend > p { font-size: 13px; color: #666; margin: 0 0 16px; line-height: 1.5; }

.wma-legend-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px; margin: 0 0 20px;
}
.wma-legend-card {
  border-radius: 12px;
  padding: 14px;
}
.wma-legend-card.wma-grade-a { background: var(--rg-a-bg); border: 1px solid var(--rg-a-border); }
.wma-legend-card.wma-grade-b { background: var(--rg-b-bg); border: 1px solid var(--rg-b-border); }
.wma-legend-card.wma-grade-c { background: var(--rg-c-bg); border: 1px solid var(--rg-c-border); }

.wma-legend-grade-letter {
  font-size: 32px; font-weight: 900; line-height: 1;
  margin-bottom: 7px; font-family: var(--rg-font);
}
.wma-legend-card.wma-grade-a .wma-legend-grade-letter { color: var(--rg-a-dot); }
.wma-legend-card.wma-grade-b .wma-legend-grade-letter { color: var(--rg-b-dot); }
.wma-legend-card.wma-grade-c .wma-legend-grade-letter { color: var(--rg-c-dot); }

.wma-legend-title { font-size: 13px; font-weight: 800; color: #111; margin-bottom: 4px; }
.wma-legend-text  { font-size: 12px; line-height: 1.45; color: #555; }

/* Inline badge in legend (reuse shared .wma-grade-badge) */
.wma-legend-card .wma-grade-badge { margin-bottom: 8px; }

.wma-legend-table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  border: 1px solid rgba(0,0,0,.09);
  border-radius: 12px;
  overflow: hidden;
  font-size: 13px;
  font-family: var(--rg-font);
}
.wma-legend-table th, .wma-legend-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(0,0,0,.07);
}
.wma-legend-table thead th {
  font-weight: 800; background: rgba(0,0,0,.03); color: #333;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
}
.wma-legend-table tbody tr:last-child td { border-bottom: 0; }
.wma-legend-table td:first-child { font-weight: 800; }

.wma-legend h3 { font-size: 15px; font-weight: 800; color: #111; margin: 20px 0 10px; }

.wma-faq details {
  border: 1px solid rgba(0,0,0,.09);
  border-radius: 10px; padding: 10px 14px;
  margin: 7px 0; background: #fafafa;
}
.wma-faq summary {
  cursor: pointer; font-weight: 700; font-size: 13px; color: #222;
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.wma-faq summary::-webkit-details-marker { display: none; }
.wma-faq summary::after { content:'+'; font-size:17px; font-weight:400; color:#aaa; flex-shrink:0; transition:transform .2s; }
.wma-faq details[open] summary::after { transform:rotate(45deg); }
.wma-faq__a { margin-top: 8px; font-size: 13px; color: #555; line-height: 1.5; }

.wma-legend-footnote {
  margin-top: 14px; font-size: 12px; color: #999; line-height: 1.5;
  padding-top: 14px; border-top: 1px solid rgba(0,0,0,.07);
}


/* ════════════════════════════════════════
   SHOP FILTER BAR
   ════════════════════════════════════════ */
.wma-filterbar { margin: 10px 0 18px; }
.wma-filterbar__inner {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 10px 14px;
  border: var(--rg-border);
  border-radius: var(--rg-radius);
  background: #fff;
  box-shadow: var(--rg-shadow);
  font-family: var(--rg-font);
}
.wma-filterbar__label { font-weight: 700; font-size: 13px; color: #333; }
.wma-filterbar__select {
  height: 36px; min-width: 148px;
  border-radius: 10px; border: 1px solid rgba(0,0,0,.14);
  padding: 0 10px; font-size: 13px;
  font-family: var(--rg-font); background: #fff; cursor: pointer;
}
.wma-filterbar__btn {
  height: 36px; padding: 0 16px;
  border-radius: 10px; border: none;
  background: #111; color: #fff;
  font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: var(--rg-font);
  transition: background .15s;
}
.wma-filterbar__btn:hover { background: #333; }
.wma-filterbar__clear {
  font-size: 13px; font-weight: 600; color: #999;
  text-decoration: underline; text-underline-offset: 2px;
  font-family: var(--rg-font);
}
.wma-filterbar__clear:hover { color: #555; }


/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 600px) {
  .wma-legend-cards { grid-template-columns: 1fr; }
  .wma-modal__panel { border-radius: 18px 18px 0 0; align-self: flex-end; max-height: 92vh; width: 100%; }
  .wma-modal { align-items: flex-end; }
}
