/* ============================================
   Bot Fly Panel — Premium Design System v2.0
   FLYNEURO AI — Ultra-smooth & Responsive
   ============================================ */

/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Primary */
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-light: #ede9fe;
  --primary-mid: #a78bfa;
  --primary-shadow: rgba(124, 58, 237, 0.35);
  --primary-glow: rgba(124, 58, 237, 0.12);

  /* Accent */
  --accent-green: #10b981;
  --accent-green-light: #d1fae5;
  --accent-red: #ef4444;
  --accent-red-light: #fee2e2;
  --accent-yellow: #f59e0b;
  --accent-yellow-light: #fef3c7;
  --accent-blue: #3b82f6;
  --accent-blue-light: #dbeafe;

  /* Light theme */
  --bg: #f1f5f9;
  --bg-secondary: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-xl: 0 12px 40px rgba(0,0,0,0.12);

  /* Sidebar */
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #7c3aed;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-width: 260px;

  /* Layout */
  --header-height: 68px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 200ms ease;
  --transition-slow: 400ms ease;
  --spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   Dark Theme
   ============================================ */
[data-theme="dark"] {
  --bg: #0c1222;
  --bg-secondary: #111827;
  --surface: #1e293b;
  --surface-hover: #263044;
  --border: #334155;
  --border-light: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.35);
  --shadow-xl: 0 12px 40px rgba(0,0,0,0.4);
  --primary-light: rgba(124,58,237,0.15);
  --accent-green-light: rgba(16,185,129,0.15);
  --accent-red-light: rgba(239,68,68,0.15);
  --accent-yellow-light: rgba(245,158,11,0.15);
  --accent-blue-light: rgba(59,130,246,0.15);
  --sidebar-bg: #0a0f1e;
}

/* ============================================
   PAGE LOADER
   ============================================ */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 0.5s,
              transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.05);
  pointer-events: none;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.loader-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), #4c1d95);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  animation: loaderPulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 30px var(--primary-shadow);
}

.loader-logo svg {
  width: 28px;
  height: 28px;
}

@keyframes loaderPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px var(--primary-shadow); }
  50% { transform: scale(1.08); box-shadow: 0 0 40px var(--primary-shadow); }
}

.loader-bar {
  width: 160px;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.loader-bar-fill {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, var(--primary), var(--primary-mid));
  border-radius: 3px;
  animation: loaderSlide 1.2s ease-in-out infinite;
}

@keyframes loaderSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

.loader-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 10% 20%, rgba(124, 58, 237, 0.03) 0%, transparent 40%), 
              radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.02) 0%, transparent 40%),
              var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

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

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  height: auto;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
}

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

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

@keyframes bellShake {
  0% { transform: rotate(0); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-14deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-6deg); }
  75% { transform: rotate(2deg); }
  100% { transform: rotate(0); }
}

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

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

/* Animate-in classes */
.animate-in {
  animation: slideUp 0.5s var(--smooth) both;
}

.animate-fade {
  animation: fadeIn 0.4s ease both;
}

.animate-scale {
  animation: scaleIn 0.4s var(--smooth) both;
}

/* Scroll-triggered animation (via JS) */
.scroll-animate {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--smooth), transform 0.6s var(--smooth);
}

.scroll-animate.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children animation */
.stagger-in > * {
  animation: slideUp 0.5s var(--smooth) both;
}

.stagger-in > *:nth-child(1) { animation-delay: 0ms; }
.stagger-in > *:nth-child(2) { animation-delay: 60ms; }
.stagger-in > *:nth-child(3) { animation-delay: 120ms; }
.stagger-in > *:nth-child(4) { animation-delay: 180ms; }
.stagger-in > *:nth-child(5) { animation-delay: 240ms; }
.stagger-in > *:nth-child(6) { animation-delay: 300ms; }
.stagger-in > *:nth-child(7) { animation-delay: 360ms; }
.stagger-in > *:nth-child(8) { animation-delay: 420ms; }

/* ============================================
   AUTH LAYOUT (Login / Register)
   ============================================ */
.auth-layout {
  display: flex;
  min-height: 100vh;
}

