/* ══════════════════════════════════════════════════════════════════
   CONTADOR DE VISITAS — ODÓMETRO MECÁNICO PREMIUM
   Emulación realista de un cuentakilómetros analógico
   ══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&family=Poppins:wght@400;600;700&display=swap');

/* ── VARIABLES ─────────────────────────────────────────────────── */
:root {
  --odo-drum-w: 52px;
  --odo-drum-h: 72px;
  --odo-font: 'Oswald', 'Segoe UI', sans-serif;
  --odo-digit-size: 2.8rem;
  --odo-housing-bg: #0d0d0f;
  --odo-drum-bg: linear-gradient(
    180deg,
    #3a3a3e 0%, #2a2a2e 8%, #1a1a1e 20%,
    #141416 40%, #141416 60%,
    #1a1a1e 80%, #2a2a2e 92%, #3a3a3e 100%
  );
  --odo-sep-color: linear-gradient(
    180deg, #888 0%, #ccc 30%, #fff 50%, #ccc 70%, #888 100%
  );
  --odo-digit-static: linear-gradient(
    180deg, #e8e8ee 0%, #ffffff 35%, #f0f0f0 65%, #c8c8d0 100%
  );
  --odo-digit-rolling: linear-gradient(
    180deg, #ff2200 0%, #ff5500 30%, #ff8800 60%, #ffaa00 100%
  );
  --odo-shadow-deep: 
    0 8px 30px rgba(0,0,0,.7),
    0 2px 8px rgba(0,0,0,.5),
    inset 0 1px 0 rgba(255,255,255,.06);
  --odo-notch-shadow:
    radial-gradient(ellipse at 50% 0%, rgba(80,80,90,.5) 0%, transparent 70%);
}

/* ── CONTENEDOR PRINCIPAL ─────────────────────────────────────── */
.odometer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 30px auto;
  max-width: 100%;
  user-select: none;
}

/* ── HOUSING (carcasa negra del odómetro) ─────────────────────── */
.odometer-housing {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--odo-housing-bg);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: var(--odo-shadow-deep);
  border: 1.5px solid #2a2a2e;
  overflow: hidden;
}

/* Reflejos sutiles en la carcasa */
.odometer-housing::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(
    175deg,
    rgba(255,255,255,.04) 0%,
    transparent 40%,
    transparent 60%,
    rgba(255,255,255,.02) 100%
  );
  pointer-events: none;
  z-index: 5;
}

/* Borde interior metálico */
.odometer-housing::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 12px;
  border: 1px solid rgba(60,60,68,.6);
  pointer-events: none;
  z-index: 5;
}

/* ── TIRA DE DÍGITOS ──────────────────────────────────────────── */
.odometer-digits {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
  z-index: 2;
}

/* ── TAMBOR INDIVIDUAL ────────────────────────────────────────── */
.odo-drum {
  position: relative;
  width: var(--odo-drum-w);
  height: var(--odo-drum-h);
  background: var(--odo-drum-bg);
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    inset 0 3px 8px rgba(0,0,0,.6),
    inset 0 -3px 8px rgba(0,0,0,.5),
    0 0 1px rgba(255,255,255,.08);
}

/* Ranura de lectura (la franja transparente central) */
.odo-drum::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 16px;
  background: var(--odo-notch-shadow);
  z-index: 4;
  pointer-events: none;
}
.odo-drum::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 16px;
  background: radial-gradient(ellipse at 50% 100%, rgba(80,80,90,.5) 0%, transparent 70%);
  z-index: 4;
  pointer-events: none;
}

/* ── Muesca de engranaje superior (la "pestaña" semicircular) ── */
.odo-notch {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 8px;
  background: radial-gradient(ellipse at 50% 0%, #555 0%, #333 100%);
  border-radius: 0 0 8px 8px;
  z-index: 5;
  box-shadow: 0 2px 4px rgba(0,0,0,.5);
}

/* ── SEPARADOR METÁLICO ───────────────────────────────────────── */
.odo-sep {
  width: 2.5px;
  height: calc(var(--odo-drum-h) + 4px);
  background: var(--odo-sep-color);
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow:
    -1px 0 2px rgba(0,0,0,.4),
    1px 0 2px rgba(0,0,0,.4),
    0 0 4px rgba(200,200,220,.15);
  position: relative;
  z-index: 3;
}

/* ── CONTENEDOR DE DÍGITOS ROLLING ────────────────────────────── */
.odo-roll {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
  will-change: transform;
  z-index: 2;
}

.odo-roll-instant {
  transition: none !important;
}

/* ── DÍGITO INDIVIDUAL (dentro del tambor) ────────────────────── */
.odo-digit {
  width: var(--odo-drum-w);
  height: var(--odo-drum-h);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--odo-font);
  font-size: var(--odo-digit-size);
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  -webkit-font-smoothing: antialiased;
}

