/* style.css — Altivex Analytics Dashboard */
/* Dark theme business dashboard for photography prop */

/* ─── FONTS & RESET ──────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Backgrounds */
  --bg-base:      #080c18;
  --bg-primary:   #0a0e1a;
  --bg-secondary: #0f1529;
  --bg-card:      #131829;
  --bg-elevated:  #1a2239;
  --bg-hover:     #1e2845;

  /* Accents */
  --teal:    #00d4c8;
  --blue:    #4a90d9;
  --purple:  #8b5cf6;
  --green:   #10b981;
  --amber:   #f59e0b;
  --red:     #ef4444;

  /* Text */
  --text-primary:   #e2e8f0;
  --text-secondary: #8892a4;
  --text-muted:     #4a5568;
  --text-accent:    #00d4c8;

  /* Borders */
  --border-subtle:  rgba(255,255,255,0.05);
  --border-card:    rgba(255,255,255,0.08);
  --border-accent:  rgba(0,212,200,0.3);

  /* Layout */
  --header-h:    56px;
  --sidebar-l-w: 210px;
  --sidebar-r-w: 288px;
  --gap:         10px;
  --radius:      10px;
  --radius-sm:   6px;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ─── SCANLINE OVERLAY (photographic depth) ──────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.04) 3px,
    rgba(0,0,0,0.04) 4px
  );
}

