/* RID App Cards - front styles (leve e responsivo) */
.rid-card{
  --rid-radius: 16px;
  --rid-shadow: 0 1px 6px rgba(0,0,0,.06);
  --rid-shadow-hover: 0 8px 24px rgba(0,0,0,.12);
  --rid-border: 1px solid rgba(0,0,0,.06);

  /* Cor primária herda do tema do site (ajuste a cadeia conforme seu tema) */
  --rid-accent: var(--wp--preset--color--primary,
                 var(--global--color-primary,
                 var(--global-palette1,
                 var(--color-primary,
                 var(--primary,
                 var(--accent, #6366f1))))));

  --rid-bg: #fff;   /* claro por padrão */
  --rid-ink: #111;
  --rid-muted: #6b7280;

  position: relative;
  border: var(--rid-border);
  border-radius: var(--rid-radius);
  box-shadow: var(--rid-shadow);
  background: var(--rid-bg);
  color: var(--rid-ink);
  padding: 16px;
  transition: box-shadow .25s ease, transform .25s ease, opacity .6s ease;
}

/* Animação de entrada (uma vez) */
@media (prefers-reduced-motion: no-preference){
  .rid-card{ opacity: .0; transform: translateY(6px); }
  .rid-card.rid-in{ opacity: 1; transform: translateY(0); }
}
.rid-card:hover{ box-shadow: var(--rid-shadow-hover); transform: translateY(-1px); }

.rid-head{
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.rid-icon{
  width: 48px; height: 48px;
  object-fit: cover; border-radius: 10px;
  background: #f3f4f6;
}
.rid-title{
  font-size: clamp(16px, 2.6vw, 20px);
  line-height: 1.2;
  margin: 0;
}

/* BADGE com ESTRELA (uma única) */
.rid-rate{
  display: inline-flex;
  align-items: center; gap: 8px;
  padding: 6px 10px;
  font-size: 12px; font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  position: relative;
  color: var(--rid-ink);

  background: linear-gradient(135deg,
               color-mix(in srgb, var(--rid-accent) 14%, transparent),
               color-mix(in srgb, var(--rid-accent) 0%, transparent));
  border: 1px solid color-mix(in srgb, var(--rid-accent) 35%, transparent);
}
/* Estrela usa mask + var(--rid-accent) (fácil de recolorir) */
.rid-rate::before{
  content: "";
  width: 14px; height: 14px; flex: 0 0 14px;
  background: var(--rid-accent);
  -webkit-mask: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'>\
<path d='M12 2l2.9 6.6 7.1.7-5.3 4.6 1.6 6.8L12 17.9 5.7 20.7l1.6-6.8L2 9.3l7.1-.7L12 2z'/>\
</svg>") no-repeat center/contain;
          mask: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'>\
<path d='M12 2l2.9 6.6 7.1.7-5.3 4.6 1.6 6.8L12 17.9 5.7 20.7l1.6-6.8L2 9.3l7.1-.7L12 2z'/>\
</svg>") no-repeat center/contain;
  filter: drop-shadow(0 0 0 rgba(0,0,0,0));
  transition: transform .2s ease, filter .2s ease;
}
/* Se JS marcar que já existe estrela no texto, oculta o ::before */
.rid-rate.rid-rate--noicon::before{ display:none; }

/* Botões herdam cor do site */
.rid-btns{
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 12px;
}
.rid-btn{
  --btn-bg: var(--rid-accent);
  --btn-ink: #fff; /* JS ajusta contraste se a cor for muito clara */
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px; border-radius: 12px;
  font-weight: 700; text-decoration: none;
  background: var(--btn-bg); color: var(--btn-ink);
  border: 1px solid color-mix(in srgb, var(--btn-bg) 25%, #0000);
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative; overflow: hidden;
  will-change: transform;
}
.rid-btn:hover, .rid-btn:focus-visible{
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 10px 22px rgba(0,0,0,.18);
  outline: none;
}
/* Shine */
.rid-btn::after{
  content: "";
  position: absolute; inset: 0 -40%;
  transform: skewX(-20deg) translateX(-120%);
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.22) 45%, rgba(255,255,255,.38) 50%, rgba(255,255,255,.22) 55%, transparent 100%);
  opacity: 0; pointer-events: none;
}
.rid-btn:hover::after{
  animation: rid-shine .7s ease forwards;
}
@keyframes rid-shine{
  from{ transform: skewX(-20deg) translateX(-120%); opacity: 0; }
  20%{ opacity: 1; }
  to{ transform: skewX(-20deg) translateX(120%); opacity: 0; }
}

/* Informações em grade */
.rid-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px;
  margin: 6px 0 8px;
}
.rid-grid small{ color: var(--rid-muted); display: block; }
.rid-grid strong{ font-weight: 700; }

/* Destaque da estrela no hover do card */
@media (prefers-reduced-motion: no-preference){
  .rid-card:hover .rid-rate::before{
    transform: scale(1.15) rotate(-8deg);
    filter: drop-shadow(0 0 8px color-mix(in srgb, var(--rid-accent) 60%, #0000));
  }
  .rid-card.rid-in .rid-rate{ animation: rid-star-pulse 2.0s ease 1; }
  .rid-card:hover .rid-rate{ animation: rid-star-pulse 1.2s ease 1; }
  @keyframes rid-star-pulse{
    0% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
    45% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--rid-accent) 16%, #0000); }
    100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
  }
}

/* Dark só quando .rid-dark (definido via JS) */
.rid-card.rid-dark{
  --rid-bg: #0b0b0c;
  --rid-ink: #f5f5f5;
  --rid-muted: #9aa0a6;
  --rid-border: 1px solid rgba(255,255,255,.06);
  --rid-shadow: 0 1px 6px rgba(0,0,0,.4);
  --rid-shadow-hover: 0 8px 30px rgba(0,0,0,.55);
  background: var(--rid-bg);
  color: var(--rid-ink);
}
.rid-card.rid-dark .rid-rate{
  background: linear-gradient(135deg,
               color-mix(in srgb, var(--rid-accent) 18%, transparent),
               color-mix(in srgb, var(--rid-accent) 0%, transparent));
  border: 1px solid color-mix(in srgb, var(--rid-accent) 55%, transparent);
}

/* Mobile first tweaks */
@media (max-width: 640px){
  .rid-card{ padding: 14px; }
  .rid-head{ grid-template-columns: 40px 1fr auto; }
  .rid-icon{ width: 40px; height: 40px; border-radius: 8px; }
  .rid-title{ font-size: 16px; }
  .rid-grid{ grid-template-columns: 1fr 1fr; }
  .rid-btn{ width: 100%; } /* botões em largura total no mobile */
}

/* Acessibilidade */
@media (prefers-reduced-motion: reduce){
  .rid-card, .rid-btn, .rid-rate::before{ transition: none !important; animation: none !important; }
}
