/* Аналитика - /dashboard/analytics (тёмная космическая тема, токены big-design) */

.an-page {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-6) var(--space-6) var(--space-bottom-nav);
  font-family: var(--font-sans);
  color: var(--color-text);
}

/* ═══ Шапка с 3D иллюстрацией ═══ */

.an-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  position: relative;
  width: 100%;
}

.an-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.an-mobile-br {
  display: inline;
}

.an-header-3d-illustration {
  flex-shrink: 0;
  margin-right: -8px;
  pointer-events: none;
  filter: drop-shadow(0 10px 24px var(--p-indigo-500-a35));
  animation: an-float 4s ease-in-out infinite alternate;
}

@media (min-width: 600px) {
  .an-top-header {
    justify-content: flex-start;
    gap: 16px;
  }
  .an-mobile-br {
    display: none;
  }
  .an-header-3d-illustration {
    margin-left: 12px;
    margin-right: 0;
  }
}

@keyframes an-float {
  0% {
    transform: translateY(0px) rotate(0deg);
  }
  100% {
    transform: translateY(-5px) rotate(1deg);
  }
}

/* ═══ Скелетон ═══ */

.an-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.an-skeleton-block {
  height: 76px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--p-white-a4), var(--p-white-a8), var(--p-white-a4));
  background-size: 200% 100%;
  animation: an-shimmer 1.4s ease infinite;
}

@keyframes an-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* ═══ Секция 1: Ваша активность (2x2 Grid + Sparklines + Insight) ═══ */

.an-activity-card {
  background: var(--glass-card-bg);
  border: var(--glass-card-border);
  border-radius: var(--glass-card-radius);
  padding: 20px 20px 18px;
  margin-bottom: 20px;
  backdrop-filter: blur(var(--glass-card-blur));
  -webkit-backdrop-filter: blur(var(--glass-card-blur));
  box-shadow: var(--glass-card-shadow), var(--glass-card-inset);
  animation: an-fade 0.4s ease both;
}

.an-activity-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.an-activity-card-title {
  font-size: var(--text-17);
  font-weight: var(--fw-700);
  color: var(--p-white);
  margin: 0;
  letter-spacing: var(--tracking-tight);
}

/* LIO-419: подпись периода, а не контрол — обработчика нет, cursor и hover убраны. */
.an-period-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
  border-radius: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-13);
  font-weight: var(--fw-500);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.an-metrics-2x2-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (max-width: 480px) {
  .an-metrics-2x2-grid {
    gap: 8px;
  }
}

.an-stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  padding: 12px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
  min-width: 0;
  overflow: hidden;
}
@media (hover: hover) {
  .an-stat-box:hover {
    transform: translateY(-2px);
    border-color: rgba(168, 85, 247, 0.35);
  }
}

.an-stat-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.an-stat-icon-wrap {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.an-icon-purple {
  background: rgba(168, 85, 247, 0.15) !important;
  color: #c084fc;
}

.an-icon-blue {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8;
}

.an-icon-teal {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #22c55e;
}

.an-icon-pink {
  background: rgba(232, 121, 249, 0.15) !important;
  color: #e879f9;
}

.an-stat-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-500);
  color: var(--p-white-a65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.an-stat-value {
  font-size: var(--text-22);
  font-weight: var(--fw-800);
  color: var(--p-white);
  line-height: var(--leading-tight);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tighter);
  margin-top: 1px;
}

.an-stat-sparkline {
  width: 100%;
  height: 20px;
  margin-top: 2px;
  opacity: 0.9;
}

.an-stat-sparkline svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 2px 6px var(--color-accent-border));
}

/* ── Bottom Insight Banner ── */
.an-insight-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0;
  margin-top: 12px;
}

.an-insight-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.15) !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c084fc;
  flex-shrink: 0;
}

.an-insight-text {
  font-size: var(--text-sm);
  color: var(--p-cosmic-144-a75);
  line-height: var(--leading-base);
  margin: 0;
}

