/**
 * Admin Analytics Dashboard Styles
 * Enhanced visual analytics with animations, charts, and modern UI
 */

/* ========================================
   HEADER ACTIONS
   ======================================== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ========================================
   GENERATE REPORT BUTTON
   ======================================== */
.generate-report-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--admin-accent, #ff6b2b), #ff8f5a);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(255, 107, 43, 0.3);
}

.generate-report-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(255, 107, 43, 0.4);
}

.generate-report-btn:active {
  transform: translateY(0);
}

.generate-report-btn i {
  font-size: 14px;
}

/* ========================================
   REAL-TIME INDICATOR
   ======================================== */
.realtime-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 20px;
  font-size: 13px;
}

.realtime-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.realtime-number {
  font-weight: 700;
  color: #22c55e;
  font-size: 16px;
}

.realtime-label {
  color: var(--admin-text-muted);
}

.realtime-count.active .realtime-dot {
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* ========================================
   STATS GRID VARIANTS
   ======================================== */
.stats-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .stats-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stats-grid--4 {
    grid-template-columns: 1fr;
  }
}

/* Animated stat cards */
.stat-card--animated {
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card--animated:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(255, 107, 43, 0.15);
}

.stat-card--animated .stat-value {
  transition: color 0.3s;
}

/* Small stat cards */
.stat-card--small {
  padding: 16px;
}

.stat-card--small .stat-icon {
  width: 40px;
  height: 40px;
  font-size: 16px;
  margin-bottom: 8px;
}

.stat-card--small .stat-value {
  font-size: 24px;
}

.stat-card--small .stat-label {
  font-size: 11px;
}

/* Sparkline in stat card */
.stat-sparkline {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 60px;
  height: 24px;
  opacity: 0.5;
}

.stat-sparkline .sparkline {
  width: 100%;
  height: 100%;
}

.stat-card {
  position: relative;
}

/* ========================================
   ANALYTICS GRID LAYOUTS
   ======================================== */
.analytics-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .analytics-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   TRAFFIC CHART (Bar Chart)
   ======================================== */
.chart-container {
  padding: 16px 0;
}

.traffic-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
  height: 180px;
  padding: 0 8px 32px;
}

.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  position: relative;
  min-width: 20px;
  max-width: 60px;
}

.bar-fill {
  width: 100%;
  height: var(--height, 0%);
  background: linear-gradient(to top, var(--admin-accent), rgba(255, 107, 43, 0.4));
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease-out, background 0.2s;
  margin-top: auto;
}

.chart-bar:hover .bar-fill {
  background: linear-gradient(to top, var(--admin-accent), rgba(255, 107, 43, 0.7));
}

.bar-value {
  position: absolute;
  top: -20px;
  font-size: 10px;
  font-weight: 600;
  color: var(--admin-text);
  opacity: 0;
  transition: opacity 0.2s;
}

.chart-bar:hover .bar-value {
  opacity: 1;
}

.bar-label {
  position: absolute;
  bottom: -24px;
  font-size: 9px;
  color: var(--admin-text-muted);
  white-space: nowrap;
  transform: rotate(-45deg);
  transform-origin: top left;
}

/* ========================================
   DONUT CHART
   ======================================== */
.donut-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
}

.donut-chart {
  position: relative;
  width: 160px;
  height: 160px;
  margin-bottom: 16px;
}

.donut-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
}

.donut-ring::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  background: var(--admin-panel);
  border-radius: 50%;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1;
}

.donut-total {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--admin-text);
}

.donut-label {
  font-size: 11px;
  color: var(--admin-text-muted);
  text-transform: uppercase;
}

.donut-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  max-width: 280px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-label {
  color: var(--admin-text-secondary);
}

.legend-value {
  color: var(--admin-text-muted);
  font-weight: 600;
}

.chart-empty {
  padding: 40px;
  text-align: center;
  color: var(--admin-text-muted);
}

/* ========================================
   SOURCES LIST
   ======================================== */
