/* =========================
   ROOT VARIABLES
========================= */

:root {
  --counter-bg: #ffffff;
  --counter-text: #0f172a;
  --counter-muted: #667085;
  --counter-accent: #2563eb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --counter-bg: #111827;
    --counter-text: #e5e7eb;
    --counter-muted: #9ca3af;
    --counter-accent: #38bdf8;
  }
}

.gradient-blue .counter,
.gradient-purple .counter,
.gradient-sunset .counter,
.gradient-green .counter {
  color: #fff;
}

.gradient-blue .counter-label,
.gradient-purple .counter-label,
.gradient-sunset .counter-label,
.gradient-green .counter-label {
  color: rgba(255,255,255,0.9);
}

.counter-top-content {
  margin-bottom: 28px;
}

.counter-top-content h2 {
  margin-bottom: 10px;
}

.counter-top-content p {
  color: #667085;
}

/* =========================
   PREVIEW WRAPPER (ADMIN)
========================= */

#counter-preview-wrapper {
  background: #f9fafb;
  padding: 20px;
  border-radius: 8px;
}

#counter-preview .counter-item {
  transform: scale(.92);
}

/* =========================
   GRID LAYOUT (FRONT + PREVIEW)
========================= */

.animated-counters,
#counter-preview .animated-counters {
  display: grid;
  gap: 24px;
  align-items: stretch;
}

/* equal height tiles */
.counter-item,
#counter-preview .counter-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 18px;
  border-radius: 10px;
  /* background: var(--counter-bg); */
  color: var(--counter-text);
}

/* =========================
   TYPOGRAPHY
========================= */

.counter,
#counter-preview .counter {
  font-size: 42px;
  font-weight: 700;
  line-height: 1.1;
}

.counter-label,
#counter-preview .counter-label {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 600;
}

/* =========================
   ICON SUPPORT
========================= */

.counter-icon,
#counter-preview .counter-icon {
  font-size: 32px;
  margin-bottom: 12px;
  /* color: var(--counter-accent); */
}

/* =========================
   COLUMN LAYOUTS
========================= */

.columns-2 { grid-template-columns: repeat(2, 1fr); }
.columns-3 { grid-template-columns: repeat(3, 1fr); }
.columns-4 { grid-template-columns: repeat(4, 1fr); }

/* auto layout */
.columns-auto:has(.counter-item:nth-child(2)):not(:has(.counter-item:nth-child(3))) {
  grid-template-columns: repeat(2, 1fr);
}
.columns-auto:has(.counter-item:nth-child(3)):not(:has(.counter-item:nth-child(4))) {
  grid-template-columns: repeat(3, 1fr);
}
.columns-auto:has(.counter-item:nth-child(4)) {
  grid-template-columns: repeat(4, 1fr);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1024px) {
  .animated-counters {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 600px) {
  .animated-counters {
    grid-template-columns: 1fr !important;
  }
}

/* =========================
   STYLE PRESETS
========================= */

/* CARD */
.style-card .counter-item {
  box-shadow: 0 10px 25px rgba(0,0,0,0.08);
  transition: transform .2s ease, box-shadow .2s ease;
}

.style-card .counter-item:hover {
  transform: translateY(-4px);
  box-shadow:
    0 0 20px rgba(56,189,248,0.35),
    0 12px 30px rgba(0,0,0,0.15);
}

/* BORDERED */
.style-bordered .counter-item {
  border: 2px solid #e4e7ec;
  background: var(--counter-bg);
}

/* MINIMAL */
.style-minimal .counter-item {
  background: transparent;
  border: none;
  box-shadow: none;
}

/* =========================
   GRADIENT STYLES
========================= */

.gradient-blue .counter-item {
  background: linear-gradient(135deg,#0ea5e9,#2563eb);
  color: #fff;
}

.gradient-purple .counter-item {
  background: linear-gradient(135deg,#7c3aed,#a855f7);
  color: #fff;
}

.gradient-sunset .counter-item {
  background: linear-gradient(135deg,#f97316,#ef4444);
  color: #fff;
}

.gradient-green .counter-item {
  background: linear-gradient(135deg,#10b981,#059669);
  color: #fff;
}

/* =========================
   HOVER GLOW EFFECT
========================= */

.counter-item {
  position: relative;
  overflow: hidden;
}

.counter-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center,
              rgba(255,255,255,0.25),
              transparent 60%);
  opacity: 0;
  transition: opacity .3s ease;
}

.counter-item:hover::after {
  opacity: 1;
}

/* =========================
   CLICKABLE TILE
========================= */

.counter-link {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  height: 100%;
  cursor: pointer;
}

/* =========================
   RIPPLE CLICK EFFECT
========================= */

.ripple-enabled .counter-link {
  position: relative;
  overflow: hidden;
}

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple-animation 600ms linear;
  background: rgba(255,255,255,0.45);
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

@media (prefers-color-scheme: dark) {
  .ripple-effect {
    background: rgba(255,255,255,0.25);
  }
}