
.cv-counter,
.cv-counter * ,
.cv-counter *::before,
.cv-counter *::after {
  box-sizing: border-box !important;
}

.cv-counter {
  --cv-title-color: #ffffff;
  --cv-text-color: #ffffff;
  --cv-bg-image: none;
  --cv-header-bg: #8b1116;
  --cv-button-bg: rgba(255,255,255,0.14);
  --cv-button-text: #ffffff;
  --cv-bar-start: #ffffff;
  --cv-bar-end: #e95c5f;
  --cv-bubble-bg: #16243d;
  --cv-bubble-icon: #ffffff;
  display: block !important;
  visibility: visible !important;
  opacity: 1;
  position: relative;
  width: 260px;
  max-width: calc(100vw - 24px);
  min-width: 220px;
  font-family: Arial, Helvetica, sans-serif !important;
  color: var(--cv-text-color) !important;
  border: 0 !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  background: linear-gradient(180deg, rgba(8, 14, 27, 0.96), rgba(15, 22, 39, 0.94)) !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2147483000 !important;
  transition: width .2s ease, border-radius .2s ease, background-color .2s ease !important;
}

.cv-counter-fixed {
  position: fixed !important;
  left: 18px !important;
  right: auto !important;
  bottom: 18px !important;
  top: auto !important;
  margin: 0 !important;
  animation: cvFadeLeft 0.5s ease both !important;
}

.cv-left-bottom {
  left: 18px !important;
  right: auto !important;
  bottom: 18px !important;
}

.cv-right-bottom {
  right: 18px !important;
  left: auto !important;
  bottom: 18px !important;
  animation-name: cvFadeRight !important;
}

.cv-counter__bg {
  position: absolute !important;
  inset: 0 !important;
  background-image: var(--cv-bg-image) !important;
  background-size: cover !important;
  background-position: center !important;
  opacity: 0.14 !important;
  pointer-events: none !important;
}

.cv-counter__inner {
  position: relative !important;
  z-index: 1 !important;
  padding: 0 !important;
}

.cv-counter__header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 14px 14px 12px !important;
  background: var(--cv-header-bg) !important;
  border-bottom: 1px solid rgba(255,255,255,0.08) !important;
}

.cv-counter__title {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
  color: var(--cv-title-color) !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.cv-counter__body {
  display: block;
  margin: 0 !important;
  padding: 14px !important;
}

.cv-counter__stats {
  display: grid !important;
  gap: 10px !important;
}

.cv-counter__stats p {
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  font-size: 14px !important;
  line-height: 1.3 !important;
  color: var(--cv-text-color) !important;
}

.cv-counter__stats span {
  margin: 0 !important;
  padding: 0 !important;
  color: var(--cv-text-color) !important;
  opacity: 0.92 !important;
}

.cv-counter__stats strong {
  margin: 0 !important;
  padding: 0 !important;
  color: var(--cv-text-color) !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

.cv-counter__chart {
  display: block !important;
  margin-top: 12px !important;
  padding-top: 12px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.10) !important;
}

.cv-counter__bars {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
  align-items: end !important;
  gap: 6px !important;
  height: 84px !important;
}

.cv-counter__bar-col {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 5px !important;
  min-width: 0 !important;
  height: 100% !important;
}

.cv-counter__bar {
  display: block !important;
  width: 100% !important;
  min-height: 10px !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, var(--cv-bar-start), var(--cv-bar-end)) !important;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.18) !important;
}

.cv-counter__bar-label {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--cv-text-color) !important;
  font-size: 10px !important;
  line-height: 1 !important;
  opacity: 0.85 !important;
}

/* ----------------------------------------------------------------------
   Burbuja / botón de minimizar-expandir.
   Mismo botón se reutiliza en escritorio y móvil: cuando el contador NO
   tiene la clase .is-bubble-expanded, solo se ve este círculo. Al hacer
   clic se añade/quita la clase y se muestra/oculta el panel completo.
   ---------------------------------------------------------------------- */

.cv-counter__bubble {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  outline: none !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: var(--cv-bubble-bg) !important;
  color: var(--cv-bubble-icon) !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28) !important;
  transition: transform .2s ease, background-color .2s ease !important;
}

.cv-counter__bubble:hover,
.cv-counter__bubble:focus {
  filter: brightness(1.12) !important;
  transform: scale(1.06) !important;
}

.cv-counter__bubble-icon {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  pointer-events: none !important;
}

/* Animación "bounce" periódica para llamar la atención sobre el ícono cuando
   el panel está colapsado. Se aplica solo cuando el contador NO está
   expandido (ver JS: se agrega/quita la clase .cv-bubble-bounce cada 5s). */
.cv-counter:not(.is-bubble-expanded) .cv-counter__bubble.cv-bubble-bounce {
  animation: cvBubbleBounce 0.6s ease !important;
}

@keyframes cvBubbleBounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.22) translateY(-3px); }
  55%  { transform: scale(0.92) translateY(1px); }
  75%  { transform: scale(1.06) translateY(-1px); }
  100% { transform: scale(1); }
}

