
:root {
  --bg-primary: #0b0c10;
  --bg-secondary: #12141c;
  --bg-tertiary: #1a1d27;
  --bg-card: #151822;
  --border-color: #2a2e3b;
  --text-primary: #e6e8f0;
  --text-secondary: #9ca3b4;
  --text-muted: #6b7280;
  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-purple: #8b5cf6;
  --font-ui: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-ui); background: var(--bg-primary); color: var(--text-primary); line-height: 1.5; overflow-x: hidden; }
.app-container { display: flex; min-height: 100vh; }

/* Auth Overlay */
.auth-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  transition: opacity 0.3s ease;
}
.auth-overlay.hidden { opacity: 0; pointer-events: none; }
.auth-card {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  padding: 32px; width: 100%; max-width: 400px; box-shadow: var(--shadow-md);
}
.auth-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-header svg { color: var(--accent-primary); }
.auth-header h1 { font-size: 1.5rem; font-weight: 700; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab {
  flex: 1; padding: 10px; background: var(--bg-tertiary); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; transition: var(--transition);
}
.tab.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }
.auth-error { color: var(--accent-danger); font-size: 0.85rem; margin-top: 12px; min-height: 20px; }
.btn-block { width: 100%; justify-content: center; }

/* Sidebar */
.sidebar { width: 260px; background: var(--bg-secondary); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; position: fixed; height: 100vh; z-index: 100; transition: var(--transition); }
.sidebar-header { padding: 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.25rem; color: var(--accent-primary); }
.mobile-toggle { display: none; background: none; border: none; color: var(--text-primary); cursor: pointer; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-md); color: var(--text-secondary); text-decoration: none; font-weight: 500; transition: var(--transition); }
.nav-link:hover, .nav-link.active { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-link.active { background: rgba(59, 130, 246, 0.15); color: var(--accent-primary); }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border-color); }
.status-badge { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-tertiary); border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 0.85rem; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.status-dot.online { background: var(--accent-success); box-shadow: 0 0 8px var(--accent-success); }
.status-dot.offline { background: var(--accent-danger); }
.user-profile { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-primary); display: flex; align-items: center; justify-content: center; font-weight: 600; color: white; }
.user-info { display: flex; flex-direction: column; }
.user-info .name { font-weight: 600; font-size: 0.9rem; }
.user-info .role { font-size: 0.75rem; color: var(--text-muted); }
.btn-logout { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: var(--radius-sm); transition: var(--transition); }
.btn-logout:hover { background: var(--bg-tertiary); color: var(--accent-danger); }

/* Main Content */
.main-content { flex: 1; margin-left: 260px; padding: 24px; min-height: 100vh; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; flex-wrap: wrap; gap: 16px; }
.top-bar h1 { font-size: 1.75rem; font-weight: 700; }
.top-actions { display: flex; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-md); font-weight: 600; font-size: 0.9rem; border: none; cursor: pointer; transition: var(--transition); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-card); }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--accent-danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.25); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* Content Sections */
.content-section { display: none; animation: fadeIn 0.3s ease; }
.content-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Dashboard */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px; display: flex; align-items: center; gap: 16px; transition: var(--transition); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.bg-blue { background: rgba(59, 130, 246, 0.15); color: var(--accent-primary); }
.bg-green { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.bg-purple { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); }
.bg-orange { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }
.stat-info { display: flex; flex-direction: column; }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); }
.stat-value { font-size: 1.4rem; font-weight: 700; font-family: var(--font-mono); }
.quick-actions { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 24px; }
.quick-actions h2, .recent-logs h2 { font-size: 1.1rem; margin-bottom: 16px; color: var(--text-primary); }
.command-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.cmd-btn { background: var(--bg-tertiary); border: 1px solid var(--border-color); color: var(--text-secondary); padding: 10px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.85rem; cursor: pointer; transition: var(--transition); }
.cmd-btn:hover { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }
.recent-logs { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px; }
.log-list { max-height: 240px; overflow-y: auto; font-family: var(--font-mono); font-size: 0.85rem; }
.log-item { padding: 8px 0; border-bottom: 1px solid var(--border-color); color: var(--text-secondary); }
.log-item:last-child { border-bottom: none; }
.log-item.empty { color: var(--text-muted); text-align: center; padding: 20px; }

