/* =============================================================================
   ARES ANALYTICS DASHBOARD
   Dark theme · magenta/purple palette — matches main site design system
   ============================================================================= */

/* ===== RESET & TOKENS ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --magenta:     #e040fb;
  --purple:      #7c4dff;
  --deep:        #4a0080;
  --bg:          #050510;
  --bg2:         #0a0a1e;
  --bg3:         #0f0f2a;
  --surface:     #12122a;
  --surface2:    #181836;
  --border:      rgba(224, 64, 251, 0.15);
  --border2:     rgba(124, 77, 255, 0.12);
  --text:        #e8e8f0;
  --muted:       #8888aa;
  --gradient:    linear-gradient(135deg, var(--magenta), var(--purple));
  --glow:        0 0 30px rgba(224, 64, 251, 0.2);
  --radius:      12px;
  --transition:  0.3s ease;
  --positive:    #4ade80;
  --negative:    #f87171;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, .logo-text { font-family: 'Orbitron', sans-serif; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; line-height: 1.1; }
h3 { font-size: 0.95rem; font-weight: 600; }
p  { color: var(--muted); font-size: 0.9rem; }

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== NAV ===== */
#dash-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 5, 16, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

#dash-nav .nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  color: var(--magenta);
  font-size: 1rem;
}

.logo-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.06em;
}

.logo-text .accent { color: var(--magenta); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Date range buttons */
.date-range {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.range-btn {
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: var(--transition);
}

.range-btn:hover { color: var(--text); }

.range-btn.active {
  background: var(--gradient);
  color: #fff;
}

/* Live badge */
.live-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.75rem;
  color: var(--text);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 6px var(--positive);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* Back button */
.btn-nav {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: var(--transition);
}

.btn-nav:hover {
  border-color: var(--magenta);
  color: var(--magenta);
}

/* ===== MAIN ===== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

/* ===== PAGE HEADER ===== */
.dash-header {
  margin-bottom: 40px;
}

.section-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 0.6rem;
}

.dash-sub {
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.9rem;
}

/* ===== KPI GRID ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top right, rgba(224, 64, 251, 0.06), transparent 70%);
  pointer-events: none;
}

.kpi-card:hover {
  border-color: rgba(224, 64, 251, 0.35);
  box-shadow: var(--glow);
  transform: translateY(-2px);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon svg { width: 16px; height: 16px; }

.kpi-icon.visitors  { background: rgba(224, 64, 251, 0.15); color: var(--magenta); }
.kpi-icon.views     { background: rgba(124, 77, 255, 0.15); color: var(--purple); }
.kpi-icon.session   { background: rgba(96, 165, 250, 0.12); color: #60a5fa; }
.kpi-icon.bounce    { background: rgba(248, 113, 113, 0.12); color: var(--negative); }
.kpi-icon.conv      { background: rgba(74, 222, 128, 0.12); color: var(--positive); }
.kpi-icon.retention { background: rgba(251, 191, 36, 0.12); color: #fbbf24; }

.kpi-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-delta {
  font-size: 0.72rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.kpi-delta.positive { color: var(--positive); }
.kpi-delta.negative { color: var(--negative); }

.kpi-spark {
  height: 40px;
  margin: 0 -4px -4px;
}

.kpi-spark canvas { width: 100% !important; height: 40px !important; }

/* ===== CHART CARDS ===== */
.chart-row {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-row.three-col { grid-template-columns: repeat(3, 1fr); }
.chart-row.two-col   { grid-template-columns: 1fr 1fr; }

@media (max-width: 1100px) {
  .chart-row.three-col { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .chart-row.three-col,
  .chart-row.two-col   { grid-template-columns: 1fr; }
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.chart-card.wide { grid-column: 1 / -1; }

.chart-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, rgba(124, 77, 255, 0.05), transparent 60%);
  pointer-events: none;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.card-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 4px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.magenta { background: var(--magenta); }
.legend-dot.purple  { background: var(--purple); }

.chart-wrap {
  position: relative;
  height: 200px;
}

.chart-wrap.tall   { height: 280px; }
.chart-wrap.donut  { height: 180px; }

.chart-wrap canvas { width: 100% !important; height: 100% !important; }

/* Donut legend */
.donut-legend {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
}

.donut-legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.donut-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-legend-val {
  font-weight: 600;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
}

/* ===== DATA TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border2);
  vertical-align: middle;
}

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

.data-table tr:hover td { background: rgba(224, 64, 251, 0.04); }

.page-name {
  color: var(--text);
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--gradient);
  opacity: 0.7;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-views-num {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  color: var(--text);
  white-space: nowrap;
}

/* ===== GEO LIST ===== */
.geo-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.geo-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.geo-flag {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
}

.geo-info {
  flex: 1;
}

.geo-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.geo-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--surface2);
  overflow: hidden;
}

.geo-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--gradient);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.geo-pct {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7rem;
  color: var(--magenta);
  white-space: nowrap;
}

/* ===== FOOTER ===== */
.dash-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.dash-footer .footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.dash-footer p {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.kpi-card, .chart-card {
  animation: fadeUp 0.5s ease both;
}

.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.10s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.20s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }
.kpi-card:nth-child(6) { animation-delay: 0.30s; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: rgba(224, 64, 251, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(224, 64, 251, 0.5); }