/* ----------------------------------------------------------------------
   Estado colapsado (sin .is-bubble-expanded): solo el círculo es visible,
   el resto del panel (header + body) se oculta y el contenedor se reduce
   a un círculo flotante. Esto aplica tanto en escritorio como en móvil.
   ---------------------------------------------------------------------- */

.cv-counter:not(.is-bubble-expanded) {
  width: 48px !important;
  min-width: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 0 !important;
  border-radius: 50% !important;
  overflow: visible !important;
}

.cv-counter:not(.is-bubble-expanded) .cv-counter__bg,
.cv-counter:not(.is-bubble-expanded) .cv-counter__inner {
  display: none !important;
}

.cv-counter:not(.is-bubble-expanded) .cv-counter__bubble {
  width: 48px !important;
  height: 48px !important;
}

.cv-counter:not(.is-bubble-expanded) .cv-counter__bubble-icon {
  width: 22px !important;
  height: 22px !important;
}

/* ----------------------------------------------------------------------
   Estado expandido (.is-bubble-expanded): panel completo visible. En
   escritorio este es el estado por defecto al cargar la página. La
   burbuja se reubica dentro del header como botón de "minimizar".
   ---------------------------------------------------------------------- */

.cv-counter.is-bubble-expanded {
  width: 260px;
  animation: cvBubblePop 0.18s ease both !important;
}

.cv-counter.is-bubble-expanded .cv-counter__bubble {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  z-index: 3 !important;
}

.cv-counter.is-bubble-expanded .cv-counter__header {
  padding-right: 48px !important;
}

@keyframes cvFadeLeft {
  from {
    opacity: 0;
    transform: translate3d(-16px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes cvFadeRight {
  from {
    opacity: 0;
    transform: translate3d(16px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes cvBubblePop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ========================================================================
   MÓVIL (<768px): tarjeta expandida achatada, con un ancho fijo compacto
   calibrado al header (texto + ícono) y barras horizontales en vez de
   columnas verticales, para minimizar la altura total del widget.
   ======================================================================== */

@media (max-width: 767px) {
  .cv-counter.is-bubble-expanded {
    width: 148px !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    border-radius: 14px !important;
    background: linear-gradient(180deg, rgba(8, 14, 27, 0.62), rgba(15, 22, 39, 0.58)) !important;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    backdrop-filter: blur(14px) !important;
  }

  .cv-counter-fixed,
  .cv-left-bottom {
    left: 12px !important;
    bottom: 12px !important;
  }

  .cv-right-bottom {
    right: 12px !important;
    bottom: 12px !important;
  }

  .cv-counter.is-bubble-expanded .cv-counter__header {
    padding: 7px 34px 7px 10px !important;
    background: var(--cv-header-bg) !important;
    background: color-mix(in srgb, var(--cv-header-bg) 70%, transparent) !important;
  }

  .cv-counter.is-bubble-expanded .cv-counter__title {
    font-size: 10.5px !important;
    letter-spacing: 0.02em !important;
  }

  .cv-counter.is-bubble-expanded .cv-counter__bubble {
    top: 6px !important;
    right: 6px !important;
    width: 22px !important;
    height: 22px !important;
  }

  .cv-counter.is-bubble-expanded .cv-counter__bubble-icon {
    width: 12px !important;
    height: 12px !important;
  }

  .cv-counter.is-bubble-expanded .cv-counter__body {
    padding: 7px 10px 8px !important;
  }

  .cv-counter.is-bubble-expanded .cv-counter__stats {
    gap: 2px !important;
  }

  .cv-counter.is-bubble-expanded .cv-counter__stats p {
    font-size: 11.5px !important;
    gap: 8px !important;
  }

  .cv-counter.is-bubble-expanded .cv-counter__stats strong {
    font-size: 13px !important;
  }

  .cv-counter.is-bubble-expanded .cv-counter__chart {
    margin-top: 5px !important;
    padding-top: 5px !important;
  }

  /* ---- Barras horizontales compactas (solo en la tarjeta móvil) ----
     Cada día es una fila [etiqueta | barra | valor]. Esto reduce mucho la
     altura total frente a las columnas verticales que se usan en escritorio,
     que es justo lo que se busca: un widget más achatado en el teléfono. */
  .cv-counter__bars--horizontal {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    height: auto !important;
    width: 100% !important;
  }

  .cv-counter__hbar-row {
    display: grid !important;
    grid-template-columns: 22px 1fr 20px !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .cv-counter__hbar-label {
    font-size: 9.5px !important;
    line-height: 1 !important;
    color: var(--cv-text-color) !important;
    opacity: 0.85 !important;
    text-align: right !important;
  }

  .cv-counter__hbar-track {
    display: block !important;
    width: 100% !important;
    height: 6px !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, 0.12) !important;
    overflow: hidden !important;
  }

  .cv-counter__hbar-fill {
    display: block !important;
    height: 100% !important;
    border-radius: 999px !important;
    background: linear-gradient(90deg, var(--cv-bar-start), var(--cv-bar-end)) !important;
  }

  .cv-counter__hbar-value {
    font-size: 10.5px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: var(--cv-text-color) !important;
    text-align: right !important;
  }
}