/* ─── MAIN GRID ──────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-columns: var(--sidebar-l-w) 1fr var(--sidebar-r-w);
  height: 100vh;
  width: 100vw;
  gap: 0;
}

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
.header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 10;
}

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

.logo-mark {
  width: 34px; height: 34px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
}

.brand-sub {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 1px;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-tab {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 0;
  cursor: default;
  transition: color 0.2s;
}
.nav-tab.active {
  color: var(--teal);
  border-bottom: 2px solid var(--teal);
  padding-bottom: 2px;
}

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

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--green);
}

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulseGlow 2s ease-in-out infinite;
}

.clock {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.date-label {
  font-size: 11px;
  color: var(--text-muted);
}

.header-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  display: flex; align-items: center; justify-content: center;
  cursor: default;
  color: var(--text-secondary);
}

/* ─── LEFT SIDEBAR ───────────────────────────────────────────────────────── */
.sidebar-left {
  grid-row: 2;
  grid-column: 1;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

/* Nav items */
.nav-section { padding: 0 12px; margin-bottom: 8px; }
.nav-section-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  cursor: default;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-item.active {
  background: rgba(0,212,200,0.1);
  color: var(--teal);
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; color: var(--teal); }

.nav-badge {
  margin-left: auto;
  background: var(--teal);
  color: var(--bg-primary);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
}

/* World Map */
.map-section {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.section-title-sm {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title-sm::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.world-map-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  padding: 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.world-map {
  width: 100%;
  flex: 1;
}

.continent { fill: #1e2d4a; stroke: #2a3d5e; stroke-width: 0.8; }
.continent.active { fill: #1a3a52; }

.hotspot-ring {
  fill: none;
  stroke: var(--teal);
  stroke-width: 0.8;
  opacity: 0;
  animation: ringExpand 2.5s ease-out infinite;
}
.hotspot-ring:nth-child(2) { animation-delay: 0.8s; }
.hotspot-ring:nth-child(3) { animation-delay: 1.6s; }

.hotspot-core {
  fill: var(--teal);
  animation: hotspotPulse 2.5s ease-in-out infinite;
}

.data-line {
  stroke: rgba(0,212,200,0.25);
  stroke-width: 0.6;
  stroke-dasharray: 3 3;
  animation: dashMove 4s linear infinite;
}

.map-region-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.region-stat {
  font-size: 9px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.region-stat-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── MAIN CONTENT ───────────────────────────────────────────────────────── */
.main-content {
  grid-row: 2;
  grid-column: 2;
  display: grid;
  grid-template-rows: 96px 220px minmax(0, 1fr) 170px;
  gap: var(--gap);
  padding: var(--gap);
  overflow: hidden;
  background: var(--bg-primary);
  /* minmax(0,1fr) prevents content from expanding grid rows beyond available space */
  height: 100%;
  min-height: 0;
}

/* ─── KPI CARDS ──────────────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}

.kpi-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: default;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-accent, var(--teal));
  opacity: 0.8;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--card-glow, rgba(0,212,200,0.08)), transparent 70%);
}

.kpi-card:nth-child(1) { --card-accent: var(--teal);   --card-glow: rgba(0,212,200,0.08); }
.kpi-card:nth-child(2) { --card-accent: var(--blue);   --card-glow: rgba(74,144,217,0.08); }
.kpi-card:nth-child(3) { --card-accent: var(--purple);  --card-glow: rgba(139,92,246,0.08); }
.kpi-card:nth-child(4) { --card-accent: var(--green);  --card-glow: rgba(16,185,129,0.08); }

/* Shimmer sweep */
.kpi-card .shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255,255,255,0.04) 50%,
    transparent 60%
  );
  transform: translateX(-100%);
  animation: shimmer 4s ease-in-out infinite;
}
.kpi-card:nth-child(2) .shimmer { animation-delay: 1s; }
.kpi-card:nth-child(3) .shimmer { animation-delay: 2s; }
.kpi-card:nth-child(4) .shimmer { animation-delay: 3s; }

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

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.kpi-icon {
  color: var(--card-accent, var(--teal));
  opacity: 0.7;
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
  transition: opacity 0.3s;
}

.kpi-value.flipping {
  animation: countFlip 0.5s ease-in-out;
}

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

.kpi-delta {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
}

.kpi-period {
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* ─── CHART PANELS ───────────────────────────────────────────────────────── */
.chart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.chart-panel-revenue { /* full width */ }

.charts-row {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: var(--gap);
  min-height: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.panel-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.period-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.period-tab {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: default;
}
.period-tab.active {
  background: var(--bg-elevated);
  color: var(--teal);
}

.chart-wrap {
  flex: 1;
  position: relative;
  min-height: 0;
}

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

/* Donut center label */
.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -56%);
  text-align: center;
  pointer-events: none;
}
.donut-center-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.donut-center-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 2px;
}

/* ─── DATA TABLE ─────────────────────────────────────────────────────────── */
.table-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-panel .panel-header {
  padding: 12px 16px 0;
  flex-shrink: 0;
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  flex: 1;
}

.metrics-table thead th {
  padding: 8px 12px;
  text-align: left;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-card);
  white-space: nowrap;
}

.metrics-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.3s;
  cursor: default;
}
.metrics-table tbody tr:last-child { border-bottom: none; }
.metrics-table tbody tr.row-active {
  background: rgba(0,212,200,0.04);
  border-left: 2px solid var(--teal);
}
.metrics-table tbody tr:not(.row-active) {
  border-left: 2px solid transparent;
}

.metrics-table tbody td {
  padding: 7px 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.project-name {
  color: var(--text-primary) !important;
  font-weight: 500;
}

.team-lead {
  display: flex;
  align-items: center;
  gap: 6px;
}

.avatar-circle {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-card);
  font-size: 8px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-accent);
  flex-shrink: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.status-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.on-track  { background: rgba(16,185,129,0.1);  color: var(--green);  }
.status-badge.at-risk   { background: rgba(245,158,11,0.1);  color: var(--amber);  }
.status-badge.completed { background: rgba(74,144,217,0.1);  color: var(--blue);   }
.status-badge.in-review { background: rgba(139,92,246,0.1);  color: var(--purple); }

.inline-progress {
  display: flex;
  align-items: center;
  gap: 6px;
}
.progress-track-sm {
  width: 64px;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill-sm {
  height: 100%;
  border-radius: 2px;
  background: var(--teal);
  transition: width 0.8s ease-out;
}
.progress-fill-sm.at-risk  { background: var(--amber); }
.progress-fill-sm.completed { background: var(--blue); }

.pct-label {
  font-size: 10px;
  color: var(--text-muted);
  min-width: 28px;
}

.target-value {
  color: var(--text-primary) !important;
  font-weight: 600;
}

/* ─── RIGHT SIDEBAR ──────────────────────────────────────────────────────── */
.sidebar-right {
  grid-row: 2;
  grid-column: 3;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--gap);
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

/* Ticker Panel */
.ticker-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 12px;
  flex-shrink: 0;
}

