/* ==========================================================================
   analytics.css — Estilos da seção de Analytics do dashboard
   --------------------------------------------------------------------------
   Anexar este CSS DEPOIS de dashboard.css.
   ========================================================================== */

/* ===== Mini-KPIs de analytics (linha de cards menores) ===================== */
.an-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.an-kpi {
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--dur-2);
}
.an-kpi:hover {
  border-color: var(--brand-purple);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -12px rgba(79, 70, 229, 0.18);
}

.an-kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 1.05rem;
}
.an-kpi-icon.wa {
  background: rgba(37, 211, 102, 0.12);
  color: #25d366;
}
.an-kpi-icon.ig {
  background: linear-gradient(
    135deg,
    rgba(225, 48, 108, 0.15),
    rgba(245, 133, 41, 0.15)
  );
  color: #e1306c;
}
.an-kpi-icon.vis {
  background: rgba(79, 70, 229, 0.14);
  color: var(--brand-purple);
}
.an-kpi-icon.conv {
  background: rgba(16, 185, 129, 0.14);
  color: var(--brand-success);
}

.an-kpi-content {
  min-width: 0;
}
.an-kpi-content .label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
}
.an-kpi-content .value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--brand-ink);
  margin-top: 2px;
  line-height: 1.1;
}

/* ===== Gráfico horário ===================================================== */
.hourly-chart-wrap {
  width: 100%;
}
.dash-chart-area.hourly {
  height: 220px;
}

/* ===== Lista de origens de tráfego ========================================= */
.sources-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.source-row {
  display: grid;
  grid-template-columns: 1fr 50px;
  align-items: center;
  gap: 6px 12px;
}
.source-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  grid-column: 1 / 2;
  min-width: 0;
}
.source-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.source-label {
  font-size: 0.88rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-row-head strong {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--brand-ink);
  font-weight: 600;
}
.source-bar {
  grid-column: 1 / 2;
  height: 5px;
  background: var(--bg-soft);
  border-radius: 3px;
  overflow: hidden;
}
.source-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s var(--ease-out);
}
.source-percent {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
  text-align: right;
  align-self: center;
}

/* ===== Quebra de dispositivos ============================================= */
.device-breakdown {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.device-stat {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
}
.device-stat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  grid-column: 1 / 2;
}
.device-stat-head span {
  font-size: 0.86rem;
  color: var(--text-2);
}
.device-stat-head strong {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--brand-ink);
}
.device-bar {
  grid-column: 1 / 2;
  height: 6px;
  background: var(--bg-soft);
  border-radius: 3px;
  overflow: hidden;
}
.device-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-purple), var(--brand-cyan));
  border-radius: 3px;
  transition: width 0.8s var(--ease-out);
}
.device-percent {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-3);
  min-width: 40px;
  text-align: right;
}

/* ===== Lista de atividade recente ========================================= */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: background var(--dur-1);
}
.activity-row:hover {
  background: var(--bg-soft);
}
.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--bg-soft);
  font-size: 0.95rem;
  flex-shrink: 0;
}
.activity-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.activity-info strong {
  font-size: 0.86rem;
  color: var(--brand-ink);
  font-weight: 600;
}
.activity-info span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* ===== Estado vazio ======================================================= */
.analytics-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-3);
  font-size: 0.85rem;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-soft);
}

/* ===== Responsivo ========================================================= */
@media (max-width: 1200px) {
  .an-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .an-kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .an-kpi {
    padding: 14px 14px;
    gap: 10px;
  }
  .an-kpi-icon {
    width: 34px;
    height: 34px;
  }
  .an-kpi-content .value {
    font-size: 1.2rem;
  }
  .dash-chart-area.hourly {
    height: 180px;
  }
}
@media (max-width: 380px) {
  .an-kpi-grid {
    grid-template-columns: 1fr;
  }
}
