:root {
  --bg-main: #0e131f;
  --bg-card: #182030;
  --bg-sidebar: #131a28;
  --text-main: #e2e8f0;
  --text-muted: #8a99ad;
  --border-color: #232e42;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
  --transition: all 0.2s ease;
}

body.theme-light {
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
}

body.no-animations * {
  transition: none !important;
  animation: none !important;
}

body.compact-mode {
  --radius: 4px;
}
body.compact-mode .card {
  padding: 12px;
}
body.compact-mode .file-table th, 
body.compact-mode .file-table td {
  padding: 6px 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.divider { border: 0; height: 1px; background: var(--border-color); margin: 16px 0; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}
.toast-success { background-color: var(--success); }
.toast-warning { background-color: var(--warning); }
.toast-error { background-color: var(--danger); }
.toast-info { background-color: var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Login Screen */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.login-card {
  background: var(--bg-card);
  padding: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 380px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
}
.login-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
  margin-bottom: 24px;
}

/* Form Controls */
.input-group {
  margin-bottom: 16px;
}
.input-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
input[type="text"], input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-main);
  outline: none;
}
input:focus {
  border-color: var(--accent);
}

/* Buttons */
.btn {
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--border-color); color: var(--text-main); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* App Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}
.sidebar-nav {
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-weight: 500;
}
.nav-item:hover, .nav-item.active {
  background: var(--bg-card);
  color: var(--text-main);
}
.btn-logout:hover { color: var(--danger); }

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.topbar {
  padding: 20px 30px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}
.server-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-online { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-offline { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge-starting { background: rgba(245, 158, 11, 0.2); color: var(--warning); }

.view-container {
  padding: 30px;
  flex: 1;
}
.view { display: none; }
.view.active { display: block; }

/* Cards & Stats */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.btn-group { display: flex; gap: 10px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.stat-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.progress-bar {
  height: 6px;
  background: var(--bg-main);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.4s ease;
}

/* Console */
.console-card {
  display: flex;
  flex-direction: column;
  height: 600px;
}
.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.console-output {
  flex: 1;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px;
  font-family: monospace;
  font-size: 0.85rem;
  overflow-y: auto;
  white-space: pre-wrap;
  margin-bottom: 12px;
  color: #a7f3d0;
}
.console-input-group {
  display: flex;
  gap: 10px;
}

/* Files */
.files-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.breadcrumbs {
  font-family: monospace;
  color: var(--text-muted);
}
.file-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.file-table th, .file-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}
.file-table th { color: var(--text-muted); font-weight: 600; }
.file-row-dir { font-weight: 600; cursor: pointer; color: var(--accent); }
.file-row-file { cursor: pointer; }

/* File Editor */
.file-editor-card { margin-top: 20px; }
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.file-editor-textarea {
  width: 100%;
  height: 400px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-main);
  font-family: monospace;
  padding: 12px;
  resize: vertical;
}

/* Settings */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
}
.setting-item p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Switch Toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border-color);
  transition: .2s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); }

/* Responsive */
@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; }
  .actions-bar { flex-direction: column; gap: 12px; align-items: flex-start; }
}