.auth-aside {
  display: none;
  width: 45%;
  background: linear-gradient(135deg, var(--primary) 0%, #4c1d95 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  flex-direction: column;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .auth-aside { display: flex; }
}

.auth-aside::before {
  content: '';
  position: absolute;
  bottom: -60px;
  right: -60px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  animation: float 6s ease-in-out infinite;
}

.auth-aside::after {
  content: '';
  position: absolute;
  top: -40px;
  right: 60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  animation: float 8s ease-in-out infinite reverse;
}

.auth-aside .brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-aside .brand svg {
  width: 32px;
  height: 32px;
}

.auth-aside-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-aside-content h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.auth-aside-content p {
  color: rgba(255,255,255,0.75);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

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

.auth-feature {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  opacity: 0;
  animation: slideInLeft 0.5s var(--smooth) both;
}

.auth-feature:nth-child(1) { animation-delay: 0.3s; }
.auth-feature:nth-child(2) { animation-delay: 0.45s; }
.auth-feature:nth-child(3) { animation-delay: 0.6s; }

.auth-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: transform var(--transition), background var(--transition);
}

.auth-feature:hover .auth-feature-icon {
  transform: scale(1.1);
  background: rgba(255,255,255,0.25);
}

.auth-feature-icon svg {
  width: 18px;
  height: 18px;
}

.auth-feature span {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  font-weight: 500;
}

.auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  position: relative;
  background: var(--surface);
}

.auth-theme-toggle {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--smooth);
}

.auth-theme-toggle:hover {
  color: var(--primary);
  border-color: var(--primary-mid);
  transform: rotate(30deg);
}

.auth-theme-toggle svg {
  width: 16px;
  height: 16px;
}

.auth-back-btn {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  height: 38px;
  padding: 0 1rem;
  border-radius: 19px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--smooth);
  text-decoration: none;
}

.auth-back-btn:hover {
  color: var(--primary);
  border-color: var(--primary-mid);
  background: var(--surface-hover);
  transform: translateX(-2px);
}

.auth-back-btn svg {
  width: 16px;
  height: 16px;
}

.auth-form-wrap {
  width: 100%;
  max-width: 420px;
}

.auth-form-wrap h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.375rem;
}

.auth-form-wrap .auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.auth-form-wrap .auth-subtitle a {
  font-weight: 600;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s var(--smooth);
}

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

.form-input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  transform: translateY(-1px);
}

.form-input-icon {
  position: relative;
}

.form-input-icon .form-input {
  padding-right: 3rem;
}

.form-input-icon .toggle-password {
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.form-input-icon .toggle-password:hover {
  color: var(--primary);
}

.form-input-icon .toggle-password svg {
  width: 18px;
  height: 18px;
}

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

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-link {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Select */
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s var(--smooth);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2.5rem;
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Textarea */
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  resize: vertical;
  min-height: 100px;
  transition: all 0.3s var(--smooth);
}

.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  position: relative;
  overflow: hidden;
}

.btn svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition);
}

.btn:hover svg {
  transform: scale(1.1);
}

.btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

.btn:active:not(:disabled) {
  transform: scale(0.96) !important;
  transition-duration: 0.1s;
}

/* Ripple effect */
.btn .btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-shadow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #5b21b6);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-shadow);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--primary-mid);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red), #dc2626);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,0.35);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239,68,68,0.35);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-green), #059669);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.35);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem;
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--primary);
}

.btn-full {
  width: 100%;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* ============================================
   LAYOUT — Sidebar + Main
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1.5rem 1.5rem 1.25rem;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  transition: opacity var(--transition);
}

.sidebar-brand:hover {
  opacity: 0.9;
}

.sidebar-brand svg {
  width: 28px;
  height: 28px;
  color: var(--primary-mid);
  transition: transform var(--smooth);
}

.sidebar-brand:hover svg {
  transform: rotate(-10deg) scale(1.1);
}

.sidebar-brand span {
  background: linear-gradient(135deg, #fff 0%, var(--primary-mid) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0.75rem;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s var(--smooth);
  position: relative;
  margin-bottom: 2px;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.3s var(--smooth);
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
  transform: translateX(4px);
}

.sidebar-link:hover svg {
  transform: scale(1.1);
}

.sidebar-link.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-shadow);
  transform: translateX(0);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: #fff;
  border-radius: 0 4px 4px 0;
}