.an-insight-text strong {
  color: var(--p-white);
  font-weight: var(--fw-700);
}

/* ═══ Секция 2: Конвейер генерации (Horizontal 3-Node Track with Numbers on Top) ═══ */

.an-pipeline-card {
  background: var(--glass-card-bg);
  border: var(--glass-card-border);
  border-radius: var(--glass-card-radius);
  padding: 20px 20px 18px;
  margin-bottom: 24px;
  backdrop-filter: blur(var(--glass-card-blur));
  -webkit-backdrop-filter: blur(var(--glass-card-blur));
  box-shadow: var(--glass-card-shadow), var(--glass-card-inset);
  animation: an-fade 0.4s ease both;
}

.an-pipeline-title {
  font-size: var(--text-17);
  font-weight: var(--fw-700);
  color: var(--p-white);
  margin: 0 0 16px;
  letter-spacing: var(--tracking-tight);
}

.an-pipeline-track {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  width: 100%;
}

.an-pipeline-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  z-index: 2;
  flex: 0 0 76px;
}

.an-pipeline-val {
  font-size: var(--text-xl);
  font-weight: var(--fw-800);
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: var(--leading-tighter);
  margin-bottom: 8px;
}

.an-val-purple {
  color: var(--p-purple-200);
}

.an-val-blue {
  color: var(--p-blue-400);
}

.an-val-teal {
  color: var(--p-green-400);
}

.an-pipeline-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  flex-shrink: 0;
  border: none !important;
  box-shadow: none !important;
  transition: transform 0.2s ease;
}
@media (hover: hover) {
  .an-pipeline-col:hover .an-pipeline-icon-box {
    transform: scale(1.08);
  }
}

.an-pipe-purple {
  background: rgba(168, 85, 247, 0.15) !important;
  color: #c084fc;
}

.an-pipe-blue {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8;
}

.an-pipe-teal {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #22c55e;
}

.an-pipeline-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-500);
  color: var(--p-white-a65);
  text-align: center;
  line-height: var(--leading-tight);
  white-space: nowrap;
}

.an-pipeline-connector {
  flex: 1;
  height: 2px;
  margin-top: 54px;
  margin-left: -4px;
  margin-right: -4px;
  z-index: 1;
}

.an-line-purple-blue {
  background: linear-gradient(90deg, var(--p-purple-300) 0%, var(--p-blue-500) 100%);
  box-shadow: 0 0 8px var(--p-indigo-500-a60);
}

.an-line-blue-teal {
  background: linear-gradient(90deg, var(--p-blue-500) 0%, var(--p-green-500) 100%);
  box-shadow: 0 0 8px var(--p-blue-500-a60);
}

/* ═══ Секции ═══ */

.an-section {
  margin-bottom: var(--space-8);
  animation: an-fade 0.4s ease both;
}

@keyframes an-fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.an-section-title {
  font-size: var(--text-base);
  font-weight: var(--fw-600);
  margin: 0 0 var(--space-3);
}

.an-section-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: calc(-1 * var(--space-2)) 0 var(--space-3);
}

/* LIO-413: состояние сбора метрик — блок тянется к шапке (у неё свой отступ). */
.an-freshness {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: calc(-1 * var(--space-3)) 0 var(--space-5);
}

.an-freshness-line,
.an-freshness-warn,
.an-freshness-note {
  font-size: var(--text-sm);
  margin: 0;
}

.an-freshness-line,
.an-freshness-note {
  color: var(--color-text-muted);
}

.an-freshness-warn,
.an-section-warn {
  color: var(--color-warning-light);
}

/* ═══ Платформы (Раскрывающийся список) ═══ */

.an-platform-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.an-platform-header .an-section-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--fw-700);
  color: var(--p-white);
}

.an-help-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--fw-700);
  color: var(--p-white-a50);
  cursor: help;
}