.sources-list {
  margin-top: 16px;
  border-top: 1px solid var(--admin-line);
  padding-top: 16px;
}

.sources-list .analytics-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--admin-line);
}

.sources-list .analytics-row:last-child {
  border-bottom: none;
}

.sources-list .path {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--admin-text-secondary);
  font-size: 13px;
}

.sources-list .path i {
  width: 16px;
  color: var(--admin-text-muted);
}

.sources-list .count {
  font-weight: 600;
  color: var(--admin-text);
}

/* ========================================
   DEVICE & BROWSER BREAKDOWN
   ======================================== */
.breakdown-section {
  margin-bottom: 20px;
}

.breakdown-section:last-child {
  margin-bottom: 0;
}

.breakdown-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.device-grid {
  display: flex;
  gap: 16px;
}

.device-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  text-align: center;
}

.device-stat i {
  font-size: 24px;
  color: var(--admin-accent);
  margin-bottom: 8px;
}

.device-label {
  font-size: 11px;
  color: var(--admin-text-muted);
  text-transform: capitalize;
  margin-bottom: 4px;
}

.device-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--admin-text);
}

.browser-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.browser-stat {
  display: flex;
  align-items: center;
  gap: 12px;
}

.browser-name {
  width: 70px;
  font-size: 12px;
  color: var(--admin-text-secondary);
}

.browser-bar {
  flex: 1;
  height: 8px;
  background: var(--admin-card);
  border-radius: 4px;
  overflow: hidden;
}

.browser-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--admin-accent), rgba(255, 107, 43, 0.5));
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.browser-value {
  width: 40px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
}

/* ========================================
   PANEL BADGE
   ======================================== */
.panel-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  background: rgba(255, 107, 43, 0.1);
  color: var(--admin-accent);
  border-radius: 4px;
}

/* Panel icon colors */
.panel-icon--red { color: #ef4444; margin-right: 8px; }

/* ========================================
   COMPACT LIST (Landing/Exit Pages)
   ======================================== */
.compact-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compact-list .analytics-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--admin-card);
  border-radius: 6px;
  transition: background 0.2s;
}

.compact-list .analytics-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.compact-list .path {
  font-size: 13px;
  color: var(--admin-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.compact-list .count {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
}

.empty-small {
  padding: 24px;
  text-align: center;
  color: var(--admin-text-muted);
  font-size: 13px;
}

/* ========================================
   PAGES LIST (Top Pages with Progress)
   ======================================== */
.pages-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pages-list .analytics-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--admin-line);
}

.pages-list .analytics-row:last-child {
  border-bottom: none;
}

.pages-list .row-main {
  flex: 1;
  min-width: 0;
}

.pages-list .path {
  display: block;
  font-size: 14px;
  color: var(--admin-text-secondary);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar {
  height: 6px;
  background: var(--admin-card);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--admin-accent), rgba(255, 107, 43, 0.4));
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

.pages-list .count {
  font-size: 16px;
  font-weight: 700;
  color: var(--admin-text);
  min-width: 60px;
  text-align: right;
}

/* ========================================
   CLICKS LIST
   ======================================== */
.clicks-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clicks-list .analytics-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--admin-line);
}

.clicks-list .analytics-row:last-child {
  border-bottom: none;
}

.clicks-list .path {
  font-size: 13px;
  color: var(--admin-text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 16px;
}

.clicks-list .count {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  min-width: 50px;
  text-align: right;
}

/* ========================================
   LOADING ANIMATIONS
   ======================================== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.loading-shimmer {
  background: linear-gradient(
    90deg,
    var(--admin-card) 25%,
    rgba(255, 255, 255, 0.05) 50%,
    var(--admin-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ========================================
   COUNTER ANIMATION
   ======================================== */
.stat-value {
  font-variant-numeric: tabular-nums;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 768px) {
  .header-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }
  
  .realtime-badge {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .traffic-chart {
    height: 140px;
    padding-bottom: 40px;
  }
  
  .bar-label {
    font-size: 8px;
  }
  
  .donut-chart {
    width: 120px;
    height: 120px;
  }
  
  .donut-total {
    font-size: 18px;
  }
  
  .device-grid {
    flex-wrap: wrap;
  }
  
  .device-stat {
    min-width: calc(50% - 8px);
  }
}

@media (max-width: 480px) {
  .analytics-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .analytics-select {
    width: 100%;
  }
  
  .compact-list .path {
    max-width: 150px;
  }
}

/* ========================================
   CRM SALES FUNNEL
   ======================================== */
.crm-funnel-container {
  padding: 24px 16px;
}

.crm-funnel {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-height: 160px;
}

.funnel-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.funnel-bar-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  min-height: 100px;
}

