/* ========================================
   KatCraftPanel - Design System
   Dark theme with green/cyan accents
   ======================================== */

:root {
  /* Colors */
  --bg-deep: #080b10;
  --bg-dark: #0c1017;
  --bg-card: #111822;
  --bg-elevated: #16202e;
  --bg-hover: #1c2a3a;
  --bg-input: #0e1520;
  
  --accent: #00ff88;
  --accent-dim: #00cc6a;
  --accent-glow: rgba(0, 255, 136, 0.15);
  --accent-glow-strong: rgba(0, 255, 136, 0.3);
  --accent-secondary: #00e5ff;
  --accent-secondary-dim: #00b8cc;
  
  --text-primary: #e4eaf0;
  --text-secondary: #6b7f96;
  --text-muted: #3d4f63;
  
  --border: rgba(0, 255, 136, 0.08);
  --border-hover: rgba(0, 255, 136, 0.2);
  --border-active: rgba(0, 255, 136, 0.4);
  
  --success: #00ff88;
  --warning: #ffaa00;
  --error: #ff3b5c;
  --info: #00e5ff;
  
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(0, 255, 136, 0.1);
  
  /* Typography */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  
  /* Sizing */
  --sidebar-width: 260px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  /* Transitions */
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

::selection {
  background: var(--accent);
  color: var(--bg-deep);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ========================================
   Login Screen
   ======================================== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(ellipse at 30% 20%, rgba(0, 255, 136, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(0, 229, 255, 0.03) 0%, transparent 50%);
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1.1) rotate(3deg); }
}

.login-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 420px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  backdrop-filter: blur(20px);
  animation: cardEnter 0.6s ease-out;
}

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  display: inline-flex;
  margin-bottom: 16px;
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(0, 255, 136, 0.3)); }
  50% { filter: drop-shadow(0 0 20px rgba(0, 255, 136, 0.5)); }
}

.login-logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7f96' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-mono);
}

.form-error {
  background: rgba(255, 59, 92, 0.1);
  border: 1px solid rgba(255, 59, 92, 0.3);
  color: var(--error);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.form-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: var(--bg-deep);
  border-color: var(--accent);
}

.btn-primary:hover {
  box-shadow: 0 0 20px var(--accent-glow-strong);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-danger {
  background: rgba(255, 59, 92, 0.1);
  color: var(--error);
  border-color: rgba(255, 59, 92, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 59, 92, 0.2);
  box-shadow: 0 0 15px rgba(255, 59, 92, 0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 10px;
}

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

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  padding: 6px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

/* ========================================
   Layout
   ======================================== */
#app { height: 100vh; overflow: hidden; }

.main-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.3px;
}

.logo-dot {
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow-strong);
  animation: logoPulse 3s ease-in-out infinite;
}

.sidebar-nav {
  list-style: none;
  padding: 12px 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 450;
  transition: var(--transition);
  position: relative;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 16px;
}

.server-quick-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px;
}

.quick-list-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 14px;
}

.quick-server-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.quick-server-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.quick-server-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.server-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.server-status-dot.running {
  background: var(--success);
  box-shadow: 0 0 6px rgba(0, 255, 136, 0.5);
}

.server-status-dot.exited,
.server-status-dot.stopped {
  background: var(--text-muted);
}

.server-status-dot.created {
  background: var(--warning);
  box-shadow: 0 0 6px rgba(255, 170, 0, 0.5);
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-main);
}

.btn-logout:hover {
  background: rgba(255, 59, 92, 0.1);
  color: var(--error);
}

/* Content */
.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100vh;
}

.page-content {
  padding: 28px 32px;
  max-width: 1400px;
  animation: pageIn 0.3s ease-out;
}

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

/* ========================================
   Cards
   ======================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
}

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

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

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ========================================
   Page Headers
   ======================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-title span {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========================================
   Stats Grid
   ======================================== */
.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);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  opacity: 0;
  transition: var(--transition);
}

.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.stat-icon.green { background: rgba(0, 255, 136, 0.1); color: var(--accent); }
.stat-icon.blue { background: rgba(0, 229, 255, 0.1); color: var(--accent-secondary); }
.stat-icon.amber { background: rgba(255, 170, 0, 0.1); color: var(--warning); }
.stat-icon.red { background: rgba(255, 59, 92, 0.1); color: var(--error); }

.stat-info { position: relative; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

/* ========================================
   Server Grid / Table
   ======================================== */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.server-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.server-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.server-card-name {
  font-size: 1.05rem;
  font-weight: 600;
}

.server-card-badges {
  display: flex;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-running {
  background: rgba(0, 255, 136, 0.1);
  color: var(--success);
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.badge-stopped {
  background: rgba(107, 127, 150, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(107, 127, 150, 0.2);
}

.badge-created {
  background: rgba(255, 170, 0, 0.1);
  color: var(--warning);
  border: 1px solid rgba(255, 170, 0, 0.2);
}

.badge-type {
  background: rgba(0, 229, 255, 0.1);
  color: var(--accent-secondary);
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.server-card-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.82rem;
}

.server-card-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.server-card-info-item span { color: var(--text-primary); }

.server-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ========================================
   Tabs
   ======================================== */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab {
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  font-family: var(--font-main);
}

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

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: pageIn 0.2s ease-out; }

/* ========================================
   Terminal / Console
   ======================================== */
.terminal {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono);
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
}

.terminal-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.terminal-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-glow-strong);
  animation: terminalPulse 2s ease-in-out infinite;
}