.an-platform-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.an-platform-card {
  background: var(--glass-card-bg);
  border: var(--glass-card-border);
  border-radius: var(--glass-card-radius);
  backdrop-filter: blur(var(--glass-card-blur));
  -webkit-backdrop-filter: blur(var(--glass-card-blur));
  box-shadow: var(--glass-card-shadow), var(--glass-card-inset);
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (hover: hover) {
  .an-platform-card:hover {
    border-color: rgba(168, 85, 247, 0.35);
    box-shadow:
      0 12px 32px rgba(0, 0, 0, 0.65),
      0 0 16px rgba(124, 58, 237, 0.15),
      var(--glass-card-inset);
  }
}

.an-platform-card.open {
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.7),
    0 0 20px rgba(168, 85, 247, 0.25),
    var(--glass-card-inset);
}

.an-platform-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.an-platform-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 110px;
  flex-shrink: 0;
}

.an-platform-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--p-black-a30);
}

.an-platform-icon-circle.plat-telegram {
  background: linear-gradient(135deg, var(--p-platform-tg) 0%, var(--p-platform-tg-deep) 100%);
  color: var(--p-white);
}

.an-platform-icon-circle.plat-instagram {
  background: radial-gradient(
    circle at 30% 107%,
    var(--p-ig-sun) 0%,
    var(--p-ig-sun) 5%,
    var(--p-ig-coral) 45%,
    var(--p-ig-pink) 60%,
    var(--p-ig-blue) 90%
  );
  color: var(--p-white);
}

.an-platform-icon-circle.plat-vk {
  background: linear-gradient(135deg, var(--p-platform-vk) 0%, var(--p-platform-vk-deep) 100%);
  color: var(--p-white);
}

.an-platform-icon-circle.plat-youtube {
  background: linear-gradient(135deg, var(--p-platform-yt) 0%, var(--p-platform-yt-deep) 100%);
  color: var(--p-white);
}

.an-platform-icon-circle.plat-tiktok {
  background: var(--p-black);
  border: 1px solid var(--p-white-a15);
  color: var(--p-white);
}

.an-platform-icon-circle.plat-threads {
  background: var(--p-black);
  border: 1px solid var(--p-white-a15);
  color: var(--p-white);
}

.an-platform-icon-circle.plat-twitter {
  background: var(--p-black);
  border: 1px solid var(--p-white-a15);
  color: var(--p-white);
  font-weight: var(--fw-800);
}

.an-platform-icon-circle.plat-facebook {
  background: linear-gradient(135deg, var(--p-platform-fb) 0%, var(--p-platform-fb-deep) 100%);
  color: var(--p-white);
}

.an-platform-icon-circle.plat-pinterest {
  background: linear-gradient(135deg, var(--p-platform-pin) 0%, var(--p-platform-pin-deep) 100%);
  color: var(--p-white);
}

.an-platform-icon-circle.plat-rutube {
  background: linear-gradient(135deg, var(--p-slate-800) 0%, var(--p-slate-900) 100%);
  border: 1px solid var(--p-white-a12);
  color: var(--p-white);
}

.an-platform-name {
  font-size: var(--text-15);
  font-weight: var(--fw-700);
  color: var(--p-white);
  letter-spacing: var(--tracking-tight);
}

/* 2 Metrics in row (охват, вовлеч.) */
.an-platform-metrics {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  flex: 1;
  min-width: 0;
  margin-right: 4px;
}

@media (max-width: 380px) {
  .an-platform-metrics {
    gap: 12px;
  }
}

.an-pmetric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 44px;
}

.an-pmetric-val {
  font-size: var(--text-md);
  font-weight: var(--fw-700);
  color: var(--p-white);
  line-height: var(--leading-tight);
  font-variant-numeric: tabular-nums;
}

.an-pmetric-lbl {
  font-size: var(--text-xs);
  color: var(--p-white-a45);
  margin-top: 2px;
  line-height: var(--leading-none);
}

/* Chevron Button (чистая иконка без рамок и подложек) */
.an-platform-toggle-btn {
  width: 24px;
  height: 24px;
  border-radius: 0;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--p-white-a50);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  box-shadow: none;
  transition: color 0.2s ease;
}

