@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,900;1,400&display=swap');

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── App Shell ──────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: rgba(20, 20, 22, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  height: 40px;
  width: auto;
  margin-left: -4px;
}

.sidebar-nav {
  flex: 1;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text);
  transform: translateX(4px);
}

.sidebar-link.active {
  background: rgba(200,160,74,0.08);
  color: var(--accent);
  border-color: rgba(200,160,74,0.2);
  box-shadow: 0 0 20px rgba(200,160,74,0.05);
}

.sidebar-footer {
  padding: 24px;
  border-top: 1px solid rgba(255,255,255,0.03);
}

.client-badge-info {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

/* ─── Main Content Area ──────────────────────────────────────────────────── */
.main-area {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

.main-container {
  padding: 40px;
  width: 100%;
}

/* ─── Header Strip (Inside Main) ─────────────────────────────────────────── */
.top-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ─── KPI Strip ──────────────────────────────────────────────────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 20px;
  transition: all 0.3s ease;
}

.kpi-card:hover {
  border-color: var(--accent);
  background: rgba(200,160,74,0.04);
}

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

.kpi-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  font-family: var(--font-display);
}

.kpi-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* ─── Tabs Navigation ────────────────────────────────────────────────────── */
.tabs-nav {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 32px;
  padding-bottom: 0;
}

.tab-link {
  padding: 14px 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
  text-transform: uppercase;
}

.tab-link:hover {
  color: var(--accent);
  border-bottom-color: rgba(200,160,74,0.4);
}

.tab-link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ─── Overview Tab Content ───────────────────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.overview-grid.full {
  grid-template-columns: 1fr;
}

@media (max-width: 1200px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Section Containers ─────────────────────────────────────────────────── */
.section {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 24px;
  transition: all 0.3s ease;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-meta {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ─── Chart Containers ───────────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 280px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table thead tr {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.data-table th {
  text-align: left;
  padding: 12px 0;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 10px;
}

.data-table td {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

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

.data-table tbody tr:hover {
  background: rgba(200,160,74,0.03);
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-primary {
  background: rgba(200,160,74,0.12);
  color: var(--accent);
}

.badge-success {
  background: rgba(74,222,128,0.12);
  color: var(--success);
}

.badge-warning {
  background: rgba(251,191,36,0.12);
  color: var(--warning);
}

/* ─── Map Container ──────────────────────────────────────────────────────── */
.map-section {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
}

.map-controls {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.map-toggle {
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
}

.map-toggle:hover {
  border-color: var(--accent);
  background: rgba(200,160,74,0.04);
}

.map-toggle.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

#map-container {
  height: 500px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

svg {
  width: 100%;
  height: 100%;
}

.state {
  fill: var(--primary);
  stroke: rgba(232,224,208,0.1);
  stroke-width: 0.5px;
  transition: fill 0.2s ease;
}

.state:hover {
  fill: rgba(200,160,74,0.1);
}

.bubble {
  fill-opacity: 0.7;
  stroke-width: 1px;
  stroke-opacity: 0.4;
  transition: all 0.2s ease;
}

.bubble:hover {
  fill-opacity: 0.9;
  stroke-opacity: 0.8;
  filter: drop-shadow(0 0 8px rgba(200,160,74,0.4));
}

.bubble-reach {
  fill: var(--accent);
  stroke: var(--accent);
}

.bubble-sales {
  fill: var(--success);
  stroke: var(--success);
}

.bubble-visitors {
  fill: #a78bfa;
  stroke: #a78bfa;
}

.map-tooltip {
  position: absolute;
  background: rgba(14,14,16,0.95);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 12px;
  border-radius: 4px;
  font-size: 11px;
  pointer-events: none;
  z-index: 1000;
  max-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.map-tooltip-label {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.map-legend {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  gap: 24px;
  font-size: 11px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* ─── Quick Links ────────────────────────────────────────────────────────── */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 32px;
}

.quick-link {
  background: var(--bg2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 12px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-link:hover {
  border-color: var(--accent);
  background: rgba(200,160,74,0.04);
  transform: translateX(2px);
}

.quick-link-arrow {
  font-size: 10px;
  color: var(--muted);
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  margin-top: 48px;
  padding: 24px 32px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 10px;
  color: rgba(255,255,255,0.15);
  text-align: center;
  letter-spacing: 0.08em;
}

/* ─── Loader ─────────────────────────────────────────────────────────────── */
.loader-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-container {
    padding: 24px 16px;
  }

  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .navbar {
    padding: 0 16px;
  }

  .tabs-nav {
    gap: 16px;
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }

  .map-legend {
    flex-direction: column;
    gap: 8px;
  }
}
