:root {
  --bg-primary: #0d1f3c;
  --bg-secondary: #0f2548;
  --bg-card: #132d56;
  --bg-hover: #1a3a6e;
  --accent: #2874b8;
  --accent-light: #4a9ad4;
  --accent-bright: #74bde0;
  --text-primary: #e8f4fd;
  --text-secondary: #a8cce8;
  --text-muted: #6a9ab8;
  --border: #1e3d6e;
  --success: #2ecc71;
  --warning: #f39c12;
  --danger: #e74c3c;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

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

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

a { color: var(--accent-light); text-decoration: none; }
a:hover { color: var(--accent-bright); }

/* ─── Navbar ──────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 64px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.navbar-brand .wave-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.navbar-links { display: flex; align-items: center; gap: 1.5rem; }
.navbar-links a { color: var(--text-secondary); font-size: 0.9rem; transition: color 0.2s; }
.navbar-links a:hover { color: var(--text-primary); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-light); color: white; }
.btn-secondary { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #27ae60; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; color: white; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

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

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

.form-control {
  width: 100%;
  padding: 9px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color 0.2s;
  outline: none;
}
.form-control:focus { border-color: var(--accent); }
.form-control option { background: var(--bg-secondary); }

/* ─── Toggle switch ───────────────────────────────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.toggle-wrap:last-child { border-bottom: none; }
.toggle-info { flex: 1; }
.toggle-info .toggle-name { font-size: 0.9rem; font-weight: 500; }
.toggle-info .toggle-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ─── Stat cards ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--accent-bright); }
.stat-card .stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ─── Sidebar layout ──────────────────────────────────────────────────────── */
.layout { display: flex; min-height: calc(100vh - 64px); }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.sidebar-section { margin-bottom: 1.5rem; }
.sidebar-label { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; padding: 0 8px; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-item.active { background: var(--accent); color: white; }
.sidebar-item .icon { width: 18px; text-align: center; flex-shrink: 0; }

/* ─── Main content ────────────────────────────────────────────────────────── */
.main { flex: 1; padding: 2rem; overflow-y: auto; }
.page-header { margin-bottom: 2rem; }
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }

/* ─── Tier badge ──────────────────────────────────────────────────────────── */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tier-free { background: var(--bg-hover); color: var(--text-muted); }
.tier-pro { background: #1a4a7a; color: var(--accent-bright); border: 1px solid var(--accent); }
.tier-enterprise { background: #3d1f6e; color: #c4a6f5; border: 1px solid #7c4dcc; }

/* ─── Guild grid ──────────────────────────────────────────────────────────── */
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }

.guild-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.guild-card:hover { border-color: var(--accent); background: var(--bg-hover); transform: translateY(-2px); }
.guild-card.no-bot { opacity: 0.6; }

.guild-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  overflow: hidden;
}
.guild-icon img { width: 100%; height: 100%; object-fit: cover; }
.guild-name { font-size: 0.95rem; font-weight: 600; }

/* ─── Leaderboard table ───────────────────────────────────────────────────── */
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.lb-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tr:hover td { background: var(--bg-hover); }

.lb-rank { font-weight: 700; color: var(--text-muted); width: 40px; }
.lb-rank.gold { color: #f1c40f; }
.lb-rank.silver { color: #bdc3c7; }
.lb-rank.bronze { color: #e67e22; }

.lb-user { display: flex; align-items: center; gap: 10px; }
.lb-avatar { width: 32px; height: 32px; border-radius: 50%; }
.lb-username { font-weight: 500; }

/* ─── Toast notifications ─────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  min-width: 240px;
}
.toast.success { background: var(--success); color: white; }
.toast.error { background: var(--danger); color: white; }
.toast.info { background: var(--accent); color: white; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Pricing cards ───────────────────────────────────────────────────────── */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; max-width: 900px; margin: 0 auto; }
.pricing-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; text-align: center; }
.pricing-card.featured { border-color: var(--accent); position: relative; }
.pricing-card.featured::before { content: 'Most Popular'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: white; font-size: 0.75rem; font-weight: 600; padding: 3px 14px; border-radius: 20px; }
.pricing-tier { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.pricing-price { font-size: 2.5rem; font-weight: 800; color: var(--accent-bright); }
.pricing-price span { font-size: 1rem; color: var(--text-muted); font-weight: 400; }
.pricing-features { list-style: none; margin: 1.5rem 0; text-align: left; }
.pricing-features li { padding: 6px 0; font-size: 0.9rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.pricing-features li::before { content: '✓'; color: var(--accent-light); font-weight: 700; flex-shrink: 0; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { padding: 1rem; }
  .navbar { padding: 0 1rem; }
  .guild-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
