/* NEXA Statistics — premium analytics dashboard */

.ia-stats-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.ia-stats-modal[hidden] {
  display: none !important;
}

body.ia-stats-modal-open {
  overflow: hidden;
}

.ia-stats-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
}

.ia-stats-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  margin: 0.75rem;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ia-stats-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.72);
}

.ia-stats-modal__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.ia-stats-modal__hint {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.ia-stats-modal__close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.ia-stats-modal__close:hover {
  background: rgba(15, 23, 42, 0.1);
}

.ia-stats-modal__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.ia-stats-filters {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.2rem;
  background: rgba(15, 23, 42, 0.05);
  border-radius: 999px;
}

.ia-stats-filter {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.ia-stats-filter:hover {
  color: #0f172a;
}

.ia-stats-filter.is-active {
  background: #fff;
  color: #0e7490;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.ia-stats-updated {
  font-size: 0.75rem;
  color: #64748b;
}

.ia-stats-modal__scroll {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.25rem 1.25rem;
}

.ia-stats-loading,
.ia-stats-error {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

.ia-stats-error {
  color: #b91c1c;
}

.ia-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.ia-stats-card {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 0.9rem 0.95rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ia-stats-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}

.ia-stats-card__icon {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 0.55rem;
}

.ia-stats-card__icon--total { background: rgba(14, 165, 183, 0.12); }
.ia-stats-card__icon--completed { background: rgba(34, 197, 94, 0.12); }
.ia-stats-card__icon--cancelled { background: rgba(239, 68, 68, 0.12); }
.ia-stats-card__icon--upcoming { background: rgba(59, 130, 246, 0.12); }
.ia-stats-card__icon--rate { background: rgba(168, 85, 247, 0.12); }

.ia-stats-card__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ia-stats-card__value {
  margin-top: 0.2rem;
  font-size: 1.55rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.03em;
}

.ia-stats-card__desc {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: #94a3b8;
  line-height: 1.35;
}

.ia-stats-panels {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.ia-stats-panel {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 0.95rem 1rem 1rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.ia-stats-panel--wide {
  grid-column: 1 / -1;
}

.ia-stats-panel__title {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.ia-stats-chart {
  width: 100%;
  min-height: 180px;
}

.ia-stats-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.ia-stats-donut-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ia-stats-donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.ia-stats-donut-legend li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: #475569;
}

.ia-stats-swatch {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.ia-stats-insights {
  display: grid;
  gap: 0.55rem;
}

.ia-stats-insight {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(14, 165, 183, 0.08), rgba(14, 165, 183, 0.02));
  border: 1px solid rgba(14, 165, 183, 0.12);
  font-size: 0.8125rem;
  color: #334155;
}

.ia-stats-table-wrap {
  overflow-x: auto;
}

.ia-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.ia-stats-table th,
.ia-stats-table td {
  padding: 0.55rem 0.45rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.ia-stats-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.ia-stats-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.ia-stats-badge--completed { background: rgba(34, 197, 94, 0.12); color: #15803d; }
.ia-stats-badge--cancelled { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.ia-stats-badge--upcoming { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }

.ia-stats-bottom {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.85rem;
}

@media (max-width: 1100px) {
  .ia-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ia-stats-panels {
    grid-template-columns: 1fr;
  }
  .ia-stats-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ia-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ia-stats-modal__dialog {
    width: 100%;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
  }
}
