/* ============================================================
   REGALOS 365 · CARRO DE COMPRAS
   Botón flotante, panel lateral, aviso y botones "Agregar".
   Usa la paleta del tema premium (tinta, rojo, lima).
   DigitalForce · d-force.cl
   ============================================================ */
:root{
  --c-ink:#121014; --c-ink2:#3F3B45; --c-muted:#86828D;
  --c-paper:#F6F3EE; --c-paper2:#EFEBE4; --c-line:rgba(18,16,20,.10);
  --c-red:#C8102E; --c-lime:#CCFF00; --c-wa:#1FBE5B;
}
html.r365c-lock, html.r365c-lock body{ overflow:hidden !important; }

/* ---------- Botón flotante ---------- */
.r365c-fab{
  position:fixed; left:20px; bottom:24px; z-index:9998;
  width:60px; height:60px; border-radius:50%; border:0; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  background:var(--c-ink); color:#fff;
  box-shadow:0 12px 30px -8px rgba(18,16,20,.55);
  transition:transform .2s ease, background .2s ease;
  -webkit-tap-highlight-color:transparent;
}
.r365c-fab:hover{ transform:translateY(-2px); background:var(--c-red); }
.r365c-fab:focus-visible{ outline:3px solid var(--c-lime); outline-offset:3px; }
.r365c-fab svg{ width:26px; height:26px; }
.r365c-badge{
  position:absolute; top:-4px; right:-4px; min-width:24px; height:24px; padding:0 6px;
  border-radius:12px; background:var(--c-lime); color:#000; border:2px solid var(--c-ink);
  font:800 12px/20px 'Inter',system-ui,sans-serif; text-align:center;
  transform:scale(0); transition:transform .25s cubic-bezier(.3,1.6,.5,1);
}
.r365c-fab.has-items .r365c-badge{ transform:scale(1); }
.r365c-fab.bump{ animation:r365cBump .5s ease; }
@keyframes r365cBump{ 0%{transform:scale(1)} 35%{transform:scale(1.18)} 70%{transform:scale(.94)} 100%{transform:scale(1)} }

