/* Analytics Page Styles */
.analytics-page {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Analytics Header */
.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 1rem;
}

.header-left {
  flex: 1;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.breadcrumb-link {
  color: #00ccff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.3s ease;
}

.breadcrumb-link:hover {
  color: #00ff88;
}

.breadcrumb i.fa-chevron-right {
  color: #666666;
  font-size: 0.7rem;
}

.breadcrumb-current {
  color: #cccccc;
}

.analytics-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #00ff88, #00ccff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.node-info {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.node-detail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #cccccc;
  font-size: 0.9rem;
}

.node-detail i {
  color: #00ccff;
  width: 16px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.current-status {
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.last-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #888888;
  font-size: 0.85rem;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 255, 136, 0.1);
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.metric-icon.uptime {
  background: rgba(0, 255, 136, 0.2);
  color: #00ff88;
}

.metric-icon.response {
  background: rgba(0, 204, 255, 0.2);
  color: #00ccff;
}

.metric-icon.block {
  background: rgba(255, 170, 0, 0.2);
  color: #ffaa00;
}

.metric-icon.peers {
  background: rgba(138, 43, 226, 0.2);
  color: #8a2be2;
}

.metric-title {
  font-size: 0.9rem;
  color: #cccccc;
  font-weight: 500;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.metric-subtitle {
  font-size: 0.8rem;
  color: #888888;
  margin-bottom: 0.5rem;
}

.metric-trend {
  font-size: 0.85rem;
  font-weight: 500;
}

.metric-trend.positive {
  color: #00ff88;
}

.metric-trend.negative {
  color: #ff4444;
}

.metric-trend.neutral {
  color: #cccccc;
}

/* Time Range Selector */
.time-range-selector {
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.selector-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #00ccff;
  font-size: 1.1rem;
}

.auto-refresh-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: 0.4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #00ff88;
}

input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

.time-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.time-btn {
  padding: 0.75rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #cccccc;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.time-btn.active,
.time-btn:hover {
  background: rgba(0, 255, 136, 0.2);
  border-color: #00ff88;
  color: #00ff88;
}

/* Charts Section */
.charts-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.chart-container {
  padding: 1.5rem;
}

.chart-container.full-width {
  grid-column: 1 / -1;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.chart-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #00ccff;
  font-size: 1.1rem;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chart-btn {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #cccccc;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.chart-wrapper {
  height: 300px;
  margin-bottom: 1rem;
  position: relative;
}

.chart-stats {
  display: flex;
  justify-content: space-around;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  color: #888888;
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
}

.stat-value.success {
  color: #00ff88;
}

.stat-value.error {
  color: #ff4444;
}

/* Heatmap */
.heatmap-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #cccccc;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.legend-color.excellent {
  background: #00ff88;
}

.legend-color.good {
  background: #00ccff;
}

.legend-color.fair {
  background: #ffaa00;
}

.legend-color.poor {
  background: #ff4444;
}

.legend-color.offline {
  background: #666666;
}

.heatmap-wrapper {
  overflow-x: auto;
}

.heatmap-container {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 2px;
  min-width: 600px;
  padding: 1rem;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.heatmap-cell:hover {
  transform: scale(1.1);
  z-index: 10;
}

.heatmap-cell.excellent {
  background: #00ff88;
}

.heatmap-cell.good {
  background: #00ccff;
}

.heatmap-cell.fair {
  background: #ffaa00;
}

.heatmap-cell.poor {
  background: #ff4444;
}

.heatmap-cell.offline {
  background: #666666;
}

/* Detailed Statistics */
.detailed-stats {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.stats-section,
.events-section {
  padding: 1.5rem;
}

.stats-header,
.events-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.stats-header h3,
.events-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #00ccff;
  font-size: 1.1rem;
}

.stats-period {
  color: #888888;
  font-size: 0.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.stats-group h4 {
  color: #00ff88;
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stats-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.stats-label {
  color: #cccccc;
  font-size: 0.9rem;
}

.stats-value {
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Events Section */
.events-filter select {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
}

.events-filter select option {
  background: #000000;
  color: #ffffff;
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.event-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.event-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.event-icon.error {
  background: rgba(255, 68, 68, 0.2);
  color: #ff4444;
}

.event-icon.warning {
  background: rgba(255, 170, 0, 0.2);
  color: #ffaa00;
}

.event-icon.info {
  background: rgba(0, 204, 255, 0.2);
  color: #00ccff;
}

.event-icon.success {
  background: rgba(0, 255, 136, 0.2);
  color: #00ff88;
}

.event-content {
  flex: 1;
}

.event-text {
  font-size: 0.9rem;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.event-time {
  font-size: 0.8rem;
  color: #888888;
}

/* Export Modal */
.export-options {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .detailed-stats {
    grid-template-columns: 1fr;
  }

  .charts-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .analytics-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    align-items: flex-start;
    width: 100%;
  }

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

  .node-info {
    flex-direction: column;
    gap: 0.5rem;
  }

  .time-buttons {
    justify-content: center;
  }

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

  .heatmap-legend {
    justify-content: center;
  }
}

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

  .export-options {
    flex-direction: column;
  }
}