.sidebar-link .badge {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.sidebar-link.active .badge {
  background: rgba(255,255,255,0.25);
}

.sidebar-footer {
  padding: 1rem 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.3s var(--smooth);
  cursor: pointer;
}

.sidebar-user:hover {
  background: var(--sidebar-hover);
  transform: translateX(2px);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.sidebar-user:hover .sidebar-avatar {
  transform: scale(1.05);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-plan {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plan-basic { color: var(--text-muted); }
.plan-nitro { color: var(--accent-yellow); }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.4s var(--smooth);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.4s var(--smooth);
}

/* Header / Topbar */
.topbar {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(255,255,255,0.85);
  transition: box-shadow 0.3s ease;
}

.topbar.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

[data-theme="dark"] .topbar {
  background: rgba(30,41,59,0.85);
}

[data-theme="dark"] .topbar.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--smooth);
}

.topbar-menu-btn:hover {
  color: var(--primary);
  border-color: var(--primary-mid);
}

.topbar-menu-btn:active {
  transform: scale(0.92);
}

.topbar-menu-btn svg {
  width: 18px;
  height: 18px;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.3s var(--smooth);
  position: relative;
}

.topbar-btn:hover {
  background: var(--bg-secondary);
  color: var(--primary);
  transform: scale(1.05);
}

.topbar-btn:active {
  transform: scale(0.92);
}

.topbar-btn svg {
  width: 18px;
  height: 18px;
}

.topbar-btn .notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 2px solid var(--surface);
  animation: dotPulse 2s ease-in-out infinite;
}

/* Bell animation on hover */
.topbar-btn:hover .notification-dot {
  animation: none;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem;
  padding-right: 0.75rem;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s var(--smooth);
}

.topbar-user:hover {
  border-color: var(--primary-mid);
  box-shadow: 0 0 0 3px var(--primary-glow);
  transform: translateY(-1px);
}

.topbar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  transition: transform var(--transition);
}

.topbar-user:hover .topbar-user-avatar {
  transform: scale(1.1);
}

.topbar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
  flex: 1;
  padding: 1.75rem;
}

.page-header {
  margin-bottom: 1.75rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.page-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Welcome Banner */
.welcome-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, rgba(124,58,237,0.05) 100%);
  border: 1px solid rgba(124,58,237,0.12);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  animation: slideUp 0.5s var(--smooth) both;
}

[data-theme="dark"] .welcome-banner {
  background: linear-gradient(135deg, rgba(124,58,237,0.12) 0%, rgba(124,58,237,0.03) 100%);
}

.welcome-banner-icon {
  font-size: 2rem;
  line-height: 1;
  animation: float 3s ease-in-out infinite;
}

.welcome-banner h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.welcome-banner p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* ============================================
   CARDS — Premium Glassmorphism
   ============================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  position: relative;
}

[data-theme="dark"] .card {
  background: rgba(30, 41, 59, 0.7);
  box-shadow: 0 4px 25px -5px rgba(0, 0, 0, 0.3);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px -10px rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.2);
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

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

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================
   STATS GRID — Enhanced
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
}

[data-theme="dark"] .stat-card {
  background: rgba(30, 41, 59, 0.65);
}

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

.stat-card:nth-child(1)::before { background: linear-gradient(90deg, var(--primary), var(--primary-mid)); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, var(--accent-green), #34d399); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, var(--accent-blue), #60a5fa); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, var(--accent-yellow), #fbbf24); }

.stat-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px -10px rgba(124, 58, 237, 0.18);
  border-color: rgba(124, 58, 237, 0.2);
}

.stat-card:hover::before {
  height: 4px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.4s var(--spring);
}

.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(-5deg);
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-icon.purple { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--accent-green-light); color: var(--accent-green); }
.stat-icon.blue { background: var(--accent-blue-light); color: var(--accent-blue); }
.stat-icon.yellow { background: var(--accent-yellow-light); color: var(--accent-yellow); }
.stat-icon.red { background: var(--accent-red-light); color: var(--accent-red); }

.stat-info {
  flex: 1;
}

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

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.125rem;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  margin-top: 0.375rem;
  display: inline-block;
}

.stat-change.up { background: var(--accent-green-light); color: var(--accent-green); }
.stat-change.down { background: var(--accent-red-light); color: var(--accent-red); }

/* ============================================
   BOT STATUS CARD — Enhanced
   ============================================ */
