/* Sequence 1: Main Header Bar at very top of screen (0px gap above) */
.dvc-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  z-index: 10002 !important;
}

/* Sequence 2: Counter Bar directly below Main Header Bar */
.stats-topbar-wrapper {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #311042 100%);
  color: #ffffff;
  padding: 8px 15px;
  font-size: 13.5px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  position: fixed !important;
  left: 0 !important;
  width: 100% !important;
  z-index: 10001 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  animation: fadeInDown 0.4s ease;
}

/* Zero padding on body so header starts cleanly at absolute top of window */
body,
body.has-stats-topbar {
  padding-top: 0 !important;
}

/* Adjust hero section padding when topbar is active */
body.has-stats-topbar #home.dvc-hero,
body.has-stats-topbar .dvc-hero {
  padding-top: 132px !important;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}

.stats-topbar-content {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0 auto;
}

.stats-topbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #e2e8f0;
}

.stats-topbar-item strong {
  color: #fbbf24;
  font-weight: 700;
  font-size: 14px;
}

.stats-topbar-item i {
  color: #38bdf8;
}

.stats-topbar-reopen-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stats-topbar-reopen-btn:hover {
  background: #6d28d9;
  border-color: #8b5cf6;
  color: #ffffff;
}

/* Modal Overlay */
.stats-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.stats-modal-card {
  background: #0f172a;
  background: linear-gradient(145deg, #1e1b4b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  padding: 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px rgba(124, 58, 237, 0.2);
  color: #ffffff;
  position: relative;
  transform: scale(0.9) translateY(20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stats-modal-overlay.active .stats-modal-card {
  transform: scale(1) translateY(0);
}

.stats-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff !important;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.stats-modal-close:hover {
  background: rgba(239, 68, 68, 0.9);
  border-color: #ef4444;
  color: #ffffff !important;
  transform: rotate(90deg) scale(1.05);
}

.stats-modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.stats-modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
  padding: 4px 14px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.stats-modal-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px 0;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stats-modal-sub {
  font-size: 13px;
  color: #94a3b8;
  margin: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stats-card-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.stats-card-box:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(168, 85, 247, 0.4);
  transform: translateY(-2px);
}

.stats-card-icon {
  font-size: 20px;
  margin-bottom: 8px;
  display: inline-block;
}

.stats-card-box.inquiry .stats-card-icon { color: #38bdf8; }
.stats-card-box.order .stats-card-icon { color: #4ade80; }
.stats-card-box.weekly .stats-card-icon { color: #fbbf24; }
.stats-card-box.monthly .stats-card-icon { color: #f472b6; }

.stats-card-value {
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  margin-bottom: 4px;
}

.stats-card-label {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-timeline-badge {
  font-size: 10px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
  display: inline-block;
  font-weight: 600;
}

.stats-modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-btn-close-sec {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.stats-btn-close-sec:hover {
  background: rgba(239, 68, 68, 0.85);
  border-color: #ef4444;
  color: #ffffff;
}

.stats-btn-close-main {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  flex-grow: 1;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
  transition: all 0.2s ease;
}

.stats-btn-close-main:hover {
  opacity: 0.95;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.6);
  transform: translateY(-1px);
}

@media (max-width: 576px) {
  .stats-modal-card {
    padding: 18px 14px 14px;
    max-height: 92vh;
    border-radius: 16px;
    width: 94%;
  }
  .stats-modal-close {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    font-size: 18px;
    background: rgba(239, 68, 68, 0.9);
    border-color: #ef4444;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
  }
  .stats-modal-header {
    margin-bottom: 12px;
  }
  .stats-modal-badge {
    font-size: 10px;
    padding: 3px 10px;
    margin-bottom: 4px;
  }
  .stats-modal-title {
    font-size: 17px;
    margin-bottom: 2px;
  }
  .stats-modal-sub {
    font-size: 11px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }
  .stats-card-box {
    padding: 10px 6px;
    border-radius: 10px;
  }
  .stats-card-icon {
    font-size: 16px;
    margin-bottom: 3px;
  }
  .stats-card-value {
    font-size: 18px;
    margin-bottom: 2px;
  }
  .stats-card-label {
    font-size: 9.5px;
    letter-spacing: 0;
  }
  .stats-timeline-badge {
    font-size: 8.5px;
    padding: 1px 5px;
    margin-top: 2px;
  }
  .stats-modal-footer {
    flex-direction: column-reverse;
    gap: 6px;
  }
  .stats-btn-close-sec,
  .stats-btn-close-main {
    width: 100%;
    justify-content: center;
    padding: 9px 12px;
    font-size: 13px;
  }
  .stats-topbar-wrapper {
    flex-direction: column;
    text-align: center;
  }
  .stats-topbar-content {
    justify-content: center;
  }
}