.funnel-bar {
  width: 100%;
  max-width: 80px;
  background: linear-gradient(to top, var(--funnel-color, var(--admin-accent)), rgba(255, 107, 43, 0.3));
  border-radius: 6px 6px 0 0;
  transition: height 0.5s ease-out, transform 0.2s;
  position: relative;
}

.funnel-stage:hover .funnel-bar {
  transform: scaleY(1.02);
}

.funnel-count {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: 700;
  color: var(--admin-text);
}

.funnel-label {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: center;
}

.funnel-conversion {
  font-size: 10px;
  color: var(--admin-text-muted);
  margin-top: 4px;
}

.funnel-conversion.positive {
  color: #22c55e;
}

/* Funnel stage colors */
.funnel-stage[data-phase="P0"] .funnel-bar { --funnel-color: #6b7280; }
.funnel-stage[data-phase="P1"] .funnel-bar { --funnel-color: #3b82f6; }
.funnel-stage[data-phase="P2"] .funnel-bar { --funnel-color: #8b5cf6; }
.funnel-stage[data-phase="P3"] .funnel-bar { --funnel-color: #f59e0b; }
.funnel-stage[data-phase="P4"] .funnel-bar { --funnel-color: #22c55e; }
.funnel-stage[data-phase="P5"] .funnel-bar { --funnel-color: #ff6b2b; }

/* Arrow between stages */
.funnel-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-text-muted);
  font-size: 12px;
  padding: 0 4px;
  opacity: 0.5;
}

/* ========================================
   CRM STAT CARDS
   ======================================== */
.stat-card--crm {
  border-left: 3px solid var(--admin-accent);
}

.stat-icon--orange {
  background: rgba(255, 107, 43, 0.15);
  color: #ff6b2b;
}

.stat-icon--red {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.stat-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--admin-text-muted);
  margin-left: 2px;
}

/* ========================================
   PANEL LINK
   ======================================== */
.panel-link {
  font-size: 12px;
  color: var(--admin-accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.panel-link:hover {
  color: #ff8f5a;
}

.panel-link i {
  font-size: 10px;
}

/* ========================================
   BROWSER DETAILS (Collapsible)
   ======================================== */
.browser-details {
  margin-top: 16px;
  border-top: 1px solid var(--admin-line);
  padding-top: 12px;
}

.browser-summary {
  font-size: 12px;
  color: var(--admin-text-muted);
  cursor: pointer;
  padding: 8px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.browser-summary::-webkit-details-marker {
  display: none;
}

.browser-summary::before {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 10px;
  transition: transform 0.2s;
}

.browser-details[open] .browser-summary::before {
  transform: rotate(180deg);
}

.browser-details .browser-list {
  margin-top: 12px;
}

/* ========================================
   FUNNEL RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .crm-funnel {
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .funnel-stage {
    flex: 0 0 calc(33.333% - 12px);
    min-width: 80px;
  }
  
  .funnel-arrow {
    display: none;
  }
  
  .funnel-bar {
    max-width: 60px;
  }
}

@media (max-width: 480px) {
  .funnel-stage {
    flex: 0 0 calc(50% - 8px);
  }
}

/* ========================================
   LEADERBOARD LIST
   ======================================== */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--admin-card);
  border-radius: 8px;
  transition: background 0.2s;
}

.leaderboard-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.leaderboard-rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  background: var(--admin-line);
  color: var(--admin-text-muted);
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
  background: linear-gradient(135deg, #ffd700, #ffb700);
  color: #1a1a1a;
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  color: #1a1a1a;
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
  background: linear-gradient(135deg, #cd7f32, #b87333);
  color: #1a1a1a;
}

.leaderboard-name {
  flex: 1;
  font-size: 14px;
  color: var(--admin-text);
  font-weight: 500;
}

.leaderboard-count {
  font-size: 16px;
  font-weight: 700;
  color: var(--admin-accent);
}

.leaderboard-bar {
  width: 60px;
  height: 6px;
  background: var(--admin-card);
  border-radius: 3px;
  overflow: hidden;
}

.leaderboard-bar-fill {
  height: 100%;
  background: var(--admin-accent);
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

/* ========================================
   COMPANY TYPES CHART
   ======================================== */
.company-types-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}

.company-type-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.company-type-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 14px;
  background: rgba(255, 107, 43, 0.15);
  color: var(--admin-accent);
}

.company-type-info {
  flex: 1;
  min-width: 0;
}

.company-type-name {
  font-size: 13px;
  color: var(--admin-text);
  margin-bottom: 4px;
}

.company-type-bar {
  height: 6px;
  background: var(--admin-card);
  border-radius: 3px;
  overflow: hidden;
}

.company-type-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

.company-type-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  min-width: 40px;
  text-align: right;
}

/* ========================================
   MONTH STATS
   ======================================== */
.month-stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0;
}

.month-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--admin-card);
  border-radius: 8px;
  border-left: 3px solid var(--admin-accent);
}

