@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables / Design Tokens ──────────────────────── */

:root {
  /* Background */
  --bg-primary: #06060f;
  --bg-secondary: #0d0d1a;
  --bg-card: rgba(15, 15, 35, 0.7);
  --bg-card-hover: rgba(20, 20, 45, 0.85);
  --bg-input: rgba(15, 15, 35, 0.6);
  --bg-glass: rgba(255, 255, 255, 0.03);

  /* Accent Colors */
  --accent-primary: #7c3aed;
  --accent-primary-glow: rgba(124, 58, 237, 0.3);
  --accent-secondary: #3b82f6;
  --accent-secondary-glow: rgba(59, 130, 246, 0.3);
  --accent-gradient: linear-gradient(135deg, #7c3aed, #3b82f6);
  --accent-gradient-hover: linear-gradient(135deg, #8b5cf6, #60a5fa);

  /* Status */
  --color-danger: #ef4444;
  --color-danger-glow: rgba(239, 68, 68, 0.25);
  --color-warning: #f59e0b;
  --color-warning-glow: rgba(245, 158, 11, 0.25);
  --color-success: #10b981;
  --color-success-glow: rgba(16, 185, 129, 0.25);
  --color-gold: #fbbf24;

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #a78bfa;

  /* Border */
  --border-color: rgba(148, 163, 184, 0.08);
  --border-accent: rgba(124, 58, 237, 0.25);

  /* Misc */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ───────────────────────────────────────── */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(124, 58, 237, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
}

/* ─── Scrollbar ──────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

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

/* ─── Auth Page ──────────────────────────────────────────── */

.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  animation: fadeInUp 0.6s ease-out;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo h1 {
  font-size: 2rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 0.625rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
}

.auth-tab.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 8px var(--accent-primary-glow);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form.hidden {
  display: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input {
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 12px var(--accent-primary-glow);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 4px 20px var(--accent-primary-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 16px var(--color-danger-glow);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-accent);
  color: var(--text-accent);
}

.btn-outline:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--accent-primary);
}

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

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  display: none;
}

.auth-error.visible {
  display: block;
  animation: shake 0.4s ease-out;
}

/* ─── Dashboard Layout ───────────────────────────────────── */

.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(6, 6, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-brand .brand-icon {
  font-size: 1.5rem;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link {
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.1);
}

.nav-link.active {
  color: var(--text-accent);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border-color);
}

.nav-username {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ─── Stats Cards ────────────────────────────────────────── */

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.stat-card.deaths::before {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.stat-card.sales::before {
  background: linear-gradient(90deg, #10b981, #3b82f6);
}

.stat-card.players::before {
  background: var(--accent-gradient);
}

.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.stat-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.stat-value.danger {
  color: var(--color-danger);
}

.stat-value.success {
  color: var(--color-success);
}

.stat-value.accent {
  color: var(--text-accent);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ─── Section Panels ─────────────────────────────────────── */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: var(--transition);
}

.panel:hover {
  border-color: var(--border-accent);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-body {
  padding: 1rem 1.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.panel-full {
  grid-column: 1 / -1;
}

/* ─── Filter Controls ────────────────────────────────────── */

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-select {
  padding: 0.375rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.filter-select:focus {
  border-color: var(--accent-primary);
}

/* ─── Rankings Table ─────────────────────────────────────── */

.ranking-table {
  width: 100%;
  border-collapse: collapse;
}

.ranking-table th {
  text-align: left;
  padding: 0.75rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.ranking-table td {
  padding: 0.75rem 0.5rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.ranking-table tbody tr:hover td {
  background: var(--bg-glass);
}

.ranking-table tbody tr:last-child td {
  border-bottom: none;
}

.rank-number {
  font-weight: 700;
  width: 40px;
}

.rank-1 {
  color: var(--color-gold);
}

.rank-2 {
  color: #c0c0c0;
}

.rank-3 {
  color: #cd7f32;
}

.player-name {
  font-weight: 500;
}

.death-count {
  color: var(--color-danger);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sale-amount {
  color: var(--color-success);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sale-count {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ─── Alerts ─────────────────────────────────────────────── */

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-sm);
  animation: pulseAlert 3s ease-in-out infinite;
}

.alert-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.alert-text {
  flex: 1;
}

.alert-player {
  font-weight: 700;
  color: var(--color-danger);
}

.alert-detail {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  font-size: 0.875rem;
}

.no-data .no-data-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ─── Events Feed ────────────────────────────────────────── */

.event-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.event-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.event-item:last-child {
  border-bottom: none;
}

.event-item:hover {
  background: var(--bg-glass);
}

.event-icon {
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.event-icon.death {
  background: rgba(239, 68, 68, 0.1);
}

.event-icon.sale {
  background: rgba(16, 185, 129, 0.1);
}

.event-info {
  flex: 1;
}

.event-text {
  font-size: 0.875rem;
  font-weight: 500;
}

.event-text .player {
  color: var(--text-accent);
  font-weight: 600;
}

.event-text .amount {
  color: var(--color-success);
  font-weight: 700;
}

.event-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ─── Settings Page ──────────────────────────────────────── */

.settings-container {
  max-width: 700px;
  margin: 0 auto;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  backdrop-filter: blur(12px);
  margin-bottom: 1.5rem;
}

.settings-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Bot Status Badge */
.bot-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.bot-status.online {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--color-success);
}

.bot-status.offline {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: statusPulse 2s ease-in-out infinite;
}

.bot-status.online .status-dot {
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success-glow);
}

.bot-status.offline .status-dot {
  background: var(--color-danger);
  animation: none;
}

.status-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.bot-username {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Message toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 400px;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--color-success);
}

.toast.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-danger);
}

/* ─── Loading Skeleton ───────────────────────────────────── */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-input) 25%,
    rgba(148, 163, 184, 0.08) 50%,
    var(--bg-input) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-row {
  height: 40px;
  margin-bottom: 0.5rem;
}

/* ─── Animations ─────────────────────────────────────────── */

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulseAlert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* ─── Responsive ─────────────────────────────────────────── */

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

@media (max-width: 768px) {
  .navbar {
    padding: 0.875rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .navbar-links {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .nav-user {
    margin-left: auto;
    padding-left: 0;
    border-left: none;
  }

  .main-content {
    padding: 1rem;
  }

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

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .panel-body {
    padding: 0.75rem 1rem;
    max-height: 300px;
  }

  .auth-container {
    padding: 0 0.5rem;
  }

  .auth-card {
    padding: 1.5rem;
  }

  .settings-card {
    padding: 1.5rem;
  }
}

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