@media (hover: hover) {
  .an-platform-toggle-btn:hover {
    background: transparent;
    color: var(--p-white);
  }
}

.an-platform-card.open .an-platform-toggle-btn {
  background: transparent;
  border: none;
  color: var(--p-purple-200);
}

.an-platform-chevron {
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    stroke 0.2s ease;
}

.an-platform-card.open .an-platform-chevron {
  transform: rotate(180deg);
  stroke: var(--p-purple-200);
}

/* ── Expandable Details Drawer ── */
.an-platform-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--p-black-a25);
  border-top: 1px solid transparent;
}

.an-platform-card.open .an-platform-details {
  max-height: 260px;
  border-top-color: var(--p-white-a6);
}

.an-platform-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 8px;
  padding: 14px 16px 16px;
}

.an-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.an-detail-label {
  font-size: var(--text-xs);
  color: var(--p-white-a50);
  display: flex;
  align-items: center;
  gap: 4px;
}

.an-detail-val {
  font-size: var(--text-base);
  font-weight: var(--fw-700);
  color: var(--p-white);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

/* ── Show All Button ── */
.an-show-all-btn {
  width: auto;
  padding: 8px 12px;
  margin: 12px auto 0;
  border-radius: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-13);
  font-weight: var(--fw-500);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: color 0.2s ease;
}
@media (hover: hover) {
  .an-show-all-btn:hover {
    background: transparent !important;
    border: none !important;
    color: #ffffff;
  }
}

.an-show-all-btn.expanded svg {
  transform: rotate(180deg);
}

/* ═══ Активность по дням ═══ */

.an-activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.an-activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--p-white-a70);
  font-variant-numeric: tabular-nums;
}

.an-activity-date {
  width: 42px;
  flex-shrink: 0;
  font-size: var(--text-sm);
  font-weight: var(--fw-500);
  color: var(--p-white-a50);
}

.an-activity-bar-wrap {
  flex: 1;
  max-width: 240px;
  height: 8px;
  background: var(--p-white-a8);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.an-activity-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--p-purple-600) 0%, var(--p-pink-500) 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.an-activity-meta {
  font-size: var(--text-sm);
  color: var(--p-white-a65);
  white-space: nowrap;
}

/* ═══ Лучшее время ═══ */

.an-slots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

@media (min-width: 480px) {
  .an-slots {
    grid-template-columns: repeat(3, 1fr);
  }
}

.an-slot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--glass-control-radius);
  padding: var(--space-2) var(--space-3);
}

.an-slot-day {
  font-size: var(--text-sm);
  font-weight: var(--fw-600);
  color: var(--color-text-soft);
}

.an-slot-time {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.an-slot-dot {
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
}

.an-slot-dot--0 {
  background: var(--p-purple-a35);
}

.an-slot-dot--1 {
  background: var(--color-accent-glow);
}

.an-slot-dot--2 {
  background: var(--color-accent-2);
}

/* ═══ Пустое состояние ═══ */

.an-empty {
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.an-empty-icon {
  font-size: var(--text-5xl);
  line-height: var(--leading-none);
  margin-bottom: var(--space-3);
  opacity: 0.85;
}

.an-empty-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-600);
  margin: 0 0 var(--space-2);
}

.an-empty-text {
  font-size: var(--text-md);
  color: var(--color-text-muted);
  margin: 0 auto var(--space-5);
  max-width: 320px;
  line-height: var(--leading-normal);
}

.an-empty-btn {
  display: inline-block;
  padding: 13px 24px;
  border-radius: var(--glass-cta-primary-radius);
  background: var(--glass-cta-primary-bg);
  box-shadow: var(--glass-cta-primary-shadow);
  color: #ffffff;
  font-weight: var(--fw-700);
  font-size: var(--text-md);
  text-decoration: none;
  border: none;
  transition: all 0.2s ease;
}
@media (hover: hover) {
  .an-empty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.55);
  }
}
.an-empty-btn:focus-visible {
  opacity: 0.88;
}