.month-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--admin-text);
}

.month-stat-label {
  font-size: 12px;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========================================
   PANEL ICON COLORS
   ======================================== */
.panel-icon--yellow { color: #f59e0b; margin-right: 8px; }
.panel-icon--purple { color: #8b5cf6; margin-right: 8px; }

/* ========================================
   ANALYTICS CONTROLS LAYOUT
   ======================================== */
.analytics-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.analytics-controls-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ========================================
   PAGE SELECTOR
   ======================================== */
.page-selector-container {
  display: flex;
  align-items: center;
}

.page-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-selector-label {
  font-size: 13px;
  color: var(--admin-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.page-selector-label i {
  color: var(--admin-accent);
}

.page-selector {
  padding: 8px 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  color: var(--admin-text);
  font-size: 13px;
  min-width: 200px;
  max-width: 300px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.page-selector:hover {
  border-color: var(--admin-accent);
}

.page-selector:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 43, 0.15);
}

.page-selector option {
  background: var(--admin-panel);
  color: var(--admin-text);
}

/* ========================================
   CLICKABLE ANALYTICS ROWS
   ======================================== */
.analytics-row--clickable {
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  border-left: 3px solid transparent;
  padding-left: 12px !important;
  margin-left: -12px;
}

.analytics-row--clickable:hover {
  background: rgba(255, 107, 43, 0.05);
  border-left-color: var(--admin-accent);
}

.analytics-row--selected {
  background: rgba(255, 107, 43, 0.1) !important;
  border-left-color: var(--admin-accent) !important;
}

.row-detail-btn {
  background: transparent;
  border: none;
  color: var(--admin-text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  transition: all 0.2s;
  opacity: 0;
}

.analytics-row--clickable:hover .row-detail-btn {
  opacity: 1;
}

.row-detail-btn:hover {
  background: var(--admin-accent);
  color: white;
}

/* ========================================
   PAGE DETAIL PANEL
   ======================================== */
.page-detail-panel {
  background: linear-gradient(135deg, var(--admin-panel), rgba(255, 107, 43, 0.03));
  border: 1px solid var(--admin-accent);
  border-radius: 12px;
  padding: 24px;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--admin-line);
}

.page-detail-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--admin-text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.page-detail-title i {
  color: var(--admin-accent);
}

/* Page KPIs Grid */
.page-detail-kpis {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.page-kpi {
  background: var(--admin-card);
  border-radius: 8px;
  padding: 16px 12px;
  text-align: center;
  border: 1px solid var(--admin-line);
  transition: transform 0.2s, box-shadow 0.2s;
}

.page-kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.page-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--admin-text);
  margin-bottom: 4px;
}

.page-kpi-label {
  font-size: 10px;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Page Detail Sections */
.page-detail-section {
  background: var(--admin-card);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--admin-line);
}

.page-detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-detail-section-title i {
  color: var(--admin-accent);
  font-size: 12px;
}

.page-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.page-detail-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--admin-line);
}

.page-detail-row:last-child {
  border-bottom: none;
}

.page-detail-label {
  font-size: 12px;
  color: var(--admin-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-detail-label i {
  width: 14px;
  color: var(--admin-text-muted);
}

.page-detail-label--truncate {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-detail-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
}

/* Page Traffic Chart */
.page-traffic-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
  height: 120px;
  padding: 0 8px 28px;
}

/* ========================================
   PAGE DETAIL RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
  .page-detail-kpis {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .page-detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .page-detail-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .page-detail-grid {
    grid-template-columns: 1fr;
  }
  
  .page-selector {
    min-width: 150px;
    max-width: 200px;
  }
  
  .analytics-controls-left {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .page-detail-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .page-kpi {
    padding: 12px 8px;
  }
  
  .page-kpi-value {
    font-size: 18px;
  }
  
  .page-selector-label {
    display: none;
  }
}

/* ========================================
   ANALYTICS TABS
   ======================================== */
.analytics-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--admin-card);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--admin-line);
}