/* Dígito estático (blancos plateados) */
.odo-drum--static .odo-digit {
  background: var(--odo-digit-static);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.6))
          drop-shadow(0 0 3px rgba(255,255,255,.1));
}

/* Dígito rolling (degradado rojo-naranja) */
.odo-drum--rolling .odo-digit {
  background: var(--odo-digit-rolling);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 6px rgba(255,60,0,.4))
          drop-shadow(0 1px 2px rgba(0,0,0,.7));
}

/* ── ANIMACIÓN DE ROLLING ─────────────────────────────────────── */
@keyframes rollFlicker {
  0%   { filter: drop-shadow(0 0 6px rgba(255,60,0,.4)) drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
  50%  { filter: drop-shadow(0 0 10px rgba(255,100,0,.6)) drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
  100% { filter: drop-shadow(0 0 6px rgba(255,60,0,.4)) drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
}

.odo-drum--rolling .odo-roll {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.odo-drum--rolling .odo-digit {
  animation: rollFlicker 1.5s ease-in-out infinite;
}

/* Cuando el tambor está en transición de rolling */
.odo-drum--animating .odo-roll {
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ── EFECTO DE PROFUNDIDAD EN EL TAMBOR ───────────────────────── */
.odo-drum-depth {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: 4px;
  background:
    linear-gradient(180deg,
      rgba(0,0,0,.35) 0%,
      rgba(0,0,0,.08) 15%,
      transparent 30%,
      transparent 70%,
      rgba(0,0,0,.08) 85%,
      rgba(0,0,0,.35) 100%
    );
}

/* ── PUNTO DE MILLARES ────────────────────────────────────────── */
.odo-dot {
  width: 8px;
  height: var(--odo-drum-h);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
}
.odo-dot::after {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, #ddd, #888);
  box-shadow: 0 1px 3px rgba(0,0,0,.5), 0 0 2px rgba(255,255,255,.1);
}

/* ── LABEL ────────────────────────────────────────────────────── */
.odometer-label {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: #888;
  text-align: center;
  margin-top: 2px;
}

/* ── INDICADOR LIVE ───────────────────────────────────────────── */
.odometer-live {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: #5a5a60;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.odometer-live-dot {
  width: 6px;
  height: 6px;
  background: #00cc44;
  border-radius: 50%;
  animation: liveBlink 1.4s ease-in-out infinite;
  box-shadow: 0 0 4px rgba(0,204,68,.5);
}
@keyframes liveBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .3; transform: scale(.85); }
}

/* ── CONTENEDOR WRAPPER (compatibilidad con HTML existente) ──── */
.contador-visitas-container,
.contador-global-container {
  position: relative;
  margin: 30px auto;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: default;
  user-select: none;
}

/* ── ANIMACIÓN DE ENTRADA ─────────────────────────────────────── */
@keyframes odometerReveal {
  0% {
    opacity: 0;
    transform: scale(.92) translateY(15px);
    filter: blur(4px);
  }
  60% {
    opacity: 1;
    filter: blur(0);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

.odometer-container {
  animation: odometerReveal .8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root {
    --odo-drum-w: 40px;
    --odo-drum-h: 56px;
    --odo-digit-size: 2.1rem;
  }

  .odometer-housing {
    padding: 8px 10px;
    border-radius: 11px;
  }

  .odo-notch {
    width: 12px;
    height: 6px;
  }

  .odo-dot::after {
    width: 4px;
    height: 4px;
  }

  .odometer-label {
    font-size: 9px;
    letter-spacing: 2px;
  }
}

@media (max-width: 400px) {
  :root {
    --odo-drum-w: 34px;
    --odo-drum-h: 48px;
    --odo-digit-size: 1.7rem;
  }

  .odometer-housing {
    padding: 6px 8px;
    border-radius: 9px;
  }

  .odo-sep {
    width: 2px;
  }

  .odo-dot {
    width: 6px;
  }
  .odo-dot::after {
    width: 3px;
    height: 3px;
  }
}

/* ── ACCESIBILIDAD: respeta prefers-reduced-motion ────────────── */
@media (prefers-reduced-motion: reduce) {
  .odo-roll,
  .odo-drum--rolling .odo-roll {
    transition: none !important;
  }
  .odo-drum--rolling .odo-digit {
    animation: none;
  }
  .odometer-live-dot {
    animation: none;
    opacity: 1;
  }
  .odometer-container {
    animation: none;
    opacity: 1;
  }
}
/* Centrar el #visit-count */
#visit-count { display: flex; justify-content: center; align-items: center; width: 100%; padding: 15px 0; }
