/* ===== ANALYTICS DASHBOARD - ZAVENTRA MUSIC GROUP ===== */
:root { --ab: #2563EB; --ab-light: rgba(37,99,235,0.08); --ab-hover: rgba(37,99,235,0.12); --ab-border: rgba(37,99,235,0.25); }

.analytics-enterprise { padding: 0; max-width: 1400px; margin: 0 auto; }

/* ===== HEADER ===== */
.analytics-header-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding: 20px 0 0; margin-bottom: 24px; }
.analytics-header-left { display: flex; align-items: center; gap: 16px; }
.analytics-header-left h2 { font: 700 22px Manrope; color: #111; margin: 0; }
.analytics-last-sync {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 12px Manrope; color: #6b7280;
  padding: 4px 12px; border-radius: 999px;
  background: #f9fafb; border: 1px solid #e5e7eb;
}
.analytics-last-sync::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #2563eb; flex-shrink: 0; }
.analytics-last-sync.disconnected::before { background: #dc2626; }
.analytics-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ===== FILTERS ===== */
.analytics-filter-select {
  height: 36px; padding: 0 12px; border: 1px solid #e5e7eb;
  border-radius: 8px; background: #fff; color: #111;
  font: 500 13px Manrope; transition: border-color 150ms; min-width: 160px;
}
.analytics-filter-select:hover { border-color: #9ca3af; }
.analytics-filter-select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.12); }
.analytics-filter-btn {
  height: 36px; padding: 0 16px; border-radius: 8px;
  font: 600 12px Manrope; cursor: pointer; transition: all 150ms;
  display: inline-flex; align-items: center; gap: 6px;
}
.analytics-filter-btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }
.analytics-filter-btn.primary { background: #2563eb; color: #fff; border: 1px solid #2563eb; }
.analytics-filter-btn.primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.analytics-filter-btn.primary.loading { background: #93c5fd; border-color: #93c5fd; pointer-events: none; }
.analytics-filter-btn.secondary { background: #fff; color: #111; border: 1px solid #e5e7eb; }
.analytics-filter-btn.secondary:hover { background: #f9fafb; border-color: #d1d5db; }
.analytics-compare-toggle { display: inline-flex; align-items: center; gap: 6px; font: 500 12px Manrope; color: #6b7280; cursor: pointer; user-select: none; }
.analytics-compare-toggle input { accent-color: #2563eb; }

/* ===== KPI CARDS ===== */
.analytics-kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 24px; }
.analytics-kpi-card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px;
  border: 1px solid #e5e7eb; border-radius: 12px; background: #fff;
  transition: border-color 150ms, box-shadow 150ms; cursor: default;
}
.analytics-kpi-card:hover { border-color: var(--ab-border); box-shadow: 0 2px 12px rgba(37,99,235,0.06); }
.analytics-kpi-card.hidden { display: none; }
.analytics-kpi-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.analytics-kpi-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center; background: var(--ab-light); flex-shrink: 0;
}
.analytics-kpi-icon svg { width: 18px; height: 18px; stroke: #2563eb; stroke-width: 1.8; fill: none; }
.analytics-kpi-trend { display: inline-flex; align-items: center; gap: 4px; font: 600 11px Manrope; white-space: nowrap; }
.analytics-kpi-trend.up { color: #2563eb; }
.analytics-kpi-trend.down { color: #dc2626; }
.analytics-kpi-trend.neutral { color: #9ca3af; font-weight: 500; }
.analytics-kpi-value { font: 800 24px/1.1 Manrope; color: #111; }
.analytics-kpi-label { font: 500 11px Manrope; color: #6b7280; margin-top: 1px; }

/* ===== REVENUE CARDS ===== */
.analytics-revenue-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.analytics-revenue-card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px;
  border: 1px solid #e5e7eb; border-radius: 12px; background: #fff;
}
.analytics-revenue-value { font: 700 20px/1.1 Manrope; color: #111; }
.analytics-revenue-label { font: 500 11px Manrope; color: #6b7280; }

/* ===== CHARTS ===== */
.analytics-chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 24px; }
.analytics-chart-card {
  border: 1px solid #e5e7eb; border-radius: 12px; background: #fff;
  overflow: hidden; display: flex; flex-direction: column;
}
.analytics-chart-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 0; min-height: 40px; }
.analytics-chart-title { font: 600 13px Manrope; color: #111; margin: 0; }
.analytics-chart-actions { display: flex; gap: 4px; }
.analytics-chart-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid #e5e7eb;
  background: #fff; color: #6b7280; cursor: pointer;
  display: grid; place-items: center; transition: all 150ms;
}
.analytics-chart-btn:hover { background: #f9fafb; color: #111; border-color: #d1d5db; }
.analytics-chart-btn svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; fill: none; }
.analytics-chart-body { padding: 12px 18px 18px; flex: 1; min-height: 240px; position: relative; }

/* ===== STATS ROW ===== */
.analytics-stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 24px; }
.analytics-stat-card {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  border: 1px solid #e5e7eb; border-radius: 10px; background: #fff;
  transition: border-color 150ms;
}
.analytics-stat-card:hover { border-color: var(--ab-border); }
.analytics-stat-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center; background: #f9fafb; flex-shrink: 0;
}
.analytics-stat-icon svg { width: 16px; height: 16px; stroke: #2563eb; stroke-width: 1.8; fill: none; }
.analytics-stat-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.analytics-stat-value { font: 700 16px/1.1 Manrope; color: #111; }
.analytics-stat-label { font: 500 10px Manrope; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== SECTION HEADERS ===== */
.analytics-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-top: 4px; }
.analytics-section-title { font: 700 16px Manrope; color: #111; margin: 0; }
.analytics-section-subtitle { font: 500 12px Manrope; color: #6b7280; }

/* ===== TOP VIDEOS TABLE ===== */
.analytics-top-table { width: 100%; border-collapse: collapse; }
.analytics-top-table th {
  text-align: left; padding: 10px 14px; font: 600 11px Manrope;
  color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid #e5e7eb; background: #f9fafb; position: sticky; top: 0; z-index: 1;
}
.analytics-top-table td { padding: 10px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.analytics-top-table tbody tr { transition: background 150ms; }
.analytics-top-table tbody tr:hover { background: #f9fafb; }
.analytics-top-table tbody tr:last-child td { border-bottom: none; }
.analytics-top-rank { width: 36px; text-align: center; color: #9ca3af; font: 600 13px Manrope; }
.analytics-top-title { display: flex; align-items: center; gap: 10px; font: 500 13px Manrope; color: #111; max-width: 280px; }
.analytics-top-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analytics-top-thumb { width: 48px; height: 28px; border-radius: 4px; object-fit: cover; background: #f3f4f6; flex-shrink: 0; }
.analytics-top-stat { font: 600 12px Manrope; color: #111; font-variant-numeric: tabular-nums; }
.analytics-top-footer { padding: 10px 14px; font: 500 12px Manrope; color: #6b7280; text-align: center; border-top: 1px solid #e5e7eb; }
.analytics-table-wrap { border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; overflow: hidden; margin-bottom: 24px; }
.analytics-table-wrap .analytics-top-table { margin: 0; }

/* ===== AUDIENCE GRID ===== */
.analytics-audience-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.analytics-audience-card { border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; overflow: hidden; }
.analytics-audience-card-head { padding: 14px 16px 0; font: 600 13px Manrope; color: #111; }
.analytics-audience-card-body { padding: 10px 16px 16px; }

/* ===== LIST ITEMS ===== */
.analytics-list-item { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.analytics-list-item-left { display: flex; align-items: center; gap: 6px; font: 500 12px Manrope; color: #111; }
.analytics-list-item-right { font: 600 12px Manrope; color: #111; font-variant-numeric: tabular-nums; }
.analytics-list-bar { height: 3px; border-radius: 2px; background: #f3f4f6; margin-top: 2px; overflow: hidden; }
.analytics-list-bar-fill { height: 100%; border-radius: 2px; background: #2563eb; transition: width 300ms ease; }

/* ===== DEVICE GRID ===== */
.analytics-device-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 24px; }
.analytics-device-card { border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; overflow: hidden; }
.analytics-device-card-head { padding: 14px 16px 0; font: 600 13px Manrope; color: #111; }
.analytics-device-card-body { padding: 10px 16px 16px; }

/* ===== LATEST UPLOAD ===== */
.analytics-latest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.analytics-latest-card { border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; overflow: hidden; }
.analytics-latest-thumb-wrap { position: relative; width: 100%; padding-top: 56.25%; background: #f3f4f6; }
.analytics-latest-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.analytics-latest-duration {
  position: absolute; bottom: 8px; right: 8px; padding: 2px 6px;
  background: rgba(0,0,0,0.8); color: #fff; font: 600 11px Manrope;
  border-radius: 4px;
}
.analytics-latest-info { padding: 16px; }
.analytics-latest-title { font: 600 14px Manrope; color: #111; margin-bottom: 8px; line-height: 1.3; }
.analytics-latest-meta { display: flex; flex-direction: column; gap: 4px; font: 500 12px Manrope; color: #6b7280; }
.analytics-latest-meta span { display: flex; align-items: center; gap: 6px; }
.analytics-latest-actions { padding: 0 16px 16px; display: flex; gap: 8px; }
.analytics-latest-btn {
  padding: 8px 16px; border-radius: 8px; font: 600 12px Manrope;
  cursor: pointer; transition: all 150ms; border: 1px solid #e5e7eb;
  background: #fff; color: #111;
}
.analytics-latest-btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.analytics-latest-btn:hover { opacity: 0.85; }

/* ===== CHANNEL HEALTH ===== */
.analytics-health-card { border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; padding: 20px; }
.analytics-health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.analytics-health-section { }
.analytics-health-section-title { font: 600 11px Manrope; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.analytics-health-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; font: 500 12px Manrope; color: #111; }
.analytics-health-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.analytics-health-dot.green { background: #2563eb; }
.analytics-health-dot.gray { background: #d1d5db; }
.analytics-health-actions { padding: 16px 0 0; display: flex; gap: 8px; }

/* ===== TOOLTIP ===== */
.analytics-metric-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%; background: #f3f4f6;
  font: 700 9px Manrope; color: #9ca3af; cursor: help; vertical-align: middle;
  margin-left: 4px; position: relative;
}
.analytics-metric-info:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); padding: 6px 10px; border-radius: 6px;
  background: #111; color: #fff; font: 500 11px Manrope; white-space: nowrap;
  z-index: 100; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===== BADGES ===== */
.analytics-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font: 600 10px Manrope;
}
.analytics-badge.connected { background: var(--ab-light); color: #2563eb; }
.analytics-badge.public { background: var(--ab-light); color: #2563eb; }
.analytics-badge.private { background: #f3f4f6; color: #6b7280; }
.analytics-badge.unlisted { background: #fef3c7; color: #d97706; }

/* ===== SKELETON ===== */
.analytics-skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%; animation: ashimmer 1.5s infinite; border-radius: 8px;
}
.analytics-skeleton.kpi { height: 110px; border-radius: 12px; }
.analytics-skeleton.chart { height: 240px; border-radius: 12px; }
.analytics-skeleton.insight { height: 80px; border-radius: 10px; }
.analytics-skeleton.stat { height: 64px; border-radius: 10px; }
.analytics-skeleton.row { height: 44px; border-radius: 6px; margin: 6px 0; }
@keyframes ashimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== EMPTY / ERROR ===== */
.analytics-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; }
.analytics-empty-icon { margin-bottom: 10px; opacity: 0.25; }
.analytics-empty-icon svg { width: 40px; height: 40px; stroke: #6b7280; stroke-width: 1; fill: none; }
.analytics-empty-title { font: 600 13px Manrope; color: #111; margin-bottom: 3px; }
.analytics-empty-desc { font: 500 11px Manrope; color: #6b7280; max-width: 240px; }
.analytics-warning { padding: 12px 16px; border-radius: 8px; background: #fef3c7; border: 1px solid #fcd34d; font: 500 12px Manrope; color: #92400e; margin-bottom: 16px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .analytics-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .analytics-stats-grid { grid-template-columns: repeat(3, 1fr); }
  .analytics-audience-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-revenue-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .analytics-chart-grid { grid-template-columns: 1fr; }
  .analytics-latest-grid { grid-template-columns: 1fr; }
  .analytics-health-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .analytics-header-bar { flex-direction: column; align-items: flex-start; }
  .analytics-header-right { width: 100%; }
  .analytics-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-audience-grid { grid-template-columns: 1fr; }
  .analytics-device-grid { grid-template-columns: 1fr; }
  .analytics-revenue-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .analytics-kpi-grid { grid-template-columns: 1fr; }
  .analytics-stats-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .analytics-skeleton { animation: none; } }

/* ===== COMPARE CHANGE INDICATORS ===== */
.analytics-change { display: inline-flex; align-items: center; gap: 2px; font: 600 11px Manrope; margin-left: 6px; padding: 1px 6px; border-radius: 4px; vertical-align: middle; }
.analytics-change.positive { color: #dc2626; background: rgba(220,38,38,0.08); }
.analytics-change.negative { color: #dc2626; background: rgba(220,38,38,0.08); }