.bot-status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  transition: all 0.4s var(--smooth);
  position: relative;
  overflow: hidden;
}

.bot-status-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
  transition: background 0.3s ease;
}

.bot-status-card.status-online::before {
  background: linear-gradient(180deg, var(--accent-green), #34d399);
}

.bot-status-card.status-offline::before {
  background: linear-gradient(180deg, var(--accent-red), #f87171);
}

.bot-status-card:hover {
  box-shadow: 0 12px 30px -8px rgba(0,0,0,0.1);
}

.bot-status-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bot-status-indicator {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.3s var(--smooth);
}

.bot-status-card:hover .bot-status-indicator {
  transform: scale(1.05);
}

.bot-status-indicator.online {
  background: var(--accent-green-light);
  color: var(--accent-green);
}

.bot-status-indicator.offline {
  background: var(--accent-red-light);
  color: var(--accent-red);
}

.bot-status-indicator svg {
  width: 22px;
  height: 22px;
}

.status-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.status-pulse.online {
  background: var(--accent-green);
  animation: pulse 2s ease-in-out infinite;
}

.status-pulse.offline {
  background: var(--accent-red);
}

.bot-status-info h3 {
  font-size: 1rem;
  font-weight: 700;
}

.bot-status-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.bot-status-text .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot.online { background: var(--accent-green); }
.dot.offline { background: var(--accent-red); }

.bot-status-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ============================================
   PLAN CARD — Animated Gradient
   ============================================ */
.plan-card {
  background: linear-gradient(135deg, var(--primary) 0%, #4c1d95 50%, var(--primary) 100%);
  background-size: 200% 200%;
  animation: gradientShift 6s ease infinite;
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: transform 0.4s var(--smooth), box-shadow 0.4s var(--smooth);
}

.plan-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -10px var(--primary-shadow);
}

.plan-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  animation: float 6s ease-in-out infinite;
}

.plan-card::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 30%;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  animation: float 8s ease-in-out infinite reverse;
}

.plan-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.plan-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
  transition: transform var(--transition);
}

.plan-card:hover .plan-badge {
  transform: scale(1.05);
}

.plan-card-body {
  position: relative;
  z-index: 1;
}

.plan-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.plan-stat {
  text-align: center;
}

.plan-stat-value {
  font-size: 1.25rem;
  font-weight: 800;
}

.plan-stat-label {
  font-size: 0.75rem;
  opacity: 0.75;
  margin-top: 0.125rem;
}

/* Progress bar — Enhanced with shimmer */
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 1rem;
}

.progress-bar .progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: #fff;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.progress-bar .progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmer 2s infinite;
  background-size: 200% 100%;
}

.progress-label {
  font-size: 0.75rem;
  opacity: 0.75;
  margin-top: 0.375rem;
  text-align: right;
}

/* ============================================
   CONTENT GRID
   ============================================ */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.content-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ============================================
   TABLE — Premium Enhanced
   ============================================ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

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

.data-table td {
  font-size: 0.875rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: all 0.3s var(--smooth);
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

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

/* User Table — Admin Panel */
.user-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-top: 1.5rem;
  transition: all 0.4s var(--smooth);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
}

.user-table-wrap:hover {
  box-shadow: 0 12px 30px -8px rgba(0,0,0,0.1);
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.user-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 700;
  text-align: left;
  padding: 1rem 1.25rem;
  border-bottom: 1.5px solid var(--border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-table td {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.user-table tr {
  transition: all 0.3s var(--smooth);
}

.user-table tbody tr:hover {
  background: var(--surface-hover);
}

.user-table tbody tr:hover td {
  color: var(--text-primary);
}

.ip-badge {
  font-size: 0.72rem;
  background: var(--border-light);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-weight: 600;
  transition: all var(--transition);
}

.user-table tbody tr:hover .ip-badge {
  background: var(--primary-light);
  color: var(--primary);
}

/* Inline Editor Panel */
.inline-editor {
  background: var(--bg-secondary);
  border-left: 4px solid var(--primary);
  display: none;
}

.inline-editor.active {
  display: table-row;
  animation: slideDown 0.3s var(--smooth) both;
}

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  display: inline-block;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.3s var(--smooth);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: all 0.3s var(--spring);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

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

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  transition: transform var(--transition);
}

.badge:hover {
  transform: scale(1.05);
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--accent-green-light); color: var(--accent-green); }
.badge-danger { background: var(--accent-red-light); color: var(--accent-red); }
.badge-warning { background: var(--accent-yellow-light); color: var(--accent-yellow); }
.badge-info { background: var(--accent-blue-light); color: var(--accent-blue); }

.category-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ============================================
   MODALS — Enhanced with spring animation
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
  animation: fadeIn 0.25s ease both;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px -15px rgba(0,0,0,0.25);
  animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.3s var(--smooth);
}

