:root {
  /* Palette: Deep Space SaaS */
  --bg-dark: #0b0e14;
  --bg-panel: #151921;
  --bg-card: #1e2330;
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.5);
  --accent: #8b5cf6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #2d3748;
  --glass: rgba(30, 35, 48, 0.7);
  
  /* Spacing & Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  /* Transitions */
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* --- Typography --- */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; }
.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-10px); } 100% { transform: translateY(0px); } }

/* --- Layout Structure --- */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.sidebar {
  width: 280px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 2rem;
  flex-shrink: 0;
  z-index: 10;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-dark);
  min-width: 0; /* Prevent flex overflow */
  position: relative;
}

.top-bar {
  height: 80px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3rem;
  background: rgba(11, 14, 20, 0.8);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 3rem;
  scroll-behavior: smooth;
}

/* --- Sidebar Components --- */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}
.logo-icon { font-size: 2rem; animation: float 3s ease-in-out infinite; }
.logo-text { font-size: 1.5rem; font-weight: 800; color: white; }

.sidebar-actions { margin-bottom: 1.5rem; }
.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.nav-item {
  padding: 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.03); color: white; }
.nav-item.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  border-color: rgba(59, 130, 246, 0.2);
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-secondary { background: rgba(148, 163, 184, 0.2); color: var(--text-muted); }

/* --- Top Bar Components --- */
.breadcrumbs { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.crumb-root { color: var(--text-muted); }
.crumb-sep { color: var(--border); }
.crumb-current { color: white; font-weight: 600; }

.user-status { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }

/* --- View Sections --- */
.view-section { animation: fadeIn 0.4s var(--ease); }
.view-section.hidden { display: none; }

/* Global View */
.hero-center { text-align: center; margin-bottom: 4rem; margin-top: 2rem; }
.hero-icon { font-size: 5rem; margin-bottom: 1.5rem; display: inline-block; animation: float 4s ease-in-out infinite; }
.global-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; max-width: 1000px; margin: 0 auto; }
.center-text { text-align: center; display: flex; flex-direction: column; align-items: center; }
.stat-icon-lg { font-size: 2.5rem; margin-bottom: 1rem; }
.stat-value-lg { font-size: 2rem; font-weight: 700; color: white; margin-top: 0.5rem; }

/* Server View */
.server-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.server-meta { font-family: 'JetBrains Mono', monospace; color: var(--text-muted); margin-top: 0.5rem; }
.server-controls { display: flex; gap: 1rem; }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}
.stat-card {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
}
.stat-icon-box {
  width: 60px; height: 60px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.blue { color: var(--primary); background: rgba(59, 130, 246, 0.1); }
.green { color: var(--success); background: rgba(16, 185, 129, 0.1); }
.yellow { color: var(--warning); background: rgba(245, 158, 11, 0.1); }

.stat-content { flex: 1; }
.stat-value { font-size: 2.5rem; font-weight: 700; color: white; line-height: 1; margin-bottom: 0.25rem; }
.stat-label { color: var(--text-muted); font-size: 0.9rem; }

.action-card { display: block; }
.action-row { display: flex; gap: 1rem; margin-top: 0.5rem; }
.flex-1 { flex: 1; }

/* Bot Grid */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 4rem;
}
.bot-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all 0.3s var(--ease);
}
.bot-card:hover { transform: translateY(-5px); border-color: var(--primary); box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5); }

.bot-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.bot-avatar {
  width: 50px; height: 50px; border-radius: 50%; background: var(--bg-panel);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border); color: var(--text-muted); font-size: 1.2rem;
}
.status-online { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; margin-right: 0.5rem; }
.status-offline { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; margin-right: 0.5rem; }

.bot-info { flex: 1; }
.bot-actions { margin-top: 1rem; }
.bot-name { font-weight: 600; display: block; margin-bottom: 0.25rem; }
.bot-status-text { font-size: 0.8rem; color: var(--text-muted); }
.status-badge { font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 4px; }

/* Console */
.console-section {
  background: #0d1117;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 400px;
}
.console-section h3 {
  background: #161b22;
  padding: 1rem;
  margin: 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.console-window {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

/* Components */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; }
.btn-secondary:hover { background: rgba(255,255,255,0.15); }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.btn-success:hover { background: rgba(16, 185, 129, 0.2); }
.full-width { width: 100%; }

.input-group { margin-bottom: 1.5rem; position: relative; }
.input-field {
  width: 100%; background: var(--bg-dark); border: 1px solid var(--border);
  padding: 1rem; border-radius: var(--radius-sm); color: white;
}
.input-label {
  position: absolute; left: 1rem; top: -0.6rem; background: var(--bg-card);
  padding: 0 0.25rem; font-size: 0.8rem; color: var(--primary);
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 100;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--bg-card); width: 100%; max-width: 500px;
  padding: 2rem; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transform: scale(0.95); transition: transform 0.3s;
}
.modal-overlay.open .modal-box { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; margin-bottom: 2rem; }
.close-modal { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; }
.modal-actions { display: flex; gap: 1rem; margin-top: 2rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