.analytics-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--admin-text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.analytics-tab:hover {
  color: var(--admin-text);
  background: rgba(255, 255, 255, 0.05);
}

.analytics-tab--active {
  background: var(--admin-accent);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 107, 43, 0.3);
}

.analytics-tab--active:hover {
  background: var(--admin-accent);
  color: white;
}

.analytics-tab i {
  font-size: 16px;
}

/* Tab Content */
.analytics-tab-content {
  display: none;
}

.analytics-tab-content--active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Page Selector Bar */
.page-selector-bar {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
}

/* ========================================
   EXPANDABLE PAGE ROWS
   ======================================== */
.pages-list--expandable {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.page-row {
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.page-row:hover {
  border-color: rgba(255, 107, 43, 0.3);
}

.page-row--expanded {
  border-color: var(--admin-accent);
  box-shadow: 0 4px 16px rgba(255, 107, 43, 0.1);
}

.page-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.page-row-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.page-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.page-row-toggle {
  background: transparent;
  border: none;
  color: var(--admin-text-muted);
  cursor: pointer;
  padding: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.page-row--expanded .page-row-toggle {
  color: var(--admin-accent);
}

.page-row-path {
  font-size: 14px;
  color: var(--admin-text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-row-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-row-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--admin-text-muted);
  white-space: nowrap;
}

.page-row-stat i {
  font-size: 11px;
  color: var(--admin-text-muted);
}

/* Page Row Details (expanded content) */
.page-row-details {
  padding: 16px;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid var(--admin-line);
  animation: slideDown 0.2s ease;
}

.page-detail-grid--compact {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.page-detail-card {
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 14px;
}

.page-detail-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-detail-card-title i {
  color: var(--admin-accent);
  font-size: 11px;
}

/* Quick Stats Grid */
.quick-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-stat {
  text-align: center;
  padding: 8px 4px;
  background: var(--admin-card);
  border-radius: 6px;
}

.quick-stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--admin-text);
}

.quick-stat-label {
  font-size: 10px;
  color: var(--admin-text-muted);
  text-transform: uppercase;
}

/* CTA List */
.cta-list, .next-page-list, .source-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cta-item, .next-page-item, .source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--admin-line);
}

.cta-item:last-child, .next-page-item:last-child, .source-item:last-child {
  border-bottom: none;
}