.modal-close:hover {
  background: var(--accent-red-light);
  color: var(--accent-red);
  transform: rotate(90deg);
}

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ============================================
   ALERT / FLASH MESSAGE — Enhanced
   ============================================ */
.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
  animation: slideDown 0.4s var(--smooth) both;
  transition: all 0.3s ease;
}

.alert svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.alert-success {
  background: var(--accent-green-light);
  color: var(--accent-green);
  border: 1px solid rgba(16,185,129,0.2);
}

.alert-error {
  background: var(--accent-red-light);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.2);
}

.alert-warning {
  background: var(--accent-yellow-light);
  color: var(--accent-yellow);
  border: 1px solid rgba(245,158,11,0.2);
}

.alert-info {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
  border: 1px solid rgba(59,130,246,0.2);
}

/* ============================================
   QR CODE AREA
   ============================================ */
.qr-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  min-height: 250px;
}

.qr-placeholder {
  width: 200px;
  height: 200px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 1rem;
  background: var(--bg-secondary);
  transition: all 0.3s var(--smooth);
}

.qr-placeholder:hover {
  border-color: var(--primary-mid);
}

.qr-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.qr-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* ============================================
   ACTIVITY LIST — Enhanced Timeline
   ============================================ */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border-light);
  transition: all 0.3s var(--smooth);
}

.activity-item:hover {
  background: var(--surface-hover);
  margin: 0 -1.75rem;
  padding: 0.875rem 1.75rem;
  border-radius: var(--radius-sm);
}

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

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.activity-item:hover .activity-icon {
  transform: scale(1.1);
}

.activity-icon svg {
  width: 14px;
  height: 14px;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  opacity: 0.3;
  margin-bottom: 1rem;
  animation: float 4s ease-in-out infinite;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 300px;
  margin-bottom: 1.25rem;
}

/* ============================================
   SETTINGS FORM
   ============================================ */
.settings-section {
  margin-bottom: 2rem;
}

.settings-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.settings-section p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
  transition: all 0.3s var(--smooth);
}

.settings-row:hover {
  background: var(--surface-hover);
  margin: 0 -1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-info {
  flex: 1;
}

.settings-row-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.settings-row-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* ============================================
   SEARCH BAR
   ============================================ */
.search-bar {
  position: relative;
  max-width: 320px;
}

.search-bar input {
  width: 100%;
  padding: 0.625rem 1rem 0.625rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s var(--smooth);
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  max-width: 100%;
}

.search-bar svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* Search Bar Container (admin) */
.search-bar-container {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 480px;
}

.search-bar-container .form-input {
  transition: all 0.3s var(--smooth);
}

.search-bar-container .form-input:focus {
  box-shadow: 0 0 0 4px var(--primary-glow);
  transform: none;
}

/* ============================================
   TOOLBAR
   ============================================ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25rem;
}

.filter-tab {
  padding: 0.375rem 0.875rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s var(--smooth);
}

.filter-tab:hover {
  color: var(--text-primary);
}

.filter-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: scale(1.02);
}

/* ============================================
   CHART CONTAINER
   ============================================ */
.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* ============================================
   TOAST — Enhanced with timer bar
   ============================================ */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 280px;
  max-width: 420px;
  box-shadow: 0 12px 30px -8px rgba(0,0,0,0.15);
  animation: slideInRight 0.4s var(--smooth) both;
  position: relative;
  overflow: hidden;
}

.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255,255,255,0.3);
  animation: toastTimer 3s linear forwards;
}

@keyframes toastTimer {
  from { width: 100%; }
  to { width: 0%; }
}

.toast.removing {
  animation: slideOutRight 0.3s var(--smooth) both;
}

@keyframes slideOutRight {
  to { opacity: 0; transform: translateX(100%); }
}

/* ============================================
   QUICK ACTION CARDS
   ============================================ */
