/* ============================================================
   STATS.CSS - UlapPayroll Floating Widgets Section
   ============================================================ */

/* ── Root Variables (Extended for Dark Theme) ── */
:root {
  --clr-primary: #ff7704;
  --clr-primary-light: #ff9933;
  --clr-primary-dark: #e66000;
  --clr-black: #161616;
  --clr-white: #ffffff;
  --clr-bg: #0a0a0a;
  --clr-bg-dark: #050505;
  --clr-ink: #f5f5f5;
  --clr-ink-muted: #a1a1aa;
  --clr-ink-faint: #71717a;
  --clr-surface: rgba(255, 255, 255, 0.06);
  --clr-surface-2: rgba(255, 255, 255, 0.03);
  --clr-border: rgba(255, 255, 255, 0.12);
  --clr-border-glow: rgba(255, 119, 4, 0.3);
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-glow: 0 0 40px rgba(255, 119, 4, 0.15);
  --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.5);
  --ff-body: "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Stats Section Container ── */
.stats {
  position: relative;
  background: var(--clr-bg-dark);
  padding: 0 0px;
  overflow: hidden;
  margin-top: 0px;
  z-index: 10;
}

/* ── Background Grid & Particles ── */
.stats-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.6;
  pointer-events: none;
  z-index: 1;
}

.data-particle {
  position: absolute;
  background: rgba(255, 119, 4, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  animation: particleFloat 8s ease-in-out infinite;
}

@keyframes particleFloat {
  0%, 100% {
    transform: translateY(0) translateX(0);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-30px) translateX(20px);
    opacity: 0.8;
  }
}

/* ── Stats Inner Container ── */
.stats-inner {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 0px;
}

/* ── Glassmorphism Container ── */
.stats-container {
  position: relative;
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  overflow: hidden;
}

.stats-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 20% 20%,
    rgba(255, 119, 4, 0.08),
    transparent 50%
  );
  pointer-events: none;
}

/* ── Stats Header ── */
.stats-header {
  margin-bottom: 32px;
}

.stats-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--clr-primary-light);
  font-family: var(--ff-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 254, 253, 0.2);
}

.stats-badge .badge-dot {
  width: 8px;
  height: 8px;
  background: var(--clr-primary);
  border-radius: 50%;
}

.stats-badge .badge-dot.pulse {
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

/* ── Widgets Grid ── */
.widgets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* ── Widget Base ── */
.widget {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.4s var(--ease-out);
  opacity: 0;
  transform: translateY(30px);
}

.widget.visible {
  opacity: 1;
  transform: translateY(0);
}

.widget:hover {
  transform: translateY(-8px);
  border-color: var(--clr-border-glow);
  box-shadow: 0 20px 40px rgba(255, 119, 4, 0.1);
}

.widget[data-animate="float"] {
  animation: widgetFloat 6s ease-in-out infinite;
}

.widget[data-animate="float"].visible {
  animation: widgetFloat 6s ease-in-out infinite;
}

@keyframes widgetFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.widget--primary {
  --widget-accent: #ff7704;
}

.widget--secondary {
  --widget-accent: #ff9933;
}

.widget--tertiary {
  --widget-accent: #e66000;
}

/* ── Widget Header ── */
.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.widget-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 119, 4, 0.1);
  border: 1px solid rgba(255, 119, 4, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-primary-light);
}

.widget-icon--accent {
  background: rgba(255, 153, 51, 0.12);
  border-color: rgba(255, 153, 51, 0.25);
  color: #ffcc80;
}

.widget-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ff-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--clr-ink-muted);
}

.widget-status--accent {
  color: #ffcc80;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--clr-primary);
  border-radius: 50%;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 119, 4, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255, 119, 4, 0); }
}

/* ── Widget Content ── */
.widget-content {
  margin-bottom: 20px;
}

.widget-number-wrap {
  margin-bottom: 8px;
}

.widget-counter {
  font-family: var(--ff-body);
  font-size: 3rem;
  font-weight: 800;
  color: var(--clr-white);
  line-height: 1;
  letter-spacing: -0.02em;
}

.widget-counter.pulse {
  animation: numberPulse 0.5s ease-out;
}

@keyframes numberPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.widget-title {
  font-family: var(--ff-body);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--clr-white);
  margin: 0 0 6px 0;
}

.widget-desc {
  font-family: var(--ff-body);
  font-size: 0.875rem;
  color: var(--clr-ink-muted);
  margin: 0;
  line-height: 1.5;
}

/* ── Widget Chart ── */
.widget-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 60px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chart-bar {
  flex: 1;
  background: linear-gradient(to top, rgba(255, 119, 4, 0.2), rgba(255, 119, 4, 0.05));
  border-radius: 4px 4px 0 0;
  transition: all 0.3s var(--ease-out);
}

.chart-bar:hover {
  background: linear-gradient(to top, rgba(255, 119, 4, 0.4), rgba(255, 119, 4, 0.1));
}

.chart-bar--active {
  background: linear-gradient(to top, var(--clr-primary), var(--clr-primary-light));
  box-shadow: 0 0 12px rgba(255, 119, 4, 0.4);
}

/* ── Widget Logs ── */
.widget-logs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--ff-body);
  font-size: 0.75rem;
  color: var(--clr-ink-muted);
}

.log-item--new {
  color: var(--clr-primary-light);
}

.log-time {
  font-weight: 500;
}

.log-text {
  font-weight: 600;
}

/* ── Widget Progress ── */
.widget-progress {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--clr-primary), var(--clr-primary-light));
  border-radius: 9999px;
  width: 0%;
  transition: width 1.5s var(--ease-out);
}

.widget.visible .progress-fill {
  width: 90%;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--ff-body);
  font-size: 0.75rem;
  color: var(--clr-ink-muted);
}

.progress-labels span:last-child {
  color: var(--clr-primary-light);
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .widgets-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .stats {
    margin-top: -60px;
    padding-bottom: 80px;
  }

  .stats-container {
    padding: 24px;
    border-radius: 20px;
  }

  .widgets-grid {
    grid-template-columns: 1fr;
  }

  .widget-counter {
    font-size: 2.5rem;
  }
}

@media (max-width: 480px) {
  .stats {
    padding: 0 16px;
  }

  .stats-container {
    padding: 20px;
  }

  .widget-counter {
    font-size: 2rem;
  }
}