@keyframes terminalPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.terminal-output {
  height: 400px;
  overflow-y: auto;
  padding: 12px 16px;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-output .log-info { color: var(--accent-secondary); }
.terminal-output .log-warn { color: var(--warning); }
.terminal-output .log-error { color: var(--error); }
.terminal-output .log-time { color: var(--text-muted); }

.terminal-input-area {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg-dark);
}

.terminal-prompt {
  padding: 10px 12px;
  color: var(--accent);
  font-size: 0.85rem;
  user-select: none;
}

.terminal-input {
  flex: 1;
  padding: 10px 12px 10px 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

/* ========================================
   File Manager
   ======================================== */
.file-manager {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.file-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  flex: 1;
}

.breadcrumb-item {
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.breadcrumb-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.breadcrumb-item.active { color: var(--accent); }
.breadcrumb-sep { color: var(--text-muted); }

.file-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.file-list-header {
  display: grid;
  grid-template-columns: 1fr 100px 160px 80px;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.file-item {
  display: grid;
  grid-template-columns: 1fr 100px 160px 80px;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  align-items: center;
  transition: var(--transition);
  cursor: pointer;
}

.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--bg-hover); }

.file-name {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 450;
}

.file-icon { color: var(--text-muted); flex-shrink: 0; }
.file-icon.folder { color: var(--accent); }
.file-size { color: var(--text-secondary); }
.file-modified { color: var(--text-secondary); font-size: 0.8rem; }

.file-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
  transition: var(--transition);
}

.file-item:hover .file-actions { opacity: 1; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  transition: var(--transition);
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

.drop-zone-icon {
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ========================================
   Text Editor
   ======================================== */
.editor-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
}

.editor-filename {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.editor-textarea {
  width: 100%;
  min-height: 500px;
  padding: 16px;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  border: none;
  outline: none;
  resize: vertical;
  tab-size: 2;
}

/* ========================================
   Modals
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.modal-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ========================================
   Toasts
   ======================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  animation: toastIn 0.3s ease-out;
  min-width: 280px;
  max-width: 420px;
}

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

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  font-size: 1.1rem;
  line-height: 1;
}

/* ========================================
   Loading
   ======================================== */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  gap: 16px;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg { margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 8px; font-size: 1.1rem; }
.empty-state p { font-size: 0.9rem; margin-bottom: 20px; }

/* ========================================
   Create Server Wizard
   ======================================== */
.wizard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
}

.wizard-step {
  flex: 1;
  text-align: center;
  position: relative;
}

.wizard-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  transition: var(--transition);
}

.wizard-step.active .wizard-step-dot {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.wizard-step.completed .wizard-step-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-deep);
}

.wizard-step-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.wizard-step.active .wizard-step-label { color: var(--accent); }
.wizard-step.completed .wizard-step-label { color: var(--text-secondary); }

.wizard-step-line {
  position: absolute;
  top: 16px;
  left: calc(50% + 20px);
  right: calc(-50% + 20px);
  height: 2px;
  background: var(--border);
}

.wizard-step.completed .wizard-step-line {
  background: var(--accent);
}

.wizard-content {
  min-height: 300px;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ========================================
   Backup Config
   ======================================== */
.backup-schedule {
  display: grid;
  gap: 16px;
}

.backup-schedule-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.backup-schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.backup-schedule-title {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  left: 2px;
  top: 2px;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  background: var(--accent);
  transform: translateX(20px);
}

/* ========================================
   Server Detail Header
   ======================================== */
.server-detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.server-detail-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent-glow), rgba(0, 229, 255, 0.1));
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.server-detail-info { flex: 1; }

.server-detail-name {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.server-detail-meta {
  display: flex;
  gap: 16px;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.server-detail-actions {
  display: flex;
  gap: 8px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -var(--sidebar-width);
    z-index: 100;
    transition: var(--transition-slow);
  }
  
  .sidebar.open { left: 0; }
  
  .page-content { padding: 16px; }
  
  .stats-grid { grid-template-columns: 1fr; }
  .server-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  
  .file-list-header,
  .file-item {
    grid-template-columns: 1fr 80px;
  }
  
  .file-modified, .file-list-header > :nth-child(3) { display: none; }
  .file-actions, .file-list-header > :nth-child(4) { display: none; }
}

/* ========================================
   Utility
   ======================================== */
.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
