/* Analytics Widget Styles */

.analytics-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
}

.analytics-toggle {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.4);
  transition: all 0.3s ease;
}

.analytics-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(0, 255, 136, 0.6);
}

.analytics-toggle svg {
  width: 24px;
  height: 24px;
  color: #000000;
  fill: #000000;
}

.analytics-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid var(--bg-primary);
}

.analytics-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 360px;
  max-height: 80vh;
  background: var(--bg-primary);
  backdrop-filter: blur(20px);
  border: 2px solid var(--accent);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  overflow-y: auto;
  overflow-x: hidden;
  transform-origin: bottom right;
  transition: all 0.3s ease;
  opacity: 1;
  transform: scale(1);
  z-index: 99999;
}

.analytics-panel.hidden {
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

.analytics-header {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-primary);
}

.analytics-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
}

.analytics-close {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.analytics-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.analytics-stats {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.analytics-stat {
  background: var(--bg-primary);
  padding: 1rem;
  border-radius: 12px;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.stat-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.analytics-section {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.analytics-section:last-child {
  border-bottom: none;
}

.analytics-section h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.analytics-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.popular-page-item,
.location-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-primary);
  border-radius: 8px;
  font-size: 0.875rem;
}

.page-path,
.location-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-count,
.location-count {
  color: var(--accent);
  font-weight: 600;
  margin-left: 0.5rem;
}

.no-data {
  text-align: center;
  padding: 1rem;
  opacity: 0.5;
  font-size: 0.875rem;
}

/* Analytics notification */
.analytics-notification {
  position: fixed;
  bottom: 100px;
  right: 20px;
  background: var(--accent);
  color: var(--bg-primary);
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.4);
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 100000;
}

.analytics-notification.show {
  opacity: 1;
  transform: translateY(0);
}

/* Scrollbar styling */
.analytics-list::-webkit-scrollbar {
  width: 6px;
}

.analytics-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.analytics-list::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.analytics-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
  .analytics-panel {
    width: calc(100vw - 40px);
    max-width: 360px;
  }

  .analytics-widget {
    bottom: 80px;
  }

  .analytics-notification {
    bottom: 150px;
  }
}

/* CyberPunk theme - use dark bg for contrast against bright green button */
[data-theme="cyberpunk"] .analytics-toggle svg,
[data-theme=""] .analytics-toggle svg {
  color: var(--bg-primary);
  fill: var(--bg-primary);
}

/* Light theme adjustments */
[data-theme="light"] .analytics-toggle {
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

[data-theme="light"] .analytics-toggle:hover {
  box-shadow: 0 6px 30px rgba(16, 185, 129, 0.6);
}

[data-theme="light"] .analytics-panel {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .analytics-header,
[data-theme="light"] .analytics-section {
  border-bottom-color: rgba(0, 0, 0, 0.1);
}
