/* ============================================
   ANALYTICS DASHBOARD STYLES
   ============================================ */

.analytics-section {
  min-height: 100vh;
  padding: 120px 0 80px;
}

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

.section-subtitle {
  color: var(--text-muted, #6b7280);
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

.header-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-actions .btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Warning Card */
.warning-card {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  box-shadow: 0 4px 6px rgba(245, 158, 11, 0.1);
}

.warning-icon {
  font-size: 2rem;
  line-height: 1;
}

.warning-card h3 {
  margin: 0 0 0.5rem 0;
  color: #92400e;
}

.warning-card p {
  margin: 0;
  color: #78350f;
}

.warning-card a {
  color: #92400e;
  font-weight: 600;
  text-decoration: underline;
}

/* Date Range Card */
.date-range-card {
  margin-bottom: 2rem;
}

.date-range-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: end;
}

.quick-ranges {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.date-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--card-bg, #fff);
  color: var(--text-primary, #111827);
  transition: all 0.3s ease;
}

.date-input:focus {
  outline: none;
  border-color: var(--primary-color, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

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

.metric-card {
  background: linear-gradient(135deg, var(--card-bg, #fff) 0%, var(--card-bg-alt, #f9fafb) 100%);
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.metric-card:hover::before {
  transform: scaleX(1);
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color, #6366f1);
}

.metric-icon {
  font-size: 2.5rem;
  line-height: 1;
  filter: grayscale(0.3);
  transition: filter 0.3s ease;
}

.metric-card:hover .metric-icon {
  filter: grayscale(0);
}

.metric-content {
  flex: 1;
}

.metric-label {
  font-size: 0.875rem;
  color: var(--text-muted, #6b7280);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
  line-height: 1.2;
}

.metric-change {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.metric-change.positive {
  color: #10b981;
}

.metric-change.negative {
  color: #ef4444;
}

.metric-change.neutral {
  color: var(--text-muted, #6b7280);
}

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

.chart-card {
  min-height: 400px;
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.chart-controls {
  display: flex;
  gap: 0.5rem;
}

.chart-type-select {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  background: var(--card-bg, #fff);
  color: var(--text-primary, #111827);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chart-type-select:focus {
  outline: none;
  border-color: var(--primary-color, #6366f1);
}

.chart-card canvas {
  max-height: 350px;
}

/* Table Card */
.table-card {
  margin-bottom: 2rem;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
}

.data-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
  background-color: var(--card-bg-alt, #f9fafb);
}

.data-table td {
  padding: 1rem;
  color: var(--text-primary, #111827);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.modal-content {
  background: var(--card-bg, #fff);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 2px solid var(--border-color, #e5e7eb);
}

.modal-header h3 {
  margin: 0;
  color: var(--text-primary, #111827);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--card-bg-alt, #f9fafb);
  color: var(--text-primary, #111827);
}

.modal-body {
  padding: 1.5rem;
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.export-option {
  justify-content: center;
  gap: 0.75rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .analytics-header {
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
  }

  .date-range-controls {
    grid-template-columns: 1fr;
  }

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

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

  .chart-card {
    min-height: 300px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .warning-card {
    background: linear-gradient(135deg, #78350f 0%, #92400e 100%);
    border-color: #f59e0b;
  }

  .warning-card h3,
  .warning-card p {
    color: #fef3c7;
  }

  .warning-card a {
    color: #fde68a;
  }

  .metric-card {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  }

  .data-table thead {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  }
}

/* Loading State */
.chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted, #6b7280);
  font-size: 1rem;
}

.chart-loading::after {
  content: '...';
  animation: ellipsis 1.5s infinite;
}

@keyframes ellipsis {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted, #6b7280);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary, #111827);
}

.empty-state p {
  margin: 0;
}

/* Pulse Animation for Live Indicator */
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
  100% { transform: scale(0.95); opacity: 1; }
}
