* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #0a0f2e 0%, #1a0a2e 50%, #2d1b4e 100%);
  color: #ffffff;
  min-height: 100vh;
  overflow-x: hidden;
}

.dashboard {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem;
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.user-selector-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-bottom: 3rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  flex-wrap: wrap;
}

.user-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-selector label {
  font-size: 0.875rem;
  color: #9ca3af;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.user-dropdown {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 200px;
}

.user-dropdown:hover,
.user-dropdown:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(59, 130, 246, 0.5);
  outline: none;
}

.user-dropdown option {
  background: #1a0a2e;
  color: #ffffff;
  padding: 0.5rem;
}

.user-info {
  text-align: center;
}

.current-user {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.user-role {
  font-size: 0.875rem;
  color: #9ca3af;
  opacity: 0.8;
}

.header h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  background: linear-gradient(135deg, #3b82f6, #dc2626, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

.header p {
  font-size: 1.1rem;
  color: #9ca3af;
  opacity: 0.8;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2rem;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 60px rgba(59, 130, 246, 0.2);
  border-color: rgba(255, 255, 255, 0.2);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient);
  border-radius: 20px 20px 0 0;
}

.stat-card.revenue::before {
  --gradient: linear-gradient(90deg, #3b82f6, #1e40af);
}

.stat-card.users::before {
  --gradient: linear-gradient(90deg, #2563eb, #dc2626);
}

.stat-card.conversion::before {
  --gradient: linear-gradient(90deg, #dc2626, #7c2d12);
}

.stat-card.engagement::before {
  --gradient: linear-gradient(90deg, #8b5cf6, #581c87);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.stat-title {
  font-size: 0.875rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff, #e5e7eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-change {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.change-positive {
  color: #3b82f6;
}

.change-negative {
  color: #dc2626;
}

.change-neutral {
  color: #8b5cf6;
}

.charts-section {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 2.5rem;
  margin-top: 2rem;
}

.charts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.charts-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
}

.charts-subtitle {
  font-size: 0.875rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

.time-selector {
  display: flex;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.time-btn {
  background: none;
  border: none;
  color: #9ca3af;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.875rem;
  font-weight: 500;
}

.time-btn.active,
.time-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  color: #ffffff;
}

.chart-container {
  position: relative;
  height: 400px;
  margin-top: 1rem;
}

.api-indicator {
  position: fixed;
  top: 2rem;
  right: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.875rem;
  backdrop-filter: blur(10px);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #3b82f6;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.last-updated {
  color: #6b7280;
  font-size: 0.75rem;
  text-align: center;
  margin-top: 2rem;
  opacity: 0.7;
}

@media (max-width: 768px) {
  .dashboard {
    padding: 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .stat-card {
    padding: 1.5rem;
  }

  .charts-section {
    padding: 1.5rem;
  }

  .api-indicator {
    position: relative;
    top: auto;
    right: auto;
    margin-bottom: 2rem;
  }
}
