/* ============================================================
   Uniclima · Header Cart Badge — small jumping circle
   Scope: .ucn-action-btn--cart (header button)
   ============================================================ */

/* Make sure the cart icon is always visible */
#ucn-header .ucn-action-btn.ucn-action-btn--cart {
  position: relative !important;
  overflow: visible !important;
  transform-origin: center 60%;
}

/* Light continuous bounce when cart has items */
@keyframes ucn-cart-bounce {
  0%,
100% { transform: translateY(0); }
  20% { transform: translateY(-3px); }
  40% { transform: translateY(0); }
  55% { transform: translateY(-1.5px); }
  70% { transform: translateY(0); }
}
#ucn-header .ucn-action-btn.ucn-action-btn--cart.has-items {
  animation: ucn-cart-bounce 2.4s ease-in-out infinite;
  animation-delay: 1s;
}
#ucn-header .ucn-action-btn.ucn-action-btn--cart.has-items:hover {
  animation-play-state: paused;
}
@media (prefers-reduced-motion: reduce) {
  #ucn-header .ucn-action-btn.ucn-action-btn--cart.has-items {
    animation: none !important;
  }
}

/* ============================================================
   USER / Mi Cuenta — pill with text label, much more visible
   ============================================================ */
#ucn-header .ucn-action-btn.ucn-action-btn--user {
  width: auto !important;
  min-width: auto !important;
  height: 42px !important;
  padding: 0 14px 0 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  background: #fff !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 999px !important;
  color: #0f172a !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: .005em !important;
  text-decoration: none !important;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease !important;
  white-space: nowrap;
}
#ucn-header .ucn-action-btn.ucn-action-btn--user::after {
  content: "Acceder";
  display: inline-block;
  line-height: 1;
}
body.logged-in #ucn-header .ucn-action-btn.ucn-action-btn--user::after,
#ucn-header .ucn-action-btn.ucn-action-btn--user.is-logged::after {
  content: "Mi cuenta";
}
#ucn-header .ucn-action-btn.ucn-action-btn--user svg.ucn-icon {
  width: 17px !important;
  height: 17px !important;
  color: #C8102E !important;
  stroke: #C8102E !important;
  stroke-width: 2.2 !important;
  flex-shrink: 0;
}
#ucn-header .ucn-action-btn.ucn-action-btn--user:hover {
  border-color: #C8102E !important;
  background: #fef2f2 !important;
  color: #C8102E !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(200,16,46,.12);
}
#ucn-header .ucn-action-btn.ucn-action-btn--user:active {
  transform: translateY(0);
}

/* Compact label on small screens */
@media (max-width: 640px) {
  #ucn-header .ucn-action-btn.ucn-action-btn--user {
    padding: 0 12px !important;
    height: 40px !important;
  }
  #ucn-header .ucn-action-btn.ucn-action-btn--user::after {
    content: "Entrar";
    font-size: 12.5px !important;
  }
  body.logged-in #ucn-header .ucn-action-btn.ucn-action-btn--user::after,
#ucn-header .ucn-action-btn.ucn-action-btn--user.is-logged::after {
    content: "Cuenta";
  }
}
@media (max-width: 380px) {
  #ucn-header .ucn-action-btn.ucn-action-btn--user::after {
    display: none !important;
  }
  #ucn-header .ucn-action-btn.ucn-action-btn--user {
    width: 40px !important;
    padding: 0 !important;
  }
}
/* Cart icon — always visible against the header bg.
 * The site forces color-scheme: light (dark-mode-defense.css), so the header
 * is always white. We use a dark icon for contrast.
 * If/when the site introduces an explicit dark theme via body.ucn-dark or
 * html[data-theme="dark"], the icon flips to white.
 * (Do NOT rely on @media prefers-color-scheme — that triggers based on the
 * user's OS even though the page forces light, producing white-on-white.) */
#ucn-header .ucn-action-btn.ucn-action-btn--cart svg.ucn-icon {
  display: block !important;
  width: 22px !important;
  height: 22px !important;
  color: #0f172a !important;
  stroke: #0f172a !important;
  stroke-width: 2 !important;
  position: relative;
  z-index: 1;
}
body.ucn-dark #ucn-header .ucn-action-btn.ucn-action-btn--cart svg.ucn-icon,
html[data-theme="dark"] #ucn-header .ucn-action-btn.ucn-action-btn--cart svg.ucn-icon {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Override any previous full-size badge — make it a small circle */
#ucn-header .ucn-action-btn--cart .ucn-cart-badge {
  position: absolute !important;
  top: -6px !important;
  right: -6px !important;
  left: auto !important;
  bottom: auto !important;
  width: auto !important;
  min-width: 20px !important;
  height: 20px !important;
  padding: 0 6px !important;
  background: #ffffff !important;
  color: #C8102E !important;
  border: 2px solid #C8102E !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  z-index: 2;
  pointer-events: none;
  transform-origin: center center;
  transition: opacity .2s ease, transform .25s cubic-bezier(.34,1.56,.64,1);
}

/* Hidden state */
#ucn-header .ucn-action-btn--cart .ucn-cart-badge.ucn-cart-badge--hidden {
  opacity: 0 !important;
  transform: scale(0) !important;
  pointer-events: none !important;
}

/* Visible state */
#ucn-header .ucn-action-btn--cart .ucn-cart-badge.is-visible {
  opacity: 1 !important;
  transform: scale(1) !important;
}

/* Bump (jump) animation — fired each time count changes */
@keyframes ucn-badge-bump {
  0% { transform: scale(1); }
  25% { transform: scale(1.4); }
  50% { transform: scale(.85); }
  75% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
#ucn-header .ucn-action-btn--cart .ucn-cart-badge.is-bump {
  animation: ucn-badge-bump .55s cubic-bezier(.34,1.56,.64,1);
}

/* Idle pulse halo — subtle red ring, breathes when count > 0 */
#ucn-header .ucn-action-btn--cart .ucn-cart-badge.is-visible::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 999px;
  border: 2px solid rgba(200,16,46,.35);
  opacity: 0;
  animation: ucn-badge-halo 2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ucn-badge-halo {
  0% { transform: scale(.85); opacity: .55; }
  60% { transform: scale(1.5);  opacity: 0; }
  100% { transform: scale(1.5);  opacity: 0; }
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  #ucn-header .ucn-action-btn--cart .ucn-cart-badge.is-bump { animation: none !important; }
  #ucn-header .ucn-action-btn--cart .ucn-cart-badge.is-visible::before { animation: none !important; opacity: 0 !important; }
}
