/* ========================================
   GA4 Analytics Dashboard - Shared CSS
   Professional, Premium Design System
   ======================================== */

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

/* ========================================
   1. RESET & BASE STYLES
   ======================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #E2E7EE;
  color: #1e293b;
  font-size: 12px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input, select, textarea, button, label {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: #2563eb;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #1d4ed8;
}

/* ========================================
   2. APP HEADER (Sticky)
   ======================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 61px;
}

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

.header-left {
  flex: 1;
}

.header-right {
  justify-content: flex-end;
}

/* ========================================
   3. NAVIGATION TABS (Sticky)
   ======================================== */

.tabs { background: #0F172A; padding: 0; display: flex; align-items: stretch; justify-content: center; position: sticky; top: 61px; z-index: 99; width: 100%; border-bottom: none; gap: 4px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 2px 8px rgba(0,0,0,0.12); }
.tab-divider { width: 1px; background: rgba(255,255,255,0.12); margin: 10px 8px; align-self: stretch; flex-shrink: 0; }
.tab-btn { padding: 13px 28px; font-size: 13px; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; color: rgba(255,255,255,0.8); font-weight: 500; font-family: inherit; transition: all 0.2s ease; text-align: center; border-radius: 8px 8px 0 0; text-decoration: none; display: inline-flex; align-items: center; }
.tab-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
.tab-btn.active { color: #fff; font-weight: 700; border-bottom-color: #fff; background: rgba(255,255,255,0.1); }
.tab-group { position: relative; }
.tab-group-btn { padding: 13px 28px; font-size: 13px; background: none; border: none; cursor: pointer; white-space: nowrap; color: rgba(255,255,255,0.8); font-weight: 500; font-family: inherit; transition: all 0.2s ease; text-align: center; border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px; border-radius: 8px 8px 0 0; }
.tab-group-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }
.tab-group-btn.has-active { color: #fff; font-weight: 700; border-bottom-color: #fff; background: rgba(255,255,255,0.1); }
.tab-group-btn .chevron { font-size: 8px; opacity: 0.6; transition: transform 0.2s; margin-left: 2px; }
.tab-group.open .tab-group-btn .chevron { transform: rotate(180deg); }
.tab-group.open .tab-group-btn { background: rgba(255,255,255,0.1); color: #fff; }
.tab-dropdown { display: none; position: absolute; top: calc(100% + 2px); left: 50%; transform: translateX(-50%); background: #fff; border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.08); min-width: 210px; z-index: 200; overflow: hidden; padding: 6px 0; }
.tab-group.open .tab-dropdown { display: block; }
.tab-dropdown-item { display: flex; align-items: center; gap: 8px; padding: 10px 20px; font-size: 12px; color: #334155; cursor: pointer; transition: all 0.1s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: none; background: none; width: 100%; text-align: left; font-family: inherit; text-decoration: none; }
.tab-dropdown-item:hover { background: #F2F6FA; color: #1e293b; }
.tab-dropdown-item.active { background: #eff6ff; color: #2563eb; font-weight: 600; }

/* ========================================
   4. CONTENT CONTAINER
   ======================================== */

.content {
  padding: 32px;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - 126px);
  -webkit-overflow-scrolling: touch;
}

.content::-webkit-scrollbar {
  width: 8px;
}

.content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* ========================================
   5. KPI CARDS (Professional Redesign)
   ======================================== */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  border: 1px solid #CBD5E1;
  border-left: 4px solid #2563eb;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.card.accent-purple {
  border-left-color: #7c3aed;
}

.card.accent-green {
  border-left-color: #059669;
}

.card.accent-cyan {
  border-left-color: #0891b2;
}

.card.accent-amber {
  border-left-color: #f59e0b;
}

.card.accent-red {
  border-left-color: #dc2626;
}

.card-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 8px;
}

.card-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #1e293b;
  line-height: 1;
  margin-bottom: 12px;
}

.card-sub {
  font-size: 11px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
}

.pop-badge { display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border-radius:12px; font-size:10px; font-weight:700; }
.pop-badge.up { color:#16a34a; background:rgba(22,163,74,0.08); }
.pop-badge.down { color:#dc2626; background:rgba(220,38,38,0.08); }
.pop-badge.flat { color:#94a3b8; background:rgba(148,163,184,0.08); }

/* Card comparison layout */
.card-comp-layout { display:flex; align-items:center; gap:16px; }
.card-comp-left { flex:1; min-width:0; }
.card-comp-right { display:flex; flex-direction:column; gap:4px; align-items:flex-end; flex-shrink:0; }
.card-comp-right .comp-line { display:flex; align-items:center; gap:4px; white-space:nowrap; }
.card-comp-right .comp-label { font-size:9px; font-weight:700; color:#94a3b8; text-transform:uppercase; letter-spacing:0.3px; min-width:22px; }

/* Delta Indicators (Pill Style) */
.card-up, .card-down, .card-flat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.card-up {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}

.card-down {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

.card-flat {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.08);
}

/* ========================================
   6. LOADING & SPINNER
   ======================================== */

.loading { text-align: center; padding: 80px 20px; color: #94a3b8; }
.loading .spinner { width: 36px; height: 36px; border: 3px solid #e2e8f0; border-top-color: #0F172A; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   7. SEARCH DROPDOWN (.sd-* classes)
   ======================================== */

.sd-wrap { position: relative; display: block; font-family: inherit; }
.sd-trigger { padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 12px; outline: none; font-family: inherit; min-width: 200px; background: #fff; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #1e293b; transition: all 0.2s ease; user-select: none; white-space: nowrap; }
.sd-trigger:hover { border-color: #cbd5e1; background: #f8fafc; }
.sd-trigger:focus, .sd-trigger.sd-open { border-color: #94a3b8; box-shadow: 0 0 0 3px rgba(51,65,85,0.08); }
.sd-trigger .sd-arrow { font-size: 10px; color: #9ca3af; transition: transform 0.2s; }
.sd-trigger.sd-open .sd-arrow { transform: rotate(180deg); }
.sd-panel { position: absolute; top: calc(100% + 4px); left: auto; right: 0; min-width: 100%; max-width: 600px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06); z-index: 50; display: none; overflow: hidden; }
.sd-panel.sd-visible { display: block; }
.sd-search-wrap { padding: 8px; border-bottom: 1px solid #F2F6FA; }
.sd-search { width: 100%; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 12px; font-family: inherit; outline: none; box-sizing: border-box; }
.sd-search:focus { border-color: #94a3b8; box-shadow: 0 0 0 3px rgba(51,65,85,0.08); }
.sd-list { max-height: 260px; overflow-y: auto; padding: 4px 0; }
.sd-item { padding: 8px 12px; font-size: 12px; color: #374151; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: all 0.15s ease; font-family: inherit; border-radius: 6px; margin: 0 4px; }
.sd-item:hover { background: #F2F6FA; }
.sd-item.sd-active { background: #eff6ff; color: #2563eb; font-weight: 600; }
.sd-empty { padding: 12px; font-size: 12px; color: #9ca3af; text-align: center; }

/* ========================================
   8. PERIOD BAR & CONTROLS
   ======================================== */

.period-bar { display: flex; gap: 12px; margin-bottom: 28px; align-items: center; flex-wrap: wrap; position: relative; z-index: 60; }
.period-label { font-size: 12px; color: #64748b; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
#period-picker { position: relative; z-index: 52; flex-shrink: 0; }
#period-picker .sd-panel { left: 0; right: auto; }
#period-picker .sd-trigger { min-width: 130px; max-width: 160px; }

/* ========================================
   9. SECTION GRID
   ======================================== */

.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-bottom: 32px;
}

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

/* ========================================
   10. PANELS (Refined)
   ======================================== */

.panel {
  background: white;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  border: 1px solid #CBD5E1;
  margin-bottom: 32px;
  transition: box-shadow 0.2s ease;
}

.panel:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
  flex-shrink: 0;
}

.panel-title .dot.purple {
  background: #7c3aed;
}

.panel-title .dot.green {
  background: #059669;
}

.panel-title .dot.cyan {
  background: #0891b2;
}

.panel-title .dot.amber {
  background: #f59e0b;
}

.panel-title .dot.red {
  background: #dc2626;
}

/* ========================================
   11. DATA TABLES (Refined)
   ======================================== */

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.data-table thead {
  background: #F1F5F9;
}

.data-table thead th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  padding: 12px;
  border-bottom: 2px solid #CBD5E1;
  text-align: left;
  position: sticky;
  top: 0;
  background: #F1F5F9;
  z-index: 10;
}

.data-table thead th.num {
  text-align: right;
}

.data-table tbody td {
  padding: 12px;
  font-size: 12px;
  font-weight: 400;
  color: #1e293b;
  border-bottom: 1px solid #E2E8F0;
}

.data-table tbody td.num {
  text-align: right;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody tr:nth-child(even) {
  background: #F1F5F9;
}

.data-table tbody tr:nth-child(even):hover {
  background: #f8fafc;
}

/* Sortable headers */
.data-table thead th.sortable { cursor: pointer; user-select: none; }
.data-table thead th.sortable:hover { background: #f1f5f9; }
.data-table thead th.sorted-asc::after { content: ' ↑'; opacity: 1; color: #2563eb; }
.data-table thead th.sorted-desc::after { content: ' ↓'; opacity: 1; color: #2563eb; }

.data-table .sorted {
  position: relative;
  cursor: pointer;
}

.data-table .sort-icon {
  display: inline-block;
  margin-left: 6px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.data-table .sorted .sort-icon {
  opacity: 1;
}

.data-table thead th:hover .sort-icon {
  opacity: 0.8;
}

/* ========================================
   12. CHART STYLES (Professional)
   ======================================== */

.trend-panel {
  width: 100%;
  background: white;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  border: 1px solid #CBD5E1;
  margin-bottom: 32px;
}

.trend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.trend-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

.trend-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.metric-toggles, .gran-toggles, .compare-toggles {
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-toggle, .gran-toggle, .compare-toggle {
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  color: #64748b;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.metric-toggle:hover, .gran-toggle:hover, .compare-toggle:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.metric-toggle.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.gran-toggle.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.compare-toggle {
  border-color: #fcd34d;
}

.compare-toggle.active {
  background: #f59e0b;
  color: white;
  border-color: #f59e0b;
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 200px;
}

.range-slider {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2563eb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.range-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2563eb;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.range-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.trend-chart-wrap {
  position: relative;
  height: 320px;
  margin: 24px 0;
}

.trend-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.trend-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
}

.trend-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ========================================
   13. DEVICE CHART
   ======================================== */

.device-chart-wrap {
  position: relative;
  height: 280px;
  margin: 24px 0;
}

.device-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.device-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
}

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


/* ========================================
   14. HORIZONTAL BAR CHARTS
   ======================================== */

.h-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.h-bar-row:last-child { margin-bottom: 0; }
.h-bar-label { width: 120px; font-size: 11px; color: #1e293b; text-align: right; flex-shrink: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-bar-wrap { flex: 1; height: 32px; background: #f1f5f9; border-radius: 8px; overflow: hidden; position: relative; }
.h-bar { height: 100%; border-radius: 8px; transition: width 0.6s ease; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; min-width: 2px; }
.h-bar-text { font-size: 10px; font-weight: 700; color: #fff; white-space: nowrap; }
.h-bar-val { width: 70px; font-size: 11px; color: #64748b; text-align: right; flex-shrink: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ========================================
   15. DONUT CHARTS (SVG)
   ======================================== */

/* Audience donut (flex horizontal) */
.donut-container { display: flex; align-items: center; gap: 32px; justify-content: center; flex-wrap: wrap; }
.donut-svg { width: 180px; height: 180px; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend-label { color: #64748b; }
.donut-legend-val { font-weight: 700; color: #1e293b; margin-left: auto; min-width: 50px; text-align: right; }

/* Events page donut (inline centered) */
.donut-container.donut-centered { position: relative; width: 160px; height: 160px; margin: 0 auto; }
.donut-canvas { width: 100%; height: 100%; }
.donut-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.donut-label-value { font-size: 18px; font-weight: 800; color: #1e293b; }
.donut-label-text { font-size: 10px; color: #64748b; margin-top: 2px; }

/* ========================================
   16. PAGE HEADER
   ======================================== */

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #1e293b;
  margin: 0 0 8px 0;
}

.page-subtitle {
  font-size: 13px;
  color: #64748b;
  font-weight: 400;
  margin: 0;
}

/* ========================================
   17. MISCELLANEOUS
   ======================================== */

.no-data {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 32px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

.page-link {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  max-width: 100%;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.gsc-badge, .ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ai-badge {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
}

.source-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  margin-right: 8px;
  flex-shrink: 0;
}

.conversion-badge { display: inline-block; background: #eff6ff; color: #2563eb; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

.delta-arrow { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.delta-arrow.up { color: #16a34a; }
.delta-arrow.down { color: #dc2626; }
.delta-arrow.flat { color: #94a3b8; }
.delta-arrow-icon { font-size: 12px; }
.delta-pct { font-size: 11px; opacity: 0.8; }

.search-wrap {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: #1e293b;
  transition: all 0.2s ease;
}

.controls-bar .search-input {
  flex: 1;
  max-width: 320px;
}

.search-input::placeholder {
  color: #cbd5e1;
}

.search-input:focus {
  outline: none;
  border-color: #2563eb;
  background: white;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* ========================================
   18. CHART.JS SPECIFIC (Events Page)
   ======================================== */

.chart-container { position: relative; height: 300px; margin-bottom: 20px; overflow: visible; }
.chart-container canvas { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; }
.chart-row { display: flex; align-items: center; margin-bottom: 10px; gap: 10px; }
.chart-row:last-child { margin-bottom: 0; }
.chart-label { width: 120px; font-size: 11px; color: #64748b; text-align: left; flex-shrink: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.chart-bar-wrap { flex: 1; height: 28px; background: #f1f5f9; border-radius: 8px; overflow: hidden; position: relative; }
.chart-bar { height: 100%; border-radius: 8px; transition: width 0.6s ease; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; }
.chart-bar-text { font-size: 10px; font-weight: 700; color: #fff; white-space: nowrap; }
.chart-pct { width: 50px; font-size: 11px; color: #64748b; text-align: right; flex-shrink: 0; font-weight: 600; }

/* ========================================
   19. COMPARISON/SPARK BARS
   ======================================== */

.comparison-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.comparison-row:last-child { border-bottom: none; margin-bottom: 0; }
.comparison-page { width: 120px; font-size: 11px; color: #1e293b; text-align: right; flex-shrink: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comparison-metrics { display: flex; gap: 12px; flex: 1; align-items: center; }
.spark-bar { display: flex; align-items: center; gap: 4px; flex: 1; }
.spark-label { width: 50px; font-size: 9px; color: #64748b; font-weight: 500; text-transform: uppercase; }
.spark-wrap { width: 120px; height: 20px; background: #f1f5f9; border-radius: 4px; overflow: hidden; position: relative; }
.spark { height: 100%; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; color: #fff; }

.spark.red {
  background: linear-gradient(180deg, #f87171, #dc2626);
}

.spark.green {
  background: linear-gradient(180deg, #4ade80, #22c55e);
}

/* ========================================
   20. MINI TABLE
   ======================================== */

.mini-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.mini-table thead th {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #94a3b8;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  background: #f8fafc;
}

.mini-table thead th.num { text-align: right; }

.mini-table tbody td {
  padding: 8px 12px;
  color: #475569;
  border-bottom: 1px solid #f1f5f9;
}

.mini-table tbody tr:hover {
  background: #f8fafc;
}

.mini-table td.num { text-align: right; font-weight: 600; }
.mini-table .url { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========================================
   21. AI TRAFFIC CHART STYLES
   ======================================== */

.daily-chart {
  position: relative;
  width: 100%;
  height: 280px;
  margin: 20px 0;
}

.chart-bar-col {
  position: absolute;
  bottom: 0;
  display: flex;
  flex-direction: column;
}

.chart-bar-stack {
  width: 100%;
  transition: all 0.2s ease;
  cursor: pointer;
}

.chart-date-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #94a3b8;
  white-space: nowrap;
}

.chart-y-axis {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 0;
}

.chart-y-label {
  font-size: 9px;
  color: #94a3b8;
  text-align: right;
  padding-right: 8px;
}

.chart-tooltip { position: fixed; background: #1e293b; color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 11px; z-index: 1000; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,0.2); max-width: 250px; }
.chart-tooltip .tt-date { font-weight: 700; margin-bottom: 4px; font-size: 12px; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 12px; padding: 1px 0; }
.chart-tooltip .tt-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; vertical-align: middle; }

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.share-bar-wrap { width: 100%; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.share-bar { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

#dailyChartCanvas { position: relative; width: 100% !important; height: 350px !important; }

/* ========================================
   22. GA4 OVERVIEW SPECIFIC
   ======================================== */

.summary-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.summary-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  flex: 1;
  min-width: 120px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-left: 3px solid #e2e8f0;
}

.summary-card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.summary-card .card-label,
.summary-card .s-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.summary-card .card-value,
.summary-card .s-value {
  font-size: 20px;
  font-weight: 800;
}

.summary-card .s-sub {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

.summary-card .s-delta {
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
}

.summary-card .s-delta.up {
  color: #72B155;
}

.summary-card .s-delta.down {
  color: #F75022;
}

.dash-switcher {
  display: flex;
  gap: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.dash-switcher a {
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: #64748b;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  transition: all 0.15s;
  white-space: nowrap;
}

.dash-switcher a:last-child {
  border-right: none;
}

.dash-switcher a:hover {
  background: #f8fafc;
  color: #1e293b;
}

.dash-switcher a.active {
  background: #2563eb;
  color: #fff;
}

.dash-btn {
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  color: #64748b;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.dash-btn:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.dash-btn.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

/* Controls bar */
.controls-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

#periodSelectWrap {
  position: relative;
  z-index: 51;
}

#periodSelectWrap .sd-panel {
  left: 0;
  right: auto;
}

.clients-table-wrap {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.clients-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1800px;
}

.clients-table thead th {
  text-align: left;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 20;
}

.clients-table thead th:hover {
  color: #1e293b;
}

.clients-table thead th[data-tip] {
  cursor: help;
}

.clients-table thead th.sorted {
  color: #1e293b;
}

.clients-table .col-sep {
  border-left: 2px solid #f1f5f9;
}

.clients-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}

.clients-table tbody tr:hover {
  background: #f8fafc;
}

.clients-table td {
  padding: 10px 10px;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 300;
  font-family: 'Manrope', system-ui, sans-serif;
}

/* Sticky first column */
.clients-table thead th:first-child,
.clients-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  border-right: 2px solid #e2e8f0;
}

.clients-table td:first-child {
  background: #fff;
}

.clients-table thead th:first-child {
  background: #f8fafc;
  z-index: 30;
}

.clients-table tbody tr:hover td:first-child {
  background: #f8fafc;
}

.client-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  min-width: 150px;
}

.client-favicon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  flex-shrink: 0;
  object-fit: contain;
  background: #f1f5f9;
}

.client-initial {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.client-info {
  min-width: 0;
}

.client-info a {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  text-decoration: none;
  display: block;
}

.client-info a:hover {
  color: #2563eb;
}

.client-info .domain {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 1px;
}

.client-info-name {
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-info-url {
  font-size: 11px;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delta {
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.delta.up {
  color: #72B155;
}

.delta.down {
  color: #F75022;
}

.delta.flat {
  color: #94a3b8;
}

.delta.negative {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.delta.neutral {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
}

.filter-toggle {
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.filter-toggle:hover {
  border-color: #94a3b8;
  color: #1e293b;
}

.filter-toggle.active {
  border-color: #F75022;
  color: #F75022;
  background: #fef2f2;
}

/* Declining row highlight — only active when highlight mode is enabled */
.highlight-declining .clients-table tbody tr.declining { background: #fef2f2; }
.highlight-declining .clients-table tbody tr.declining:hover { background: #fee2e2; }
.highlight-declining .clients-table tbody tr.declining td:first-child { background: #fef2f2; }
.highlight-declining .clients-table tbody tr.declining:hover td:first-child { background: #fee2e2; }

.pm-toggle-wrap, .col-toggle-wrap {
  position: relative;
  display: inline-block;
}

.pm-toggle-btn, .col-toggle-btn {
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.pm-toggle-btn:hover, .col-toggle-btn:hover {
  border-color: #94a3b8;
  color: #1e293b;
}

.pm-toggle-btn.active {
  border-color: #2563eb;
  color: #2563eb;
}

.pm-toggle-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 6px;
  z-index: 200;
  min-width: 240px;
  max-height: 340px;
  overflow-y: auto;
}

.pm-toggle-dropdown.open {
  display: block;
}

.col-toggle-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 12px;
  z-index: 200;
  min-width: 260px;
  max-height: 400px;
  overflow-y: auto;
}

.col-toggle-dropdown.open {
  display: block;
}

.pm-dropdown, .col-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 180px;
  margin-top: 6px;
  z-index: 200;
  display: none;
}

.pm-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 12px;
  color: #475569;
  border-radius: 6px;
}

.pm-option:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.pm-option.selected {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

.pm-dropdown-item, .col-dropdown-item {
  padding: 10px 16px;
  background: none;
  border: none;
  color: #1e293b;
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  width: 100%;
  transition: background 0.2s ease;
}

.pm-dropdown-item:hover, .col-dropdown-item:hover {
  background: #f8fafc;
}

.pm-dropdown-item.active, .col-dropdown-item.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

.col-toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
  font-size: 12px;
  color: #475569;
}

.col-toggle-item:hover {
  color: #1e293b;
}

.col-toggle-item input {
  accent-color: #2563eb;
}

.col-group-label {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 10px 0 6px;
}

.col-group-label:first-child {
  margin-top: 0;
}

.col-tip-floating {
  position: fixed;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  text-transform: none;
  letter-spacing: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.col-tip-floating.visible {
  opacity: 1;
}

.col-tip-floating::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
}

/* ========================================
   23. PRESENTATION MODE
   ======================================== */

body.presentation-mode .app-header {
  display: none;
}

body.presentation-mode .tabs {
  display: none;
}

body.presentation-mode .content {
  height: 100vh;
  padding-top: 32px;
}

body.presentation-mode .page-title {
  font-size: 32px;
}

body.presentation-mode .card-value {
  font-size: 36px;
}

body.presentation-mode .data-table {
  font-size: 13px;
}

body.presentation-mode .data-table thead th {
  font-size: 11px;
  padding: 14px;
}

body.presentation-mode .data-table tbody td {
  padding: 14px;
  font-size: 13px;
}

/* ========================================
   24. PRINT STYLES
   ======================================== */

@media print {
  .app-header, .tabs, .period-bar {
    display: none !important;
  }

  .content {
    height: auto !important;
    overflow: visible !important;
    padding: 20px !important;
  }

  .card, .panel {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #e2e8f0;
    page-break-inside: avoid;
  }

  .data-table {
    break-inside: avoid;
  }

  .trend-chart-wrap, .device-chart-wrap, .daily-chart {
    break-inside: avoid;
  }
}

/* ========================================
   25. RESPONSIVE DESIGN
   ======================================== */

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

  .trend-controls {
    width: 100%;
  }

  .comparison-metrics {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .app-header {
    padding: 12px 16px;
    height: 55px;
  }

  .tabs {
    top: 55px;
    padding: 0 16px;
    height: 60px;
  }

  .content {
    padding: 16px;
    height: calc(100vh - 115px);
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .panel {
    padding: 20px;
  }

  .panel-title {
    font-size: 14px;
    margin-bottom: 16px;
  }

  .page-title {
    font-size: 22px;
  }

  .card-value {
    font-size: 28px;
  }

  .trend-chart-wrap {
    height: 250px;
  }

  .device-chart-wrap {
    height: 220px;
  }

  .daily-chart {
    height: 220px;
  }

  .data-table {
    font-size: 11px;
  }

  .data-table thead th {
    font-size: 9px;
    padding: 8px;
  }

  .data-table tbody td {
    padding: 8px;
    font-size: 11px;
  }

  .trend-controls {
    flex-direction: column;
    width: 100%;
  }

  .range-wrap {
    width: 100%;
    min-width: auto;
  }

  .metric-toggles, .gran-toggles, .compare-toggles {
    width: 100%;
  }

  .h-bar-label {
    min-width: 80px;
    font-size: 11px;
  }

  .h-bar-row {
    flex-direction: column;
    gap: 8px;
  }

  .h-bar-wrap {
    width: 100%;
  }
}

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

  .summary-row {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 20px;
  }

  .card-value {
    font-size: 24px;
  }

  .tab-btn {
    padding: 10px 12px;
    font-size: 12px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    gap: 12px;
  }

  .header-left, .header-right {
    width: 100%;
  }

  .header-right {
    justify-content: flex-start;
  }

  .search-wrap {
    max-width: 100%;
  }
}

/* ========================================
   26. ANIMATION & TRANSITION UTILITIES
   ======================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.fade-in {
  animation: fadeIn 0.2s ease;
}

.slide-down {
  animation: slideDown 0.2s ease;
}

.slide-up {
  animation: slideUp 0.2s ease;
}

/* ========================================
   27. UTILITY CLASSES
   ======================================== */

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.no-wrap {
  white-space: nowrap;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: #94a3b8;
}

.text-bold {
  font-weight: 700;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.gap-24 {
  gap: 24px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.mb-32 {
  margin-bottom: 32px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mt-32 {
  margin-top: 32px;
}

.p-8 {
  padding: 8px;
}

.p-12 {
  padding: 12px;
}

.p-16 {
  padding: 16px;
}

.p-24 {
  padding: 24px;
}

.p-32 {
  padding: 32px;
}

.rounded-sm {
  border-radius: 4px;
}

.rounded {
  border-radius: 8px;
}

.rounded-lg {
  border-radius: 12px;
}

.rounded-xl {
  border-radius: 16px;
}

.shadow-sm {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.shadow {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.shadow-md {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.shadow-lg {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* ========================================
   28. PEEKABOO CITATION SHARED STYLES
   ======================================== */

/* ── Citation KPI Cards ── */
.cite-kpi-grid { display: grid; gap: 16px; margin-bottom: 28px; }
.cite-kpi-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cite-kpi-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
.cite-kpi-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; text-align: center; transition: box-shadow 0.2s; }
.cite-kpi-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.cite-kpi-val { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; color: #1e293b; }
.cite-kpi-val.green { color: #16a34a; }
.cite-kpi-val.red { color: #dc2626; }
.cite-kpi-val.blue { color: #2563eb; }
.cite-kpi-val.amber { color: #d97706; }
.cite-kpi-val.purple { color: #7c3aed; }
.cite-kpi-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; margin-top: 6px; font-weight: 600; }

/* ── Citation Filter Bar ── */
.cite-filter-bar { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.cite-filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cite-filter-row:last-child { margin-bottom: 0; }
.cite-filter-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; flex-shrink: 0; min-width: 68px; }
.cite-filter-pills { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.cite-pill { display: inline-flex; align-items: center; gap: 4px; padding: 5px 14px; border-radius: 20px; font-size: 11px; font-weight: 600; border: 1px solid #e2e8f0; background: #fff; color: #64748b; cursor: pointer; transition: all 0.15s; user-select: none; }
.cite-pill:hover { border-color: #cbd5e1; background: #f8fafc; }
.cite-pill.active { background: #1e293b; color: #fff; border-color: #1e293b; }
.cite-pill.brand-pill.active { background: #16a34a; border-color: #16a34a; }
.cite-pill.gap-pill { border-color: #7c3aed; color: #7c3aed; background: #faf5ff; }
.cite-pill.gap-pill:hover { background: #ede9fe; }
.cite-pill.gap-pill.active { background: #7c3aed; color: #fff; border-color: #7c3aed; }
.cite-filter-search { flex: 1; max-width: 420px; padding: 7px 14px; border-radius: 8px; border: 1px solid #e2e8f0; font-size: 12px; color: #1e293b; outline: none; font-family: inherit; }
.cite-filter-search:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.cite-filter-stats { font-size: 12px; color: #94a3b8; font-weight: 600; margin-left: auto; }
.cite-export-btn { padding: 7px 16px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; font-size: 11px; font-weight: 700; color: #64748b; cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; gap: 5px; }
.cite-export-btn:hover { background: #f8fafc; border-color: #cbd5e1; color: #1e293b; }

/* ── Citation Model Heatmap Cells ── */
.cite-model-heatmap { display: flex; gap: 2px; align-items: center; }
.cite-heat-cell { width: 20px; height: 20px; border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: default; }
.cite-heat-cell img { width: 14px; height: 14px; }
.cite-heat-cell.cited-high { background: rgba(37,99,235,0.2); }
.cite-heat-cell.cited-med { background: rgba(37,99,235,0.1); }
.cite-heat-cell.cited-low { background: rgba(37,99,235,0.05); }
.cite-heat-cell.not-cited { opacity: 0.15; filter: grayscale(1); }

/* ── Citation DA badge ── */
.cite-da { font-weight: 800; font-size: 13px; }
.cite-da.high { color: #16a34a; }
.cite-da.medium { color: #2563eb; }
.cite-da.low { color: #94a3b8; }

/* ── Citation Pagination ── */
.cite-pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 20px; padding: 12px 0; }
.cite-page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; font-size: 12px; font-weight: 600; color: #64748b; cursor: pointer; padding: 0 8px; transition: all 0.15s; }
.cite-page-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.cite-page-btn.active { background: #1e293b; color: #fff; border-color: #1e293b; }
.cite-page-btn.disabled { opacity: 0.4; pointer-events: none; }

/* ── Citation Loading ── */
.cite-loading { text-align: center; padding: 80px 40px; color: #94a3b8; font-size: 13px; }
.cite-spinner { width: 32px; height: 32px; border: 3px solid #e2e8f0; border-top: 3px solid #2563eb; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.cite-no-data { text-align: center; padding: 60px; color: #94a3b8; font-size: 14px; }

/* ── Citation Table Shared ── */
.cite-table-wrap { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.cite-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cite-table th { background: #f8fafc; padding: 10px 12px; text-align: left; font-weight: 700; color: #64748b; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid #e2e8f0; user-select: none; white-space: nowrap; }
.cite-table th[data-sort] { cursor: pointer; }
.cite-table th[data-sort]:hover { color: #1e293b; }
.cite-table th .sort-arrow { font-size: 9px; margin-left: 3px; opacity: 0.4; }
.cite-table th.sorted .sort-arrow { opacity: 1; color: #2563eb; }
.cite-table td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; color: #1e293b; }
.cite-table tr:hover td { background: #f8fafc; }
.cite-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Citation Tooltip ── */
[data-tip] { position: relative; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; font-size: 10px; padding: 4px 8px; border-radius: 4px; white-space: nowrap; pointer-events: none; z-index: 50; }

/* ── AI Citation Icon (for GA4/GSC pages) — matches serpstat sparkle style ── */
.ai-cite-icon { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; margin-left: 6px; cursor: pointer; vertical-align: middle; position: relative; }
.ai-cite-icon svg { flex-shrink: 0; filter: drop-shadow(0 0 4px rgba(124,58,237,0.45)); }
.ai-cite-lbl { font-size: 8px; font-weight: 700; color: #7c3aed; text-transform: uppercase; letter-spacing: 0.3px; line-height: 1; }
.ai-cite-icon:hover svg { filter: drop-shadow(0 0 6px rgba(124,58,237,0.7)); }
/* ── AI Citation Slide-in Drawer ── */
.ai-drawer-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.25); z-index: 999; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.ai-drawer-overlay.open { opacity: 1; pointer-events: auto; }
.ai-cite-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 90vw; background: #fff; z-index: 1000; box-shadow: -4px 0 24px rgba(0,0,0,0.12); transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1); overflow-y: auto; font-size: 12px; color: #1e293b; }
.ai-cite-drawer.open { transform: translateX(0); }
.acd-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; background: #fff; z-index: 1; }
.acd-header-left { display: flex; align-items: center; gap: 10px; }
.acd-title { font-weight: 700; font-size: 15px; color: #7c3aed; }
.acd-close { font-size: 22px; color: #94a3b8; cursor: pointer; line-height: 1; padding: 4px 6px; border-radius: 6px; transition: all 0.15s; }
.acd-close:hover { color: #1e293b; background: #f1f5f9; }
.acd-path { padding: 12px 20px; font-size: 12px; color: #64748b; background: #f8fafc; border-bottom: 1px solid #f1f5f9; font-family: monospace; word-break: break-all; }
.acd-stats { display: flex; gap: 0; border-bottom: 1px solid #e2e8f0; }
.acd-stat { flex: 1; text-align: center; padding: 14px 8px; border-right: 1px solid #f1f5f9; }
.acd-stat:last-child { border-right: none; }
.acd-stat-val { display: block; font-size: 20px; font-weight: 800; color: #7c3aed; }
.acd-stat-lbl { display: block; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; margin-top: 2px; }
.acd-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #94a3b8; padding: 16px 20px 8px; display: flex; align-items: center; gap: 8px; }
.acd-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px; border-radius: 9px; font-size: 10px; font-weight: 700; padding: 0 6px; background: #f3e8ff; color: #7c3aed; }
.acd-models { padding: 0 20px 8px; }
.acd-model-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: #faf5ff; border: 1px solid #ede9fe; margin-bottom: 6px; }
.acd-model-icon { width: 18px; height: 18px; border-radius: 4px; }
.acd-model-name { font-weight: 600; font-size: 12px; color: #6d28d9; flex: 1; }
.acd-model-refs { font-size: 11px; color: #94a3b8; font-weight: 500; }
.acd-queries { padding: 0 20px 20px; }
.acd-query { display: flex; gap: 10px; padding: 10px 12px; margin-bottom: 6px; background: #f8fafc; border-radius: 8px; border: 1px solid #f1f5f9; transition: background 0.15s; }
.acd-query:hover { background: #f1f5f9; }
.acd-query-num { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: #ede9fe; color: #7c3aed; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.acd-query-text { font-size: 12px; line-height: 1.5; color: #334155; }

/* ── Citation Section Header ── */
.cite-section-hdr { font-size: 15px; font-weight: 700; color: #1e293b; margin: 32px 0 16px; padding-bottom: 8px; border-bottom: 2px solid #e2e8f0; display: flex; align-items: center; gap: 8px; }
.cite-section-hdr .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ── Responsive ── */
@media (max-width: 1200px) { .cite-kpi-grid.cols-6 { grid-template-columns: repeat(3, 1fr); } .cite-kpi-grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .cite-table-wrap { overflow-x: auto; } }

/* ========================================
   END OF GA4 DASHBOARD CSS
   ======================================== */