.cta-name, .next-page-path {
  font-size: 12px;
  color: var(--admin-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

.cta-count, .next-page-count, .source-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-accent);
}

.source-name {
  font-size: 12px;
  color: var(--admin-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.source-name i {
  color: var(--admin-text-muted);
  width: 14px;
}

/* ========================================
   USER FLOW ANALYSIS
   ======================================== */
.user-flow-container {
  padding: 16px 0;
}

.user-flow-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.flow-section {
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 16px;
}

.flow-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-section-title i {
  color: var(--admin-accent);
}

.flow-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--admin-panel);
  border-radius: 6px;
  transition: background 0.2s;
}

.flow-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.flow-item--dropoff {
  border-left: 3px solid #ef4444;
}

.flow-path {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.flow-from, .flow-to, .flow-page {
  font-size: 13px;
  color: var(--admin-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-arrow {
  color: var(--admin-accent);
  font-size: 12px;
  flex-shrink: 0;
}

.flow-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
  white-space: nowrap;
  margin-left: 12px;
}

.flow-count--red {
  color: #ef4444;
}

/* Session Stats */
.session-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  padding: 20px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
}

.session-stat {
  text-align: center;
}

.session-stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--admin-text);
}

.session-stat-label {
  font-size: 12px;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS FOR NEW COMPONENTS
   ======================================== */
@media (max-width: 1024px) {
  .page-detail-grid--compact {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .user-flow-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .analytics-tabs {
    flex-direction: column;
  }
  
  .analytics-tab {
    justify-content: flex-start;
    padding: 14px 16px;
  }
  
  .page-row-stats {
    display: none;
  }
  
  .page-detail-grid--compact {
    grid-template-columns: 1fr;
  }
  
  .session-stats {
    flex-wrap: wrap;
    gap: 16px;
  }
  
  .session-stat {
    flex: 1 1 30%;
    min-width: 80px;
  }
}

@media (max-width: 480px) {
  .quick-stats-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  
  .quick-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    padding: 8px 12px;
  }
}

/* ========================================
   CAMPAIGN & SOCIAL ANALYTICS TAB
   ======================================== */

/* Campaign Header */
.campaign-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(255, 107, 43, 0.1), rgba(255, 107, 43, 0.05));
  border: 1px solid rgba(255, 107, 43, 0.2);
  border-radius: 12px;
}

.campaign-header-info h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--admin-text);
}

.campaign-header-info h2 i {
  color: var(--admin-accent);
  margin-right: 8px;
}

.campaign-header-info code {
  background: rgba(255, 107, 43, 0.15);
  color: var(--admin-accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 14px;
}

.campaign-url {
  margin: 0;
  font-size: 13px;
  color: var(--admin-text-muted);
}

/* Campaign stat cards */
.stat-card--campaign {
  border-left: 3px solid var(--admin-accent);
}

/* CTA Performance List */
.cta-performance-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cta-perf-item {
  padding: 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
}

.cta-perf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cta-perf-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13px;
  color: var(--admin-text);
}

.cta-perf-name i {
  font-size: 14px;
}