/* File Manager */
.file-manager { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px; }
.file-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.file-header h2 { font-size: 1.25rem; }
.file-actions { display: flex; gap: 10px; }
.upload-zone { border: 2px dashed var(--border-color); border-radius: var(--radius-md); padding: 32px; text-align: center; margin-bottom: 20px; transition: var(--transition); cursor: pointer; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent-primary); background: rgba(59, 130, 246, 0.05); }
.upload-zone svg { color: var(--text-muted); margin-bottom: 12px; }
.upload-zone p { color: var(--text-secondary); }
.upload-link { color: var(--accent-primary); cursor: pointer; text-decoration: underline; }
.upload-progress { margin-top: 16px; }
.progress-bar { height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.progress-bar-fill { height: 100%; background: var(--accent-primary); width: 0%; transition: width 0.3s ease; }
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg-tertiary); border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition); }
.file-item:hover { background: var(--bg-card); transform: translateX(4px); }
.file-item svg { color: var(--accent-primary); }
.file-item.folder svg { color: var(--accent-warning); }
.file-meta { margin-left: auto; color: var(--text-muted); font-size: 0.8rem; }

/* Terminal */
.terminal-container { background: #0d1117; border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; height: calc(100vh - 140px); display: flex; flex-direction: column; }
.terminal-header { background: #161b22; padding: 10px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color); }
.terminal-dots { display: flex; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }
.terminal-title { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-secondary); }
.terminal-body { flex: 1; padding: 16px; font-family: var(--font-mono); font-size: 0.9rem; color: #e6edf3; overflow-y: auto; line-height: 1.6; }
.terminal-line { margin-bottom: 4px; }
.terminal-line.info { color: #58a6ff; }
.terminal-line.success { color: #3fb950; }
.terminal-line.error { color: #f85149; }
.terminal-line.warn { color: #d29922; }
.prompt-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.prompt { color: #3fb950; white-space: nowrap; }
#terminal-input { background: transparent; border: none; color: inherit; font-family: inherit; font-size: inherit; flex: 1; outline: none; caret-color: #3fb950; }

/* Logs Panel */
.logs-panel { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); height: calc(100vh - 140px); display: flex; flex-direction: column; }
.logs-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.logs-content { flex: 1; padding: 16px; font-family: var(--font-mono); font-size: 0.85rem; overflow-y: auto; background: #0d1117; }
.log-entry { margin-bottom: 6px; padding: 4px 0; border-bottom: 1px dashed rgba(255,255,255,0.05); }
.log-entry.system { color: #8b949e; }
.log-entry.info { color: #58a6ff; }
.log-entry.success { color: #3fb950; }
.log-entry.error { color: #f85149; }

/* Config */
.config-panel h2 { margin-bottom: 20px; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.config-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px; }
.config-card h3 { margin-bottom: 16px; font-size: 1rem; color: var(--text-primary); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--text-secondary); }
input[type="text"], select { width: 100%; padding: 10px 12px; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-primary); font-family: var(--font-ui); font-size: 0.9rem; }
input[type="text"]:focus, select:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch label { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-tertiary); border-radius: 24px; transition: var(--transition); border: 1px solid var(--border-color); }
.toggle-switch label:before { position: absolute; content: ""; height: 18px; width: 18px; left: 2px; bottom: 2px; background: white; border-radius: 50%; transition: var(--transition); }
.toggle-switch input:checked + label { background: var(--accent-primary); border-color: var(--accent-primary); }
.toggle-switch input:checked + label:before { transform: translateX(20px); }

/* Responsive */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-toggle { display: block; }
}
@media (max-width: 768px) {
  .top-bar { flex-direction: column; align-items: flex-start; }
  .top-actions { width: 100%; justify-content: space-between; }
  .stats-grid { grid-template-columns: 1fr; }
  .command-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card { margin: 16px; padding: 24px; }
}
