/* Стили страницы статистики посещений */

.site-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.site-header {
  margin-bottom: 32px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--forest);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: all 0.2s var(--ease);
}

.back-link:hover {
  background: var(--sage-soft);
  border-color: var(--sage);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s var(--ease);
}

.btn-secondary {
  background: var(--surface);
  color: var(--forest);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: var(--forest);
  color: #fff;
  border-color: var(--forest);
}

.stats-hero {
  text-align: center;
  margin-bottom: 40px;
}

.stats-title {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 600;
  color: var(--forest-deep);
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.stats-subtitle {
  font-size: 1.125rem;
  color: var(--ink-2);
  margin: 0;
}

/* Сетка карточек */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}

.stat-card-primary {
  background: linear-gradient(135deg, var(--surface) 0%, var(--sage-soft) 100%);
  border-color: var(--sage);
}

.stat-label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--forest-deep);
  line-height: 1.1;
  margin-bottom: 8px;
}

.stat-meta {
  font-size: 0.8125rem;
  color: var(--ink-3);
}

/* Состояние загрузки карточек */
.stats-grid.is-loading .stat-value {
  color: var(--ink-3);
  animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Секция с таблицей */
.stats-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
}

.section-heading {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--forest-deep);
  margin: 0 0 20px 0;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9375rem;
}

.stats-table th {
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  padding: 12px 16px;
  border-bottom: 2px solid var(--line);
}

.stats-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.stats-table tbody tr:hover td {
  background: var(--surface-2);
}

.table-loading-row td,
.table-empty-row td {
  text-align: center;
  color: var(--ink-3);
  padding: 32px;
}

.table-error-row td {
  text-align: center;
  color: var(--danger, #c2410c);
  padding: 32px;
}

/* Пояснение внизу */
.stats-footer-note {
  font-size: 0.875rem;
  color: var(--ink-3);
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .site-shell {
    padding: 16px 12px 40px;
  }
  .stats-title {
    font-size: 2.125rem;
  }
  .stats-section {
    padding: 20px 16px;
  }
}