.cta-icon--green { color: #22c55e; }
.cta-icon--orange { color: #ff6b2b; }
.cta-icon--blue { color: #3b82f6; }
.cta-icon--purple { color: #a855f7; }
.cta-icon--cyan { color: #06b6d4; }
.cta-icon--gray { color: #6b7280; }

.cta-perf-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cta-perf-count {
  font-weight: 700;
  font-size: 16px;
  color: var(--admin-text);
}

.cta-perf-rate {
  font-size: 12px;
  color: var(--admin-text-muted);
  background: var(--admin-bg);
  padding: 2px 8px;
  border-radius: 4px;
}

.cta-perf-bar {
  height: 6px;
  background: var(--admin-line);
  border-radius: 3px;
  overflow: hidden;
}

.cta-perf-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.cta-bar--green { background: linear-gradient(90deg, #22c55e, #4ade80); }
.cta-bar--orange { background: linear-gradient(90deg, #ff6b2b, #ff8f5a); }
.cta-bar--blue { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.cta-bar--purple { background: linear-gradient(90deg, #a855f7, #c084fc); }
.cta-bar--cyan { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
.cta-bar--gray { background: linear-gradient(90deg, #6b7280, #9ca3af); }

/* Scroll Funnel */
.scroll-funnel-visual {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.funnel-step {
  position: relative;
}

.funnel-step-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(255, 107, 43, 0.15), rgba(255, 107, 43, 0.05));
  border-radius: 6px;
  transition: width 0.5s ease;
}

.funnel-step--first .funnel-step-bar {
  background: linear-gradient(90deg, rgba(255, 107, 43, 0.25), rgba(255, 107, 43, 0.1));
}

.funnel-step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--admin-text);
}

.funnel-step-value {
  font-size: 12px;
  color: var(--admin-text-muted);
}

/* Device Breakdown Grid */
.device-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.device-card {
  text-align: center;
  padding: 20px 16px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.device-card:hover {
  border-color: var(--admin-accent);
  transform: translateY(-2px);
}

.device-icon {
  font-size: 28px;
  color: var(--admin-accent);
  margin-bottom: 12px;
}

.device-pct {
  font-size: 28px;
  font-weight: 700;
  color: var(--admin-text);
}

.device-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--admin-text);
  text-transform: capitalize;
  margin-bottom: 4px;
}

.device-count {
  font-size: 11px;
  color: var(--admin-text-muted);
}

/* User Journey */
.journey-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 20px;
}

.journey-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.journey-section-title i {
  color: var(--admin-accent);
}

.journey-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.journey-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 6px;
}

.journey-action,
.journey-page {
  font-size: 13px;
  color: var(--admin-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.journey-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-accent);
  background: rgba(255, 107, 43, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

.journey-summary {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 16px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
}

.journey-stat {
  text-align: center;
}

.journey-stat-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--admin-accent);
}

.journey-stat-label {
  font-size: 11px;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Feature Clicks Grid */
.feature-clicks-grid-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.feature-click-card {
  text-align: center;
  padding: 16px 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  opacity: 0.6;
  transition: all 0.2s ease;
}

.feature-click-card--active {
  opacity: 1;
  border-color: var(--admin-accent);
  background: rgba(255, 107, 43, 0.05);
}

.feature-click-card:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.feature-click-icon {
  font-size: 24px;
  color: var(--admin-accent);
  margin-bottom: 8px;
}

.feature-click-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--admin-text);
  margin-bottom: 4px;
}

.feature-click-count {
  font-size: 11px;
  color: var(--admin-text-muted);
}

.feature-note {
  text-align: center;
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-top: 12px;
  font-style: italic;
}

/* Activity Feed */
.activity-feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  transition: background 0.2s ease;
}

.activity-item:hover {
  background: var(--admin-bg);
}

.activity-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  flex-shrink: 0;
}

.activity-icon--blue {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.activity-icon--green {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.activity-icon--red {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.activity-icon--gray {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-main {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.activity-action {
  font-size: 13px;
  font-weight: 500;
  color: var(--admin-text);
}

.activity-detail {
  font-size: 12px;
  color: var(--admin-accent);
  background: rgba(255, 107, 43, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.activity-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--admin-text-muted);
}

.activity-source {
  display: flex;
  align-items: center;
  gap: 4px;
}

.activity-time {
  opacity: 0.7;
}

/* Campaign Responsive */
@media (max-width: 1024px) {
  .feature-clicks-grid-inner {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .journey-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .campaign-header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .device-breakdown-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .journey-summary {
    flex-wrap: wrap;
    gap: 20px;
  }
  
  .journey-stat {
    flex: 1 1 30%;
    min-width: 80px;
  }
}

@media (max-width: 480px) {
  .feature-clicks-grid-inner {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  
  .feature-click-card {
    padding: 12px 8px;
  }
  
  .feature-click-icon {
    font-size: 20px;
  }
  
  .feature-click-name {
    font-size: 11px;
  }
}