/* ---------- Carro destellante: siempre visible (tienda, ficha y revista) ---------- */
.r365c-fab{ isolation:isolate; overflow:visible; animation:r365cGlow 2.6s ease-in-out infinite; }
.r365c-fab::before{            /* aro de luz que gira alrededor del botón */
  content:""; position:absolute; inset:-3px; z-index:-1; border-radius:50%;
  background:conic-gradient(from 0deg, transparent 0 55%, rgba(204,255,0,.15) 62%, #CCFF00 74%, #fff 80%, transparent 88% 100%);
  -webkit-mask:radial-gradient(circle, transparent calc(100% - 4px), #000 calc(100% - 3px));
          mask:radial-gradient(circle, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation:r365cSpin 2.4s linear infinite;
}
.r365c-fab::after{             /* brillo que cruza el ícono */
  content:""; position:absolute; inset:0; border-radius:50%; overflow:hidden; pointer-events:none;
  background:linear-gradient(115deg, transparent 38%, rgba(255,255,255,.55) 50%, transparent 62%) no-repeat;
  background-size:250% 100%; animation:r365cSheen 3.2s ease-in-out infinite .6s;
}
.r365c-fab.has-items{ background:var(--c-red); }
@keyframes r365cSpin { to { transform:rotate(360deg); } }
@keyframes r365cSheen { 0%{ background-position:130% 0 } 35%,100%{ background-position:-130% 0 } }
@keyframes r365cGlow {
  0%,100%{ box-shadow:0 12px 30px -8px rgba(18,16,20,.55), 0 0 0 0 rgba(204,255,0,0); }
  50%    { box-shadow:0 12px 30px -8px rgba(18,16,20,.55), 0 0 22px 4px rgba(204,255,0,.45); }
}
.r365c-fab.bump{ animation:r365cBump .5s ease, r365cGlow 2.6s ease-in-out infinite .5s; }
/* Dentro de la revista: arriba del libro, sin tapar botones */
html.rv-lock .r365c-fab{ z-index:100001; left:auto; right:18px; bottom:18px; }
@media (max-width:820px){ html.rv-lock .r365c-fab{ right:66px; bottom:auto; top:calc(6px + env(safe-area-inset-top, 0px)); width:40px; height:40px; } html.rv-lock .r365c-fab svg{ width:19px; height:19px; } html.rv-lock .r365c-badge{ min-width:20px; height:20px; font-size:11px; line-height:16px; } }
@media (prefers-reduced-motion: reduce){ .r365c-fab, .r365c-fab::before, .r365c-fab::after{ animation:none !important; } }

/* Los avisos de "compras recientes" suben para no tapar el carro */
.sales-toast-overlay, .social-proof-popup{ bottom:100px !important; }

/* En la ficha de producto (móvil) el carro va sobre la barra de compra */
@media (max-width:768px){
  body:has(.mobile-sticky-buy-bar) .r365c-fab{ bottom:96px; }
}
@media (max-width:640px){
  .r365c-fab{ width:54px; height:54px; left:14px; bottom:18px; }
  .r365c-fab svg{ width:24px; height:24px; }
}

/* ---------- Fondo y panel ---------- */
.r365c-overlay{
  position:fixed; inset:0; z-index:100002; background:rgba(18,16,20,.5);
  opacity:0; visibility:hidden; transition:opacity .25s ease, visibility .25s;
  backdrop-filter:blur(2px); -webkit-backdrop-filter:blur(2px);
}
.r365c-overlay.is-open{ opacity:1; visibility:visible; }
.r365c-drawer{
  position:fixed; top:0; right:0; bottom:0; z-index:100003;
  width:min(420px, 100%); background:var(--c-paper); color:var(--c-ink);
  display:flex; flex-direction:column;
  font-family:'Inter',system-ui,-apple-system,sans-serif;
  transform:translateX(100%); visibility:hidden;
  transition:transform .32s cubic-bezier(.2,.8,.2,1), visibility .32s;
  box-shadow:-20px 0 60px -20px rgba(18,16,20,.35);
}
.r365c-drawer:not(.is-open), .r365c-overlay:not(.is-open){ pointer-events:none; }
.r365c-drawer.is-open{ transform:none; visibility:visible; }
.r365c-drawer *, .r365c-drawer *::before, .r365c-drawer *::after{ box-sizing:border-box; }

.r365c-head{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:20px 20px 16px; border-bottom:1px solid var(--c-line); background:#fff;
}
.r365c-head h2{
  margin:0; font-family:'Anton','Outfit',Impact,sans-serif; font-weight:400;
  font-size:28px; letter-spacing:.01em; text-transform:uppercase; line-height:1; color:var(--c-ink);
}
.r365c-sub{ display:block; margin-top:6px; font:500 12px 'IBM Plex Mono',ui-monospace,monospace; color:var(--c-muted); letter-spacing:.06em; text-transform:uppercase; }
.r365c-close{
  width:42px; height:42px; border-radius:50%; border:1px solid var(--c-line); background:#fff;
  display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--c-ink); flex:0 0 auto;
}
.r365c-close:hover{ border-color:var(--c-ink); }
.r365c-close svg{ width:20px; height:20px; }

.r365c-list{ flex:1; overflow-y:auto; padding:14px 16px; display:flex; flex-direction:column; gap:10px; -webkit-overflow-scrolling:touch; }

.r365c-item{
  position:relative; display:grid; grid-template-columns:76px minmax(0,1fr); gap:12px;
  background:#fff; border:1px solid var(--c-line); border-radius:16px; padding:10px 40px 10px 10px;
}
.r365c-img{ display:block; width:76px; height:76px; border-radius:12px; overflow:hidden; background:var(--c-paper2); }
.r365c-img img{ width:100%; height:100%; object-fit:cover; display:block; }
.r365c-info{ min-width:0; display:flex; flex-direction:column; }
.r365c-name{
  font-weight:700; font-size:14px; line-height:1.25; color:var(--c-ink); text-decoration:none;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}
.r365c-name:hover{ color:var(--c-red); }
.r365c-unit{ font-size:12px; color:var(--c-muted); margin-top:3px; }
.r365c-row{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-top:auto; padding-top:8px; }
.r365c-qty{ display:inline-flex; align-items:center; border:1px solid var(--c-line); border-radius:999px; background:var(--c-paper); }
.r365c-qty button{
  width:32px; height:32px; border:0; background:transparent; cursor:pointer;
  font-size:18px; font-weight:700; color:var(--c-ink); border-radius:50%; line-height:1;
}
.r365c-qty button:hover:not(:disabled){ background:var(--c-paper2); }
.r365c-qty button:disabled{ opacity:.35; cursor:not-allowed; }
.r365c-qty span{ min-width:24px; text-align:center; font-weight:800; font-size:14px; }
.r365c-line{ font-size:15px; font-weight:800; white-space:nowrap; }
.r365c-del{
  position:absolute; top:8px; right:8px; width:30px; height:30px; border:0; border-radius:50%;
  background:transparent; color:var(--c-muted); cursor:pointer; display:flex; align-items:center; justify-content:center;
}
.r365c-del:hover{ background:#FDECEF; color:var(--c-red); }
.r365c-del svg{ width:17px; height:17px; }

.r365c-empty{ margin:auto; text-align:center; padding:30px 20px; }
.r365c-empty-ico{ width:84px; height:84px; margin:0 auto 14px; border-radius:50%; background:#fff; border:1px dashed rgba(18,16,20,.2); display:flex; align-items:center; justify-content:center; color:var(--c-muted); }
.r365c-empty-ico svg{ width:36px; height:36px; }
.r365c-empty p{ margin:0 0 4px; font-weight:800; font-size:17px; }
.r365c-empty small{ display:block; color:var(--c-muted); font-size:13px; margin-bottom:18px; }

.r365c-foot{ padding:16px 18px calc(16px + env(safe-area-inset-bottom)); background:#fff; border-top:1px solid var(--c-line); }
.r365c-foot[hidden]{ display:none; }
.r365c-total{ display:flex; justify-content:space-between; align-items:baseline; font-size:15px; font-weight:600; }
.r365c-total strong{ font-size:24px; font-weight:900; letter-spacing:-.01em; }
.r365c-note{ margin:4px 0 14px; font-size:12px; color:var(--c-muted); }

.r365c-btn{
  display:flex; align-items:center; justify-content:center; gap:8px; width:100%;
  min-height:50px; padding:0 18px; border-radius:14px; border:0; cursor:pointer;
  font:700 15px 'Inter',system-ui,sans-serif; text-decoration:none !important;
  transition:background .2s ease, transform .15s ease;
}
.r365c-btn:active{ transform:scale(.98); }
.r365c-btn-dark{ background:var(--c-ink); color:#fff !important; }
.r365c-btn-dark:hover{ background:var(--c-red); }
.r365c-empty .r365c-btn{ width:auto; display:inline-flex; min-height:44px; }
.r365c-btn-wa{ margin-top:8px; background:#E9F9EF; color:var(--c-wa) !important; }
.r365c-btn-wa svg{ width:20px; height:20px; }
.r365c-btn-wa:hover{ background:var(--c-wa); color:#fff !important; }
.r365c-links{ display:flex; justify-content:space-between; margin-top:10px; }
.r365c-links button{ border:0; background:none; cursor:pointer; font:600 13px 'Inter',system-ui,sans-serif; color:var(--c-ink2); padding:6px 2px; text-decoration:underline; text-underline-offset:3px; }
.r365c-links button:hover{ color:var(--c-red); }

/* ---------- Aviso "agregado" ---------- */
.r365c-toast{
  position:fixed; left:50%; bottom:24px; z-index:100004;
  transform:translate(-50%, 140%); opacity:0;
  display:flex; align-items:center; gap:12px; max-width:calc(100% - 32px);
  background:var(--c-ink); color:#fff; padding:10px 10px 10px 18px; border-radius:14px;
  font:600 14px 'Inter',system-ui,sans-serif; box-shadow:0 16px 40px -12px rgba(18,16,20,.6);
  transition:transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s;
}
.r365c-toast span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.r365c-toast.is-show{ transform:translate(-50%,0); opacity:1; }
.r365c-toast.is-error{ background:var(--c-red); padding-right:18px; }
.r365c-toast button{
  flex:0 0 auto; border:0; border-radius:10px; background:var(--c-lime); color:#000; cursor:pointer;
  font:800 13px 'Inter',system-ui,sans-serif; padding:9px 12px;
}
@media (max-width:768px){ body:has(.mobile-sticky-buy-bar) .r365c-toast{ bottom:164px; } }

/* ============================================================
   BOTONES "AGREGAR AL CARRO"
   ============================================================ */
/* Tarjeta de producto: [Agregar] [Comprar] */
.r365-buy-row{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:8px; width:100%; }
.btn-cart-sm{
  display:flex; align-items:center; justify-content:center; gap:6px; width:100%;
  min-height:46px; padding:0 10px; margin:0; border-radius:14px; cursor:pointer;
  background:var(--c-lime); color:#000; border:0;
  font:700 14.5px 'Inter',system-ui,sans-serif; white-space:nowrap; line-height:1;
  transition:background .2s ease, transform .15s ease;
}
.btn-cart-sm .btn-ico{ width:18px; height:18px; flex:0 0 auto; }
.btn-cart-sm:hover{ background:#B8E600; }
.btn-cart-sm:active{ transform:scale(.97); }
.btn-cart-sm.is-added, .btn-cart-page.is-added, .msb-btn-cart.is-added{ background:var(--c-wa) !important; color:#fff !important; }
body.r365t .r365-buy-row .btn-flow-sm{ padding:0 10px !important; }
@media (max-width:640px){
  .r365-buy-row{ gap:6px; grid-column:1 / -1; }
  .btn-cart-sm{ min-height:38px; font-size:12.5px; border-radius:11px; padding:0 6px; gap:4px; }
  .btn-cart-sm .btn-ico{ width:16px; height:16px; }
  body.r365t .r365-buy-row .btn-flow-sm{ padding:0 6px !important; gap:4px !important; }
  body.r365t .r365-buy-row .btn-flow-sm .btn-ico{ width:16px; height:16px; }
}
@media (max-width:640px){
  /* Tarjetas chicas (2 columnas): carro como ícono + "Comprar" */
  .product-card:not(.is-featured) .r365-buy-row{ grid-template-columns:40px minmax(0,1fr); }
  .product-card:not(.is-featured) .btn-cart-sm{ padding:0 !important; }
  .product-card:not(.is-featured) .btn-cart-sm .btn-txt{ display:none; }
  .product-card:not(.is-featured) .btn-cart-sm .btn-ico{ display:block !important; width:19px; height:19px; }
  body.r365t .product-card:not(.is-featured) .r365-buy-row .btn-flow-sm .btn-ico{ display:none !important; }
  body.r365t .product-card:not(.is-featured) .r365-buy-row .btn-flow-sm{ padding:0 4px !important; }
  body.r365t .product-card.is-featured .btn-detalles-sm{ grid-column:1 / -1; }
  body.r365t .product-card.is-featured .btn-cart-sm{ min-height:48px; font-size:15px; border-radius:14px; }
}
@media (max-width:380px){
  .product-card.is-featured .btn-cart-sm .btn-ico, body.r365t .product-card.is-featured .r365-buy-row .btn-flow-sm .btn-ico{ display:none; }
}

/* Ficha de producto */
.btn-cart-page{
  display:flex; align-items:center; justify-content:center; gap:10px; width:100%;
  padding:16px 24px; border-radius:50px; border:0; cursor:pointer;
  background:var(--c-lime); color:#000; font:800 16px 'Inter',system-ui,sans-serif;
  transition:transform .2s ease, background .2s ease;
}
.btn-cart-page svg{ width:22px; height:22px; }
.btn-cart-page:hover{ transform:translateY(-2px); background:#B8E600; }
body.r365t .btn-cart-page{ border-radius:14px; }

/* Barra fija de compra (móvil) */
.msb-btn-cart{
  width:44px; height:44px; border-radius:14px; border:0; cursor:pointer; flex-shrink:0;
  background:var(--c-lime); color:#000; display:flex; align-items:center; justify-content:center;
}
.msb-btn-cart svg{ width:22px; height:22px; }

@media (prefers-reduced-motion:reduce){
  .r365c-drawer, .r365c-overlay, .r365c-toast, .r365c-fab, .r365c-badge{ transition:none !important; animation:none !important; }
}