.quick-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s var(--smooth);
}

.quick-action:hover {
  border-color: var(--primary-mid);
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -5px var(--primary-glow);
}

.quick-action:active {
  transform: scale(0.97);
}

.quick-action-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.3s var(--spring);
}

.quick-action:hover .quick-action-icon {
  transform: scale(1.1) rotate(-5deg);
}

.quick-action-icon svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   TABLE RESPONSIVE
   ============================================ */
.table-responsive {
  position: relative;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-xl);
}

/* ============================================
   UTILITIES
   ============================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ============================================
   RESPONSIVE — Mobile First, Smooth
   ============================================ */
@media (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0,0,0,0.3);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .topbar-menu-btn {
    display: flex;
  }
  
  .topbar {
    padding: 0 1rem;
  }
  
  .page-content {
    padding: 1.25rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  
  .content-grid,
  .content-grid-3 {
    grid-template-columns: 1fr;
  }
  
  .bot-status-card {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .bot-status-right {
    width: 100%;
  }

  .bot-status-right .btn {
    flex: 1;
  }
  
  .plan-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .topbar-user-name {
    display: none;
  }

  /* Buttons touch-friendly */
  .btn {
    min-height: 44px;
    font-size: 0.9rem;
    padding: 0.75rem 1.25rem;
  }

  .btn-sm {
    min-height: 38px;
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
  }

  /* Card adjustments */
  .card {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
  }

  .card:hover {
    transform: none;
  }

  /* Stat card mobile */
  .stat-card {
    padding: 1.15rem;
    gap: 0.75rem;
    border-radius: var(--radius-lg);
  }

  .stat-card:hover {
    transform: none;
  }

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

  .stat-icon {
    width: 42px;
    height: 42px;
  }

  .stat-icon svg {
    width: 18px;
    height: 18px;
  }

  /* Quick actions */
  .quick-action-grid {
    grid-template-columns: 1fr;
  }

  /* User table → card-like */
  .user-table-wrap {
    border-radius: var(--radius-lg);
  }

  .user-table td {
    padding: 0.9rem 0.75rem;
    font-size: 0.8rem;
  }

  .user-table th {
    padding: 0.75rem 0.75rem;
    font-size: 0.72rem;
  }

  /* Activity list */
  .activity-item:hover {
    margin: 0 -1.25rem;
    padding: 0.875rem 1.25rem;
  }

  /* Toast on mobile */
  .toast-container {
    right: 0.75rem;
    left: 0.75rem;
    top: 1rem;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }

  /* Modal mobile */
  .modal {
    max-height: 85vh;
    border-radius: var(--radius-lg);
    margin: 0.5rem;
  }

  .welcome-banner {
    flex-direction: column;
    text-align: center;
  }

  /* Search bar mobile */
  .search-bar-container {
    max-width: 100%;
    flex-direction: column;
  }

  /* Plan card mobile */
  .plan-card {
    padding: 1.25rem;
  }

  .referral-card {
    padding: 1.5rem;
  }

  .referral-input-group {
    flex-direction: column;
    background: rgba(255, 255, 255, 0.08);
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .referral-input-group input {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .referral-input-group button {
    width: 100%;
  }

  .mission-card {
    padding: 1.15rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .auth-form-wrap h1 {
    font-size: 1.5rem;
  }
  
  .auth-main {
    padding: 1.5rem;
  }

  .page-content {
    padding: 1rem;
  }

  .plan-stats {
    gap: 0.5rem;
  }

  .plan-stat-value {
    font-size: 1.1rem;
  }

  .plan-stat-label {
    font-size: 0.68rem;
  }

  .topbar {
    padding: 0 0.75rem;
    height: 60px;
  }

  .topbar-title {
    font-size: 0.95rem;
  }

  /* Scroll-snap for user table on small mobile */
  .user-table-wrap {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
}

/* Safe area for iOS notch */
@supports (padding: max(0px)) {
  .page-content {
    padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
  }

  .sidebar {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .page-loader {
    display: none !important;
  }
}

/* Mission progress (referral page) */
.mission-progress-fill {
  position: relative;
}

.mission-progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: progressShimmer 1.8s infinite;
  background-size: 200% 100%;
}

/* User count badge for admin */
.user-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.375rem 0.875rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.user-count-badge strong {
  color: var(--primary);
}