.ticker-header {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.ticker-item {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  text-align: center;
  transition: opacity 0.3s;
}

.ticker-label {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.ticker-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ticker-delta {
  font-size: 9px;
  font-weight: 500;
  margin-top: 2px;
}
.ticker-delta.up   { color: var(--green); }
.ticker-delta.down { color: var(--red);   }

/* Activity Feed */
.activity-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.activity-header {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  flex-shrink: 0;
}

.activity-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

.activity-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  font-size: 11px;
  transition: all 0.35s ease;
}

.activity-entry.entry-enter {
  animation: entrySlideIn 0.35s ease forwards;
}
.activity-entry.entry-exit {
  animation: entrySlideOut 0.35s ease forwards;
}

.activity-icon-wrap {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.activity-icon-wrap.deal    { background: rgba(16,185,129,0.15); color: var(--green);  }
.activity-icon-wrap.alert   { background: rgba(245,158,11,0.15);  color: var(--amber);  }
.activity-icon-wrap.user    { background: rgba(74,144,217,0.15);  color: var(--blue);   }
.activity-icon-wrap.report  { background: rgba(139,92,246,0.15);  color: var(--purple); }
.activity-icon-wrap.meeting { background: rgba(0,212,200,0.15);   color: var(--teal);   }

.activity-body { flex: 1; min-width: 0; }

.activity-action {
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-detail {
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  font-size: 9px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

/* Goals/Progress Bars */
.goals-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius);
  padding: 12px;
  flex-shrink: 0;
}

.goals-header {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.goals-period {
  font-size: 9px;
  color: var(--teal);
  font-weight: 500;
}

.goal-item { margin-bottom: 8px; }
.goal-item:last-child { margin-bottom: 0; }

.goal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.goal-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.goal-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: none;
}
.progress-bar.animating {
  animation: fillProgress 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ─── KEYFRAME ANIMATIONS ────────────────────────────────────────────────── */
@keyframes pulseGlow {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px currentColor; }
  50%       { opacity: 0.5; box-shadow: 0 0 14px currentColor, 0 0 28px rgba(16,185,129,0.25); }
}

@keyframes countFlip {
  0%   { transform: translateY(0);     opacity: 1; }
  40%  { transform: translateY(-120%); opacity: 0; }
  60%  { transform: translateY(120%);  opacity: 0; }
  100% { transform: translateY(0);     opacity: 1; }
}

@keyframes shimmer {
  0%   { transform: translateX(-150%); }
  100% { transform: translateX(250%);  }
}

@keyframes fillProgress {
  from { width: 0%; }
  to   { width: var(--target-w, 0%); }
}

@keyframes hotspotPulse {
  0%, 100% { opacity: 1; r: 2.5; }
  50%       { opacity: 0.7; r: 3.5; }
}

@keyframes ringExpand {
  0%   { r: 3;  opacity: 0.6; }
  100% { r: 10; opacity: 0;   }
}

@keyframes dashMove {
  from { stroke-dashoffset: 0;   }
  to   { stroke-dashoffset: -24; }
}

@keyframes entrySlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes entrySlideOut {
  from { opacity: 1; transform: translateY(0);    max-height: 50px; }
  to   { opacity: 0; transform: translateY(-8px); max-height: 0;    }
}

/* ─── SCROLLBAR HIDE ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 0; height: 0; }

/* ─── RESPONSIVE SCALE ───────────────────────────────────────────────────── */
@media (max-width: 1440px) {
  :root {
    --sidebar-l-w: 190px;
    --sidebar-r-w: 256px;
  }
  html { font-size: 12px; }
  .kpi-value { font-size: 26px; }
}

@media (max-width: 1280px) {
  :root {
    --sidebar-l-w: 170px;
    --sidebar-r-w: 230px;
    --gap: 8px;
  }
  html { font-size: 11px; }
  .kpi-value { font-size: 22px; }
  .brand-name { font-size: 13px; }
}
