/* ================================================
   Minecraft Server Panel - Modern Dark Theme
   Black & White Edition with Smooth Animations
   ================================================ */

/* ---------- CSS RESET & VARIABLES ---------- */
:root {
  --bg-black: #050505;
  --bg-dark: #0a0a0a;
  --bg-card: #111111;
  --bg-card-hover: #161616;
  --bg-input: #080808;
  --bg-input-focus: #0f0f0f;
  --bg-sidebar: #070707;
  --bg-header: #070707;
  --border: #1e1e1e;
  --border-hover: #2a2a2a;
  --border-light: #181818;

  --text-primary: #f5f5f5;
  --text-secondary: #a3a3a3;
  --text-muted: #6b6b6b;
  --text-white: #ffffff;

  /* Accent / Primary - Black & White */
  --primary: #ffffff;
  --primary-hover: #e0e0e0;
  --primary-light: #f0f0f0;
  --primary-glow: rgba(255, 255, 255, 0.08);
  --primary-glow-strong: rgba(255, 255, 255, 0.15);

  /* Semantic colors */
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --success-border: rgba(34, 197, 94, 0.25);

  --warning: #eab308;
  --warning-bg: rgba(234, 179, 8, 0.1);
  --warning-border: rgba(234, 179, 8, 0.25);

  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.25);

  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
  --info-border: rgba(59, 130, 246, 0.25);

  /* Server software colors (kept for identification, muted) */
  --vanilla: #8b4513;
  --paper: #2196f3;
  --purpur: #9c27b0;
  --fabric: #4caf50;
  --forge: #ff5722;
  --velocity: #00bcd4;
  --bungeecord: #ff6b35;
  --bedrock: #4caf50;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.06);
  --shadow-glow-strong: 0 0 30px rgba(255, 255, 255, 0.1);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Sidebar */
  --sidebar-width: 250px;
  --header-height: 64px;
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-black);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  outline: none;
  border: none;
  background: none;
  color: var(--text-primary);
}

ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ================================================
   ANIMATIONS
   ================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

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

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

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

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

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px var(--primary-glow); }
  50% { box-shadow: 0 0 25px var(--primary-glow-strong); }
}

@keyframes glowWhite {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 255, 255, 0.1); }
  50% { box-shadow: 0 0 24px rgba(255, 255, 255, 0.25); }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

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

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

@keyframes heartbeat {
  0% { transform: scale(1); }
  8% { transform: scale(1.18); }
  16% { transform: scale(1); }
  24% { transform: scale(1.22); }
  32% { transform: scale(1); }
  55%, 100% { transform: scale(1); }
}

@keyframes heartbeat-glow {
  0%, 100% { 
    filter: drop-shadow(0 0 3px currentColor) drop-shadow(0 0 6px currentColor);
    opacity: 0.85;
  }
  8% { 
    filter: drop-shadow(0 0 8px currentColor) drop-shadow(0 0 14px currentColor) drop-shadow(0 0 20px currentColor);
    opacity: 1;
  }
  16% { 
    filter: drop-shadow(0 0 4px currentColor) drop-shadow(0 0 8px currentColor);
    opacity: 0.85;
  }
  24% { 
    filter: drop-shadow(0 0 10px currentColor) drop-shadow(0 0 18px currentColor) drop-shadow(0 0 26px currentColor);
    opacity: 1;
  }
  32% { 
    filter: drop-shadow(0 0 3px currentColor) drop-shadow(0 0 6px currentColor);
    opacity: 0.85;
  }
  55%, 100% { 
    filter: drop-shadow(0 0 3px currentColor) drop-shadow(0 0 6px currentColor);
    opacity: 0.85;
  }
}

@keyframes heartbeat-glow-red {
  0%, 100% { 
    filter: drop-shadow(0 0 4px #ef4444) drop-shadow(0 0 8px #ef4444);
    opacity: 0.9;
  }
  20% { 
    filter: drop-shadow(0 0 8px #ef4444) drop-shadow(0 0 16px #ef4444) drop-shadow(0 0 24px #ef4444);
    opacity: 1;
  }
  40% { 
    filter: drop-shadow(0 0 4px #ef4444) drop-shadow(0 0 8px #ef4444);
    opacity: 0.9;
  }
}

@keyframes heartbeat-glow-green {
  0%, 100% { 
    filter: drop-shadow(0 0 4px #22c55e) drop-shadow(0 0 8px #22c55e);
    opacity: 0.9;
  }
  20% { 
    filter: drop-shadow(0 0 8px #22c55e) drop-shadow(0 0 16px #22c55e) drop-shadow(0 0 24px #22c55e);
    opacity: 1;
  }
  40% { 
    filter: drop-shadow(0 0 4px #22c55e) drop-shadow(0 0 8px #22c55e);
    opacity: 0.9;
  }
}

@keyframes borderGlow {
  0%, 100% { border-color: var(--border); }
  50% { border-color: var(--border-hover); }
}

@keyframes ripple {
  0% { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes rotateIn {
  from { opacity: 0; transform: rotate(-8deg) scale(0.95); }
  to { opacity: 1; transform: rotate(0) scale(1); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }
.fade-in-scale { animation: fadeInScale 0.3s ease forwards; }
.slide-up { animation: slideInUp 0.4s ease forwards; }

/* Staggered animations for grids */
.stagger > *:nth-child(1) { animation: fadeIn 0.3s ease 0.05s both; }
.stagger > *:nth-child(2) { animation: fadeIn 0.3s ease 0.1s both; }
.stagger > *:nth-child(3) { animation: fadeIn 0.3s ease 0.15s both; }
.stagger > *:nth-child(4) { animation: fadeIn 0.3s ease 0.2s both; }
.stagger > *:nth-child(5) { animation: fadeIn 0.3s ease 0.25s both; }
.stagger > *:nth-child(6) { animation: fadeIn 0.3s ease 0.3s both; }
.stagger > *:nth-child(7) { animation: fadeIn 0.3s ease 0.35s both; }
.stagger > *:nth-child(8) { animation: fadeIn 0.3s ease 0.4s both; }

/* ================================================
   TYPOGRAPHY
   ================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-white);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-white { color: var(--text-white); }

/* ================================================
   LAYOUT
   ================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg-black);
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition), box-shadow var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--text-white);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--bg-black);
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(255, 255, 255, 0.15);
  transition: box-shadow var(--transition), transform var(--transition);
}

.sidebar-brand .brand-icon:hover {
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.sidebar-brand .brand-text {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-white);
  white-space: nowrap;
}

.sidebar-brand .brand-subtext {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-section {
  padding: 16px 12px 8px;
}

.sidebar-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 12px 8px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.88rem;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  position: relative;
  overflow: visible;
}

.sidebar-nav-item i {
  width: 20px;
  text-align: center;
  font-size: 14px;
  transition: transform var(--transition-fast);
}

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

.sidebar-nav-item:hover i {
  transform: translateX(2px);
}

.sidebar-nav-item.active {
  background: var(--text-white);
  color: var(--bg-black);
  box-shadow: 0 2px 16px rgba(255, 255, 255, 0.15);
}

.sidebar-nav-item.active i {
  color: var(--bg-black);
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--bg-black);
  border-radius: 0 3px 3px 0;
  opacity: 0.8;
}

/* Ripple effect on sidebar items */
.sidebar-nav-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.sidebar-nav-item:active::after {
  opacity: 1;
}

.sidebar-server-info {
  padding: 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

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

.sidebar-footer-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.sidebar-footer-user:hover {
  background: var(--bg-card);
}

.sidebar-footer-user .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--bg-black);
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: box-shadow var(--transition);
}

.sidebar-footer-user:hover .avatar {
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

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

.sidebar-footer-user .user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer-user .user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* Mobile sidebar toggle */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 99;
  animation: fadeIn 0.2s ease;
}

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

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  padding: 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.menu-toggle:hover { background: var(--bg-card); }

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

/* ---------- HEADER ---------- */
.header {
  height: var(--header-height);
  background: rgba(7, 7, 7, 0.85);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.header-breadcrumb a {
  color: var(--text-muted);
}

.header-breadcrumb a:hover { color: var(--text-primary); }

.header-breadcrumb .separator {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.header-breadcrumb .current {
  color: var(--text-white);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-action {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}

.header-action:hover {
  background: var(--bg-card);
  color: var(--text-white);
  transform: translateY(-1px);
}

.header-action:active {
  transform: scale(0.95);
}

.header-action .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-header);
  animation: pulse 2s infinite;
}

/* Notifications dropdown */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: none;
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

.notif-dropdown.show { display: block; }

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

.notif-header h4 { font-size: 0.95rem; }
.notif-header a { font-size: 0.8rem; color: var(--text-secondary); }
.notif-header a:hover { color: var(--text-white); }

.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  gap: 12px;
  transition: background var(--transition-fast);
}
.notif-item:hover { background: var(--bg-card-hover); }
.notif-item.unread { background: rgba(255, 255, 255, 0.03); }
.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.notif-icon.success { background: var(--success-bg); color: var(--success); }
.notif-icon.warning { background: var(--warning-bg); color: var(--warning); }
.notif-icon.danger, .notif-icon.error { background: var(--danger-bg); color: var(--danger); }
.notif-icon.info { background: var(--info-bg); color: var(--info); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 0.85rem; font-weight: 600; color: var(--text-white); }
.notif-text { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.notif-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.notif-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); }

/* ---------- PAGE CONTENT ---------- */
.page-content {
  flex: 1;
  padding: 28px;
  animation: fadeIn 0.3s ease;
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-white);
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ---------- SERVER NAV TABS ---------- */
.server-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-dark);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  overflow-x: auto;
  border: 1px solid var(--border);
}

.server-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.server-nav-item i { font-size: 13px; }
.server-nav-item:hover { color: var(--text-primary); background: var(--bg-card); }
.server-nav-item.active { background: var(--text-white); color: var(--bg-black); }

/* ================================================
   CARDS
   ================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

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

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body { padding: 22px; }
.card-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

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

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

.server-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.server-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 255, 255, 0.04);
}

.server-card:hover::before {
  opacity: 1;
}

.server-card:active {
  transform: translateY(-2px) scale(0.99);
}

.server-card-header {
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.server-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  color: var(--bg-black);
  background: var(--text-white);
  transition: transform var(--transition-bounce), box-shadow var(--transition);
}

.server-card:hover .server-card-icon {
  transform: scale(1.08) rotate(-3deg);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.15);
}

.server-card-info { flex: 1; min-width: 0; }
.server-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.server-card-version {
  background: var(--bg-dark);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
}

/* Status dot */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
}

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

.status-dot.running::before,
.status-dot.online::before {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}
.status-dot.running, .status-dot.online { color: var(--success); }

.status-dot.stopped::before,
.status-dot.offline::before {
  background: var(--danger);
}
.status-dot.stopped, .status-dot.offline { color: var(--danger); }

.status-dot.starting::before,
.status-dot.pending::before,
.status-dot.suspended::before {
  background: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  animation: pulse 1s infinite;
}
.status-dot.starting, .status-dot.pending, .status-dot.suspended { color: var(--warning); }

.server-card-stats {
  padding: 0 20px 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

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

.server-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.server-stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-white);
}

.server-card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-dark);
}

.server-card-address {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Progress bars */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-dark);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }
.progress-bar.info { background: var(--info); }
.progress-bar.primary { background: var(--text-white); }

/* Stat cards (dashboard overview) */
.stat-cards {
  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-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.stat-card:hover::after {
  opacity: 1;
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  transition: transform var(--transition-bounce);
}

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

.stat-card-icon.primary { background: rgba(255, 255, 255, 0.08); color: var(--text-white); }
.stat-card-icon.success { background: var(--success-bg); color: var(--success); }
.stat-card-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-card-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-card-icon.info { background: var(--info-bg); color: var(--info); }

.stat-card-content { flex: 1; }
.stat-card-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-card-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.2;
  margin-top: 2px;
}
.stat-card-change {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ================================================
   BUTTONS
   ================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.15) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.btn:active::after {
  opacity: 1;
}

.btn i { font-size: 13px; transition: transform var(--transition-fast); }

.btn:hover i {
  transform: translateX(2px);
}

.btn-primary {
  background: var(--text-white);
  color: var(--bg-black);
  box-shadow: 0 2px 12px rgba(255, 255, 255, 0.12);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}
.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}
.btn-success:hover { background: #16a34a; transform: translateY(-1px); }
.btn-success:active { transform: scale(0.98); }

.btn-warning {
  background: var(--warning);
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.25);
}
.btn-warning:hover { background: #ca8a04; transform: translateY(-1px); }
.btn-warning:active { transform: scale(0.98); }

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }
.btn-danger:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--bg-dark);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card); border-color: var(--border-hover); transform: translateY(-1px); }
.btn-secondary:active { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text-white); }
.btn-ghost:active { transform: scale(0.96); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ================================================
   FORMS
   ================================================ */
.form-group { margin-bottom: 18px; }

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: all var(--transition-fast);
}

.form-control:focus {
  border-color: var(--text-white);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

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

textarea.form-control { resize: vertical; min-height: 100px; font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

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

.form-check-label { font-size: 0.88rem; color: var(--text-secondary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ================================================
   ALERTS / FLASH MESSAGES
   ================================================ */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  border: 1px solid;
  animation: fadeIn 0.3s ease;
  position: relative;
  overflow: hidden;
}

.alert::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
}

.alert i { font-size: 1.1rem; flex-shrink: 0; }
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.alert-success::after { background: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.alert-warning::after { background: var(--warning); }
.alert-danger, .alert-error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.alert-danger::after, .alert-error::after { background: var(--danger); }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.alert-info::after { background: var(--info); }
.alert-dismissible { justify-content: space-between; }
.alert-close { background: none; color: inherit; font-size: 1.1rem; opacity: 0.7; transition: opacity var(--transition-fast), transform var(--transition-fast); }
.alert-close:hover { opacity: 1; transform: rotate(90deg); }

/* ================================================
   AUTH PAGES (Login/Register)
   ================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-black);
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.auth-wrapper::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.04) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  animation: glowWhite 6s ease-in-out infinite;
}

.auth-wrapper::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.02) 0%, transparent 70%);
  bottom: -150px;
  left: -150px;
  animation: glowWhite 8s ease-in-out infinite reverse;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(255, 255, 255, 0.03);
  animation: fadeInScale 0.5s ease;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent 50%, rgba(255,255,255,0.04));
  z-index: -1;
  pointer-events: none;
}

.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-brand-icon {
  width: 64px;
  height: 64px;
  background: var(--text-white);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--bg-black);
  margin-bottom: 16px;
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.15);
  animation: float 3s ease-in-out infinite;
}

.auth-brand h1 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-brand p { color: var(--text-muted); font-size: 0.88rem; }

.auth-title { font-size: 1.3rem; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 28px; }

.auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.auth-footer a { color: var(--text-white); font-weight: 500; }
.auth-footer a:hover { color: var(--primary-hover); }
.input-group { position: relative; }
.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  transition: color var(--transition-fast);
  pointer-events: none;
}

.input-group .form-control { padding-left: 42px; }
.input-group .form-control:focus + .input-icon,
.input-group .form-control:focus ~ .input-icon {
  color: var(--text-white);
}

/* ================================================
   CONSOLE
   ================================================ */
.console-wrapper {
  background: #030303;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.console-output {
  background: #030303;
  color: #d4d4d4;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 16px;
  height: 500px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.console-output .log-info { color: #8ecae6; }
.console-output .log-warn { color: var(--warning); }
.console-output .log-error { color: var(--danger); }
.console-output .log-success { color: var(--success); }
.console-output .log-timestamp { color: var(--text-muted); }

.console-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-dark);
}

.console-input-bar .form-control {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  background: #030303;
}

.cursor-blink::after {
  content: '▊';
  color: var(--text-white);
  animation: blink 1s infinite;
}

/* ================================================
   FILE MANAGER
   ================================================ */
.file-browser {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

/* Bulk Actions Bar */
.bulk-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  gap: 16px;
  animation: slideDown var(--transition-fast) ease-out;
}

.bulk-actions-text {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

.bulk-actions-text i {
  color: var(--primary);
  font-size: 1rem;
}

.bulk-actions-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-actions-buttons .btn {
  padding: 6px 14px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.file-path-bar {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-dark);
  flex-wrap: wrap;
}

.file-path-input {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: border-color var(--transition-fast);
}

.file-path-input:focus {
  border-color: var(--text-white);
}

.file-list { padding: 12px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.file-item:hover {
  background: var(--bg-dark);
  border-color: var(--border-hover);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

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

.file-icon.folder { background: var(--warning-bg); color: var(--warning); }
.file-icon.file-jar { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.file-icon.file-yml { background: rgba(255, 255, 255, 0.08); color: var(--text-white); }
.file-icon.file-json { background: rgba(34, 197, 94, 0.12); color: var(--success); }
.file-icon.file-log { background: rgba(115, 115, 115, 0.15); color: var(--text-muted); }
.file-icon.file-default { background: var(--bg-dark); color: var(--text-secondary); }

.file-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.file-meta {
  display: flex;
  gap: 24px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.file-actions {
  display: flex;
  gap: 6px;
  transition: opacity var(--transition-fast);
  white-space: nowrap;
}

.file-action-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  transition: all var(--transition-fast);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}

.file-action-btn:hover {
  background: var(--bg-dark);
  color: var(--text-white);
  border-color: var(--border-hover);
  transform: scale(1.1);
}

.file-action-btn.danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger);
}

/* ================================================
   TABLES
   ================================================ */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-responsive { overflow-x: auto; }

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

.data-table th {
  text-align: left;
  padding: 14px 20px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 20px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  transition: background var(--transition-fast);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-card-hover); }

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

.tab-btn {
  padding: 12px 20px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--text-white); border-bottom-color: var(--text-white); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ================================================
   MODAL SYSTEM
   ================================================ */

/* ---------- Modal Backdrop ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition), visibility var(--transition), backdrop-filter var(--transition), -webkit-backdrop-filter var(--transition);
  z-index: 99998;
  padding: 16px;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.modal-backdrop.show::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
}

/* ---------- Modal Container ---------- */
.modal-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 99999;
  padding: 16px;
}

.modal-container.active {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Modal Content ---------- */
.modal-content {
  background: rgba(17, 17, 17, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.7),
    inset 0 1px 1px rgba(255, 255, 255, 0.08),
    0 0 1px rgba(255, 255, 255, 0.05),
    0 0 60px rgba(0, 0, 0, 0.4);
  width: min(90vw, 500px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: auto;
  position: relative;
  z-index: 99999;
}

.modal-content::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 50%, rgba(255,255,255,0.03) 100%);
  z-index: -1;
  pointer-events: none;
}

/* Animation for content entrance */
@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-container.active .modal-content {
  animation: modalSlideUp 0.35s var(--transition-bounce) both;
}

/* If legacy markup nests a .modal inside .modal-content, avoid a second
   entrance animation on the inner dialog. */
.modal-container.active .modal-content .modal {
  animation: none;
}

/* ---------- Modal Header ---------- */
.modal-header {
  padding: 24px 24px 16px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0) 100%);
}

.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: fadeIn var(--transition-fast);
}

/* Icon color variants */
.modal-icon-success {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.25);
  color: #22c55e;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.15);
}

.modal-icon-error,
.modal-icon-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.25);
  color: #ef4444;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

.modal-icon-warning {
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.25);
  color: #eab308;
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.15);
}

.modal-icon-info {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.25);
  color: #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
}

/* Title Group */
.modal-title-group {
  flex: 1;
  min-width: 0;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-white);
  margin: 0;
  line-height: 1.3;
}

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

/* ---------- Modal Body ---------- */
.modal-body {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  color: var(--text-primary);
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

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

/* Custom content in modal body */
.modal-custom-content {
  margin-top: 12px;
}

/* ---------- Modal Progress (extract/delete/zip live %) ---------- */
.modal-progress {
  margin-top: 16px;
}

.modal-progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.modal-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #7ab5ff);
  border-radius: 4px;
  transition: width 0.25s ease;
}

.modal-progress-fill.indeterminate {
  width: 40% !important;
  animation: modal-progress-slide 1.2s ease-in-out infinite;
}

@keyframes modal-progress-slide {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}

.modal-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.modal-progress-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  min-width: 0;
}

.modal-progress-percent {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-white, #fff);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Modal Footer ---------- */
.modal-footer {
  padding: 16px 24px 24px;
  display: flex;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.02) 100%);
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---------- Modal Input ---------- */
.modal-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: all var(--transition-fast);
}

.modal-input:focus {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

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

/* Error message */
.modal-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 6px;
  animation: slideInUp 0.2s ease;
}

/* ---------- Legacy Modal (for backward compatibility) ---------- */
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeInScale 0.3s var(--transition-bounce);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  z-index: 1001;
}

.modal::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 50%, rgba(255,255,255,0.03) 100%);
  z-index: -1;
  pointer-events: none;
}

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

.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--bg-dark); color: var(--text-white); transform: rotate(90deg); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ================================================
   BADGES
   ================================================ */
.badge-tag {
  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.3px;
}

.badge-tag.success { background: var(--success-bg); color: var(--success); }
.badge-tag.warning { background: var(--warning-bg); color: var(--warning); }
.badge-tag.danger { background: var(--danger-bg); color: var(--danger); }
.badge-tag.info { background: var(--info-bg); color: var(--info); }
.badge-tag.primary { background: rgba(255, 255, 255, 0.1); color: var(--text-white); }
.badge-tag.muted { background: var(--bg-dark); color: var(--text-muted); }

/* ================================================
   CODE / EDITOR
   ================================================ */
.code-editor {
  background: #030303;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

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

.code-editor textarea {
  width: 100%;
  min-height: 450px;
  background: #030303;
  color: #e4e4e4;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  padding: 16px;
  resize: vertical;
  tab-size: 2;
}

/* ================================================
   PROFILE PAGE
   ================================================ */
.profile-header-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, #141414 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.profile-header-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  opacity: 0.6;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--bg-black);
  flex-shrink: 0;
  border: 4px solid var(--bg-card);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 1;
  transition: transform var(--transition-bounce);
}

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

.profile-info { flex: 1; position: relative; z-index: 1; }
.profile-name { font-size: 1.5rem; font-weight: 700; color: white; }
.profile-email { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }
.profile-meta { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ================================================
   PLUGIN MARKETPLACE
   ================================================ */
.plugin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

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

.plugin-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.plugin-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.plugin-card:hover::after {
  opacity: 1;
}

.plugin-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 14px;
  overflow: hidden;
  transition: transform var(--transition-bounce);
}

.plugin-card:hover .plugin-icon {
  transform: scale(1.08) rotate(-2deg);
}

.plugin-icon img { width: 100%; height: 100%; object-fit: cover; }
.plugin-name { font-size: 1rem; font-weight: 600; color: white; margin-bottom: 4px; }
.plugin-author { font-size: 0.78rem; color: var(--text-muted); }
.plugin-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 10px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.plugin-stats { display: flex; gap: 14px; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 14px; }
.plugin-stats span { display: flex; align-items: center; gap: 4px; }

/* ================================================
   PLAYERS
   ================================================ */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.player-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-fast);
}

.player-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.player-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--bg-black);
  font-size: 1rem;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.player-card:hover .player-avatar {
  transform: scale(1.1);
}

.player-name { font-weight: 600; font-size: 0.88rem; color: white; }
.player-status { font-size: 0.75rem; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.player-online { color: var(--success); }

/* ================================================
   EMPTY STATE
   ================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: var(--bg-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
  animation: float 4s ease-in-out infinite;
  transition: background var(--transition);
}

.empty-state:hover .empty-state-icon {
  background: var(--bg-card);
}

.empty-state-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-white);
  margin-bottom: 8px;
}

.empty-state-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ================================================
   FOOTER
   ================================================ */
.footer {
  padding: 20px 28px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text-primary); }

/* ================================================
   LOADING SPINNER
   ================================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--text-white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; border-width: 2px; }

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 5, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
  animation: fadeIn 0.2s ease;
}

/* ================================================
   RESOURCE USAGE BARS
   ================================================ */
.resource-usage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.resource-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.82rem;
}
.resource-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 500;
}
.resource-label i { width: 16px; text-align: center; }
.resource-value { color: var(--text-white); font-weight: 600; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }

/* ================================================
   CHARTS
   ================================================ */
.chart-container {
  position: relative;
  height: 200px;
  width: 100%;
}

.chart-line {
  stroke: var(--text-white);
  stroke-width: 2;
  fill: none;
}

.chart-area {
  fill: url(#chartGradient);
  opacity: 0.2;
}

/* ================================================
   DROPZONE
   ================================================ */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--text-white);
  background: rgba(255, 255, 255, 0.03);
  transform: scale(1.01);
}

.dropzone i { font-size: 2.5rem; color: var(--text-muted); margin-bottom: 12px; transition: color var(--transition); }
.dropzone:hover i { color: var(--text-white); }
.dropzone-text { color: var(--text-secondary); font-size: 0.9rem; }
.dropzone-hint { color: var(--text-muted); font-size: 0.78rem; margin-top: 6px; }

/* ================================================
   UTILITY CLASSES
   ================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-nowrap { white-space: nowrap; }
.w-full { width: 100%; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.hidden { display: none; }

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1024px) {
  .server-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 260px; --header-height: 56px; }
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .page-content { padding: 20px 16px; }
  .header { padding: 0 16px; }
  .server-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-card-value { font-size: 1.4rem; }
  .profile-header-card { flex-direction: column; text-align: center; padding: 24px; }
  .profile-meta { justify-content: center; }
  .footer { flex-direction: column; text-align: center; padding: 16px; }
  .footer-links { justify-content: center; }
  .auth-card { padding: 28px 22px; }
  .server-card-stats { grid-template-columns: repeat(3, 1fr); }
  .file-meta { display: none; }
  .plugin-grid { grid-template-columns: 1fr; }
  .players-grid { grid-template-columns: 1fr 1fr; }
  .notif-dropdown { width: min(360px, calc(100vw - 32px)); right: 0; }
  .console-output { height: 350px; }
  .header-breadcrumb { display: none; }
  .page-title { font-size: 1.3rem; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .players-grid { grid-template-columns: 1fr; }
  .server-nav-item { padding: 8px 12px; font-size: 0.8rem; }
  .btn { padding: 8px 14px; font-size: 0.82rem; }
  .page-content { padding: 16px 12px; }
  .header { padding: 0 12px; }
  .auth-card { padding: 24px 18px; }
  .auth-brand-icon { width: 52px; height: 52px; font-size: 22px; }
}

/* ================================================
   REDUCED MOTION PREFERENCE
   ================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ================================================
   ADMIN PAGES - NEUTRAL DARK THEME (NO RED BLEED)
   ================================================ */

/* Card base */
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.admin-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.admin-card-header {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-card-header h6 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 0;
}

.admin-card-body { padding: 0; }

/* Stats cards */
.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.stats-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stats-card-icon {
  font-size: 28px;
  opacity: 0.35;
  color: var(--text-primary);
  flex-shrink: 0;
  line-height: 1;
}

.stats-card-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

.stats-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.2;
  margin: 0;
}

/* Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.admin-table thead {
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  padding: 12px 16px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.88rem;
}

.admin-table tbody tr { transition: background var(--transition-fast); }
.admin-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.admin-table tbody tr:last-child td { border-bottom: none; }

/* Form */
.admin-form-group { margin-bottom: 20px; }

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

.admin-form-group label .required {
  color: var(--danger);
  margin-left: 4px;
}

.admin-form-control {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.admin-form-control:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--text-white);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

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

.admin-form-control:disabled {
  background: var(--bg-dark);
  color: var(--text-muted);
  cursor: not-allowed;
}

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

/* Buttons — neutral by default, semantic only when explicitly requested */
.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.admin-btn:active { transform: scale(0.98); }
.admin-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.admin-btn-primary {
  background: var(--text-white);
  border-color: var(--text-white);
  color: var(--bg-black);
}

.admin-btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.admin-btn-primary:disabled {
  background: var(--text-muted);
  border-color: var(--text-muted);
}

.admin-btn-danger {
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--danger);
}

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

.admin-btn-success {
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--success);
}

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

.admin-btn-warning {
  border-color: rgba(234, 179, 8, 0.4);
  color: var(--warning);
}

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

.admin-btn-info {
  border-color: rgba(59, 130, 246, 0.4);
  color: var(--info);
}

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

/* Badges */
.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-secondary);
}

.admin-badge-success { background: var(--success-bg); color: var(--success); }
.admin-badge-danger { background: var(--danger-bg); color: var(--danger); }
.admin-badge-warning { background: var(--warning-bg); color: var(--warning); }
.admin-badge-info { background: var(--info-bg); color: var(--info); }
.admin-badge-secondary { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }

/* Heartbeat Status Indicators */
.admin-heartbeat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.admin-heartbeat i {
  font-size: 1rem;
  animation: heartbeat 1.2s ease-in-out infinite;
}

.admin-heartbeat.online i {
  color: #22c55e;
  animation: heartbeat 1.2s ease-in-out infinite, heartbeat-glow-green 1.2s ease-in-out infinite;
}

.admin-heartbeat.offline i {
  color: #ef4444;
  animation: heartbeat 1.2s ease-in-out infinite, heartbeat-glow-red 1.2s ease-in-out infinite;
}

.admin-heartbeat .heartbeat-text {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-heartbeat.online .heartbeat-text {
  color: #22c55e;
}

.admin-heartbeat.offline .heartbeat-text {
  color: #ef4444;
}

/* Progress */
.admin-progress {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.admin-progress-bar {
  height: 100%;
  background: var(--text-white);
  border-radius: 4px;
  transition: width var(--transition);
}

.admin-progress-bar-success { background: var(--success); }
.admin-progress-bar-danger { background: var(--danger); }
.admin-progress-bar-warning { background: var(--warning); }
.admin-progress-bar-info { background: var(--info); }

/* Port ranges */
.port-range-item {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  align-items: end;
}

.port-range-item-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* Loading */
.admin-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.admin-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--text-white);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.admin-loading-text {
  color: var(--text-muted);
  margin-top: 16px;
  font-size: 0.88rem;
}

/* Empty */
.admin-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.admin-empty-icon {
  font-size: 48px;
  opacity: 0.25;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.admin-empty-text {
  font-size: 0.88rem;
  margin-bottom: 24px;
}

/* Grid */
.admin-grid { display: grid; gap: 20px; }
.admin-grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.admin-grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.admin-grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Flex */
.admin-flex { display: flex; align-items: center; }
.admin-flex-between { display: flex; justify-content: space-between; align-items: center; }
.admin-flex-gap { display: flex; gap: 12px; align-items: center; }

/* Colors */
.admin-text-success { color: var(--success); }
.admin-text-danger { color: var(--danger); }
.admin-text-warning { color: var(--warning); }
.admin-text-info { color: var(--info); }
.admin-text-muted { color: var(--text-muted); }

/* Focus-visible accessibility */
.admin-btn:focus-visible,
.admin-form-control:focus-visible,
.admin-table a:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.sidebar-nav-item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-grid-2, .admin-grid-3 { grid-template-columns: 1fr; }
  .admin-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .port-range-item { grid-template-columns: 1fr 1fr; }
  .admin-table { font-size: 0.8rem; }
  .admin-table th, .admin-table td { padding: 8px 12px; }
}


/* ============================================================
   ADMIN THEME ISOLATION / RED-BLEED FIX
   ------------------------------------------------------------
   Load this file AFTER Bootstrap and the normal public stylesheet.
   The admin scope is detected from the existing admin components,
   so the public/user panel keeps its current theme unchanged.
   ============================================================ */

body:has(.admin-card),
body:has(.admin-table),
body:has(.admin-btn),
body.admin-page,
body[data-page^="admin"] {
  /* Admin-only semantic palette */
  --admin-bg-black: #050505;
  --admin-bg-dark: #0a0a0a;
  --admin-bg-card: #111111;
  --admin-bg-card-hover: #161616;
  --admin-bg-input: #080808;
  --admin-bg-input-focus: #0f0f0f;
  --admin-bg-sidebar: #070707;
  --admin-bg-header: #070707;

  --admin-border: #1e1e1e;
  --admin-border-hover: #2a2a2a;
  --admin-border-light: #181818;

  --admin-text-primary: #f5f5f5;
  --admin-text-secondary: #a3a3a3;
  --admin-text-muted: #6b6b6b;
  --admin-text-white: #ffffff;

  --admin-primary: #ffffff;
  --admin-primary-hover: #e0e0e0;
  --admin-primary-light: #f0f0f0;

  --admin-success: #22c55e;
  --admin-success-bg: rgba(34, 197, 94, .10);
  --admin-success-border: rgba(34, 197, 94, .25);

  --admin-warning: #eab308;
  --admin-warning-bg: rgba(234, 179, 8, .10);
  --admin-warning-border: rgba(234, 179, 8, .25);

  --admin-danger: #ef4444;
  --admin-danger-bg: rgba(239, 68, 68, .10);
  --admin-danger-border: rgba(239, 68, 68, .25);

  --admin-info: #3b82f6;
}

/* Rebind shared theme variables ONLY while an admin page is present.
   This is the key isolation layer: public pages never receive these
   declarations because their body does not match the admin scope. */
body:has(.admin-card),
body:has(.admin-table),
body:has(.admin-btn),
body.admin-page,
body[data-page^="admin"] {
  --bg-black: var(--admin-bg-black);
  --bg-dark: var(--admin-bg-dark);
  --bg-card: var(--admin-bg-card);
  --bg-card-hover: var(--admin-bg-card-hover);
  --bg-input: var(--admin-bg-input);
  --bg-input-focus: var(--admin-bg-input-focus);
  --bg-sidebar: var(--admin-bg-sidebar);
  --bg-header: var(--admin-bg-header);

  --border: var(--admin-border);
  --border-hover: var(--admin-border-hover);
  --border-light: var(--admin-border-light);

  --text-primary: var(--admin-text-primary);
  --text-secondary: var(--admin-text-secondary);
  --text-muted: var(--admin-text-muted);
  --text-white: var(--admin-text-white);

  --primary: var(--admin-primary);
  --primary-hover: var(--admin-primary-hover);
  --primary-light: var(--admin-primary-light);

  --success: var(--admin-success);
  --success-bg: var(--admin-success-bg);
  --success-border: var(--admin-success-border);

  --warning: var(--admin-warning);
  --warning-bg: var(--admin-warning-bg);
  --warning-border: var(--admin-warning-border);

  --danger: var(--admin-danger);
  --danger-bg: var(--admin-danger-bg);
  --danger-border: var(--admin-danger-border);

  --info: var(--admin-info);
}

/* ---------- Shared admin shell ---------- */
body:has(.admin-card) .app-wrapper,
body:has(.admin-table) .app-wrapper,
body:has(.admin-btn) .app-wrapper,
body.admin-page .app-wrapper,
body[data-page^="admin"] .app-wrapper {
  background: var(--admin-bg-black);
}

body:has(.admin-card) .sidebar,
body:has(.admin-table) .sidebar,
body:has(.admin-btn) .sidebar,
body.admin-page .sidebar,
body[data-page^="admin"] .sidebar {
  background: var(--admin-bg-sidebar);
  border-color: var(--admin-border);
}

body:has(.admin-card) .header,
body:has(.admin-table) .header,
body:has(.admin-btn) .header,
body.admin-page .header,
body[data-page^="admin"] .header {
  background: rgba(7, 7, 7, .92);
  border-color: var(--admin-border);
}

body:has(.admin-card) .main-content,
body:has(.admin-table) .main-content,
body:has(.admin-btn) .main-content,
body.admin-page .main-content,
body[data-page^="admin"] .main-content {
  background: var(--admin-bg-black);
  color: var(--admin-text-primary);
}

/* Sidebar/navbar must never inherit a danger/red accent. */
body:has(.admin-card) .sidebar-nav-item,
body:has(.admin-table) .sidebar-nav-item,
body:has(.admin-btn) .sidebar-nav-item,
body.admin-page .sidebar-nav-item,
body[data-page^="admin"] .sidebar-nav-item {
  color: var(--admin-text-secondary);
}

body:has(.admin-card) .sidebar-nav-item:hover,
body:has(.admin-table) .sidebar-nav-item:hover,
body:has(.admin-btn) .sidebar-nav-item:hover,
body.admin-page .sidebar-nav-item:hover,
body[data-page^="admin"] .sidebar-nav-item:hover {
  background: var(--admin-bg-card);
  color: var(--admin-text-primary);
}

body:has(.admin-card) .sidebar-nav-item.active,
body:has(.admin-table) .sidebar-nav-item.active,
body:has(.admin-btn) .sidebar-nav-item.active,
body.admin-page .sidebar-nav-item.active,
body[data-page^="admin"] .sidebar-nav-item.active,
body:has(.admin-card) .sidebar-nav-item.admin-active,
body:has(.admin-table) .sidebar-nav-item.admin-active,
body:has(.admin-btn) .sidebar-nav-item.admin-active,
body.admin-page .sidebar-nav-item.admin-active,
body[data-page^="admin"] .sidebar-nav-item.admin-active {
  background: var(--admin-text-white) !important;
  color: var(--admin-bg-black) !important;
  box-shadow: 0 2px 16px rgba(255,255,255,.15);
}

body:has(.admin-card) .sidebar-nav-item.active i,
body:has(.admin-table) .sidebar-nav-item.active i,
body:has(.admin-btn) .sidebar-nav-item.active i,
body.admin-page .sidebar-nav-item.active i,
body[data-page^="admin"] .sidebar-nav-item.active i,
body:has(.admin-card) .sidebar-nav-item.admin-active i,
body:has(.admin-table) .sidebar-nav-item.admin-active i,
body:has(.admin-btn) .sidebar-nav-item.admin-active i,
body.admin-page .sidebar-nav-item.admin-active i,
body[data-page^="admin"] .sidebar-nav-item.admin-active i {
  color: var(--admin-bg-black);
}

body:has(.admin-card) .sidebar-nav-item.active::before,
body:has(.admin-table) .sidebar-nav-item.active::before,
body:has(.admin-btn) .sidebar-nav-item.active::before,
body.admin-page .sidebar-nav-item.active::before,
body[data-page^="admin"] .sidebar-nav-item.active::before,
body:has(.admin-card) .sidebar-nav-item.admin-active::before,
body:has(.admin-table) .sidebar-nav-item.admin-active::before,
body:has(.admin-btn) .sidebar-nav-item.admin-active::before,
body.admin-page .sidebar-nav-item.admin-active::before,
body[data-page^="admin"] .sidebar-nav-item.admin-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--admin-bg-black);
  border-radius: 0 3px 3px 0;
  opacity: 0.8;
}

/* ---------- Cards ---------- */
body:has(.admin-card) .card,
body:has(.admin-card) .admin-card,
body:has(.admin-table) .card,
body:has(.admin-table) .admin-card,
body:has(.admin-btn) .card,
body:has(.admin-btn) .admin-card,
body.admin-page .card,
body.admin-page .admin-card {
  background: var(--admin-bg-card);
  border-color: var(--admin-border);
  color: var(--admin-text-primary);
}

body:has(.admin-card) .card-header,
body:has(.admin-card) .card-footer,
body:has(.admin-table) .card-header,
body:has(.admin-table) .card-footer,
body.admin-page .card-header,
body.admin-page .card-footer {
  border-color: var(--admin-border);
}

/* ---------- Tables ---------- */
body:has(.admin-table) table,
body:has(.admin-card) .admin-table,
body:has(.admin-table) .admin-table,
body.admin-page .admin-table {
  background: var(--admin-bg-card);
  color: var(--admin-text-primary);
}

body:has(.admin-table) .admin-table thead,
body:has(.admin-table) .admin-table th {
  background: var(--admin-bg-dark);
  color: var(--admin-text-muted);
  border-color: var(--admin-border);
}

body:has(.admin-table) .admin-table td {
  color: var(--admin-text-primary);
  border-color: var(--admin-border-light);
}

body:has(.admin-table) .admin-table tbody tr:hover td {
  background: var(--admin-bg-card-hover);
}

/* ---------- Forms ---------- */
body:has(.admin-card) .form-control,
body:has(.admin-card) .form-select,
body:has(.admin-table) .form-control,
body:has(.admin-table) .form-select,
body:has(.admin-btn) .form-control,
body:has(.admin-btn) .form-select,
body.admin-page .form-control,
body.admin-page .form-select {
  background-color: var(--admin-bg-input);
  color: var(--admin-text-primary);
  border-color: var(--admin-border);
}

body:has(.admin-card) .form-control:focus,
body:has(.admin-card) .form-select:focus,
body:has(.admin-table) .form-control:focus,
body:has(.admin-table) .form-select:focus,
body:has(.admin-btn) .form-control:focus,
body:has(.admin-btn) .form-select:focus,
body.admin-page .form-control:focus,
body.admin-page .form-select:focus {
  background-color: var(--admin-bg-input-focus);
  color: var(--admin-text-primary);
  border-color: var(--admin-text-white);
  box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}

body:has(.admin-card) .form-control::placeholder,
body:has(.admin-table) .form-control::placeholder,
body:has(.admin-btn) .form-control::placeholder,
body.admin-page .form-control::placeholder {
  color: var(--admin-text-muted);
}

/* ---------- Bootstrap neutralization ----------
   Bootstrap semantic classes are allowed only when explicitly semantic.
   Primary = black/white. Danger = red only. Success = green. Warning = yellow. */
body:has(.admin-card) .btn-primary,
body:has(.admin-table) .btn-primary,
body:has(.admin-btn) .btn-primary,
body.admin-page .btn-primary {
  background-color: var(--admin-text-white) !important;
  border-color: var(--admin-text-white) !important;
  color: var(--admin-bg-black) !important;
}

body:has(.admin-card) .btn-primary:hover,
body:has(.admin-table) .btn-primary:hover,
body:has(.admin-btn) .btn-primary:hover,
body.admin-page .btn-primary:hover {
  background-color: var(--admin-primary-hover) !important;
  border-color: var(--admin-primary-hover) !important;
  color: var(--admin-bg-black) !important;
}

body:has(.admin-card) .btn-secondary,
body:has(.admin-table) .btn-secondary,
body:has(.admin-btn) .btn-secondary,
body.admin-page .btn-secondary {
  background-color: var(--admin-bg-dark) !important;
  border-color: var(--admin-border) !important;
  color: var(--admin-text-primary) !important;
}

body:has(.admin-card) .btn-danger,
body:has(.admin-table) .btn-danger,
body:has(.admin-btn) .btn-danger,
body.admin-page .btn-danger {
  background-color: var(--admin-danger) !important;
  border-color: var(--admin-danger) !important;
  color: #fff !important;
}

body:has(.admin-card) .btn-success,
body:has(.admin-table) .btn-success,
body:has(.admin-btn) .btn-success,
body.admin-page .btn-success {
  background-color: var(--admin-success) !important;
  border-color: var(--admin-success) !important;
  color: #fff !important;
}

body:has(.admin-card) .btn-warning,
body:has(.admin-table) .btn-warning,
body:has(.admin-btn) .btn-warning,
body.admin-page .btn-warning {
  background-color: var(--admin-warning) !important;
  border-color: var(--admin-warning) !important;
  color: #1a1a1a !important;
}

/* Bootstrap text/background/border helpers */
body:has(.admin-card) .text-primary,
body:has(.admin-table) .text-primary,
body:has(.admin-btn) .text-primary,
body.admin-page .text-primary {
  color: var(--admin-text-white) !important;
}

body:has(.admin-card) .bg-primary,
body:has(.admin-table) .bg-primary,
body:has(.admin-btn) .bg-primary,
body.admin-page .bg-primary {
  background-color: var(--admin-text-white) !important;
  color: var(--admin-bg-black) !important;
}

body:has(.admin-card) .border-primary,
body:has(.admin-table) .border-primary,
body:has(.admin-btn) .border-primary,
body.admin-page .border-primary {
  border-color: var(--admin-text-white) !important;
}

/* Bootstrap table/status helpers */
body:has(.admin-card) .table-primary,
body:has(.admin-table) .table-primary,
body:has(.admin-btn) .table-primary,
body.admin-page .table-primary {
  --bs-table-bg: rgba(255,255,255,.05);
  --bs-table-color: var(--admin-text-primary);
  background-color: rgba(255,255,255,.05) !important;
  color: var(--admin-text-primary) !important;
}

/* Bootstrap form validation must remain semantic, not globally red. */
body:has(.admin-card) .form-check-input:checked,
body:has(.admin-table) .form-check-input:checked,
body:has(.admin-btn) .form-check-input:checked,
body.admin-page .form-check-input:checked {
  background-color: var(--admin-text-white);
  border-color: var(--admin-text-white);
}

body:has(.admin-card) .form-check-input:focus,
body:has(.admin-table) .form-check-input:focus,
body:has(.admin-btn) .form-check-input:focus,
body.admin-page .form-check-input:focus {
  border-color: var(--admin-text-white);
  box-shadow: 0 0 0 .25rem rgba(255,255,255,.10);
}

/* ---------- Admin-specific components ---------- */
body:has(.admin-card) .admin-btn,
body:has(.admin-table) .admin-btn,
body:has(.admin-btn) .admin-btn,
body.admin-page .admin-btn {
  background: var(--admin-bg-dark);
  border-color: var(--admin-border);
  color: var(--admin-text-primary);
}

body:has(.admin-card) .admin-btn-primary,
body:has(.admin-table) .admin-btn-primary,
body:has(.admin-btn) .admin-btn-primary,
body.admin-page .admin-btn-primary {
  background: var(--admin-text-white);
  border-color: var(--admin-text-white);
  color: var(--admin-bg-black);
}

body:has(.admin-card) .admin-btn-danger,
body:has(.admin-table) .admin-btn-danger,
body:has(.admin-btn) .admin-btn-danger,
body.admin-page .admin-btn-danger {
  background: transparent;
  border-color: rgba(239,68,68,.4);
  color: var(--admin-danger);
}

body:has(.admin-card) .admin-btn-danger:hover,
body:has(.admin-table) .admin-btn-danger:hover,
body:has(.admin-btn) .admin-btn-danger:hover,
body.admin-page .admin-btn-danger:hover {
  background: var(--admin-danger-bg);
  border-color: var(--admin-danger);
  color: var(--admin-danger);
}

body:has(.admin-card) .admin-btn-success,
body:has(.admin-table) .admin-btn-success,
body:has(.admin-btn) .admin-btn-success,
body.admin-page .admin-btn-success {
  background: transparent;
  border-color: rgba(34,197,94,.4);
  color: var(--admin-success);
}

body:has(.admin-card) .admin-btn-warning,
body:has(.admin-table) .admin-btn-warning,
body:has(.admin-btn) .admin-btn-warning,
body.admin-page .admin-btn-warning {
  background: transparent;
  border-color: rgba(234,179,8,.4);
  color: var(--admin-warning);
}

body:has(.admin-card) .admin-badge,
body:has(.admin-table) .admin-badge,
body:has(.admin-btn) .admin-badge,
body.admin-page .admin-badge {
  background: rgba(255,255,255,.06);
  color: var(--admin-text-secondary);
}

body:has(.admin-card) .admin-badge-success,
body:has(.admin-table) .admin-badge-success,
body:has(.admin-btn) .admin-badge-success,
body.admin-page .admin-badge-success {
  background: var(--admin-success-bg);
  color: var(--admin-success);
}

body:has(.admin-card) .admin-badge-danger,
body:has(.admin-table) .admin-badge-danger,
body:has(.admin-btn) .admin-badge-danger,
body.admin-page .admin-badge-danger {
  background: var(--admin-danger-bg);
  color: var(--admin-danger);
}

body:has(.admin-card) .admin-badge-warning,
body:has(.admin-table) .admin-badge-warning,
body:has(.admin-btn) .admin-badge-warning,
body.admin-page .admin-badge-warning {
  background: var(--admin-warning-bg);
  color: var(--admin-warning);
}

/* Semantic status rules: active/running = green, suspended = yellow,
   danger/delete/offline = red. Everything else stays neutral. */
body:has(.admin-card) .status-active,
body:has(.admin-card) .status-running,
body:has(.admin-card) .status-online,
body:has(.admin-table) .status-active,
body:has(.admin-table) .status-running,
body:has(.admin-table) .status-online,
body.admin-page .status-active,
body.admin-page .status-running,
body.admin-page .status-online {
  color: var(--admin-success) !important;
}

body:has(.admin-card) .status-suspended,
body:has(.admin-table) .status-suspended,
body.admin-page .status-suspended {
  color: var(--admin-warning) !important;
}

body:has(.admin-card) .status-danger,
body:has(.admin-card) .status-deleted,
body:has(.admin-table) .status-danger,
body:has(.admin-table) .status-deleted,
body.admin-page .status-danger,
body.admin-page .status-deleted {
  color: var(--admin-danger) !important;
}

/* Prevent generic red utility classes from painting the whole admin UI.
   Only explicit danger elements keep red. */
body:has(.admin-card) .admin-text-primary,
body:has(.admin-table) .admin-text-primary,
body.admin-page .admin-text-primary {
  color: var(--admin-text-primary);
}

/* Modals/dropdowns */
body:has(.admin-card) .modal-content,
body:has(.admin-table) .modal-content,
body:has(.admin-btn) .modal-content,
body.admin-page .modal-content {
  background: var(--admin-bg-card);
  color: var(--admin-text-primary);
  border-color: var(--admin-border);
}

body:has(.admin-card) .modal-header,
body:has(.admin-table) .modal-header,
body:has(.admin-btn) .modal-header,
body.admin-page .modal-header,
body:has(.admin-card) .modal-footer,
body:has(.admin-table) .modal-footer,
body:has(.admin-btn) .modal-footer,
body.admin-page .modal-footer {
  border-color: var(--admin-border);
}

/* Links/icons are neutral by default; semantic classes remain semantic. */
body:has(.admin-card) a:not(.btn):not(.admin-btn),
body:has(.admin-table) a:not(.btn):not(.admin-btn),
body:has(.admin-btn) a:not(.btn):not(.admin-btn),
body.admin-page a:not(.btn):not(.admin-btn) {
  color: var(--admin-text-primary);
}

body:has(.admin-card) a:not(.btn):not(.admin-btn):hover,
body:has(.admin-table) a:not(.btn):not(.admin-btn):hover,
body:has(.admin-btn) a:not(.btn):not(.admin-btn):hover,
body.admin-page a:not(.btn):not(.admin-btn):hover {
  color: var(--admin-text-white);
}

/* Do NOT neutralize explicit semantic utility classes. */
body:has(.admin-card) .text-danger,
body:has(.admin-table) .text-danger,
body:has(.admin-btn) .text-danger,
body.admin-page .text-danger {
  color: var(--admin-danger) !important;
}

body:has(.admin-card) .text-success,
body:has(.admin-table) .text-success,
body:has(.admin-btn) .text-success,
body.admin-page .text-success {
  color: var(--admin-success) !important;
}

body:has(.admin-card) .text-warning,
body:has(.admin-table) .text-warning,
body:has(.admin-btn) .text-warning,
body.admin-page .text-warning {
  color: var(--admin-warning) !important;
}

/* ============================================================
   END ADMIN THEME ISOLATION
   ============================================================ */
/* ============================================================
   ADMIN MODAL ABSOLUTE VIEWPORT FIX (OVERRIDE)
   ============================================================ */

/* 1. Force the backdrop to cover the whole screen and ignore parent containers */
body:has(.admin-card) .modal-backdrop,
body:has(.admin-table) .modal-backdrop,
body:has(.admin-btn) .modal-backdrop,
body.admin-page .modal-backdrop,
body[data-page^="admin"] .modal-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  padding: 20px !important;
  z-index: 999999 !important; /* Highest priority */
  
  /* Flexbox to center the modal */
  display: none; /* Hidden by default */
  align-items: center !important;
  justify-content: center !important;
  
  background-color: rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
}

/* Show the modal when the 'show' class is present */
body:has(.admin-card) .modal-backdrop.show,
body:has(.admin-table) .modal-backdrop.show,
body:has(.admin-btn) .modal-backdrop.show,
body.admin-page .modal-backdrop.show,
body[data-page^="admin"] .modal-backdrop.show {
  display: flex !important;
}

/* 2. Fix the modal box itself */
body:has(.admin-card) .modal-backdrop .modal,
body:has(.admin-table) .modal-backdrop .modal,
body:has(.admin-btn) .modal-backdrop .modal,
body.admin-page .modal-backdrop .modal,
body[data-page^="admin"] .modal-backdrop .modal,
body:has(.admin-card) .modal-backdrop .modal-content,
body.admin-page .modal-backdrop .modal-content {
  position: relative !important;
  margin: 0 !important; /* Removes any auto margins causing it to shift down */
  width: 100% !important;
  max-width: 500px !important;
  max-height: calc(100vh - 40px) !important; /* Prevents it from going off-screen */
  overflow-y: auto !important; /* Adds scroll if content is too long */
  
  background-color: #111111 !important; /* Force dark background */
  border: 1px solid #2a2a2a !important;
  border-radius: 10px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8) !important;
}

/* 3. Prevent background scrolling when modal is open */
body.modal-open {
  overflow: hidden !important;
}


/* ================================================================
 * ADMIN MODAL POSITIONING FIX - COMPREHENSIVE SOLUTION
 * ================================================================
 * These rules ensure modals appear centered in viewport on admin pages
 * Scoped ONLY to admin pages via body:has(.admin-*) selectors
 * Does NOT affect public pages
 * ================================================================ */

/* 1. Admin modal root - viewport-level container */
body:has(.admin-btn) #modal-root,
body:has(.admin-card) #modal-root,
body:has(.admin-table) #modal-root,
body.admin-page #modal-root,
body[data-page^="admin"] #modal-root {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* 2. Admin modal backdrop - full viewport with enhanced blur */
body:has(.admin-btn) .modal-backdrop,
body:has(.admin-card) .modal-backdrop,
body:has(.admin-table) .modal-backdrop,
body.admin-page .modal-backdrop,
body[data-page^="admin"] .modal-backdrop {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99998;
  pointer-events: none;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
}

body:has(.admin-btn) .modal-backdrop.active,
body:has(.admin-card) .modal-backdrop.active,
body:has(.admin-table) .modal-backdrop.active,
body.admin-page .modal-backdrop.active,
body[data-page^="admin"] .modal-backdrop.active {
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* 3. Admin modal container - flex centering */
body:has(.admin-btn) .modal-container,
body:has(.admin-card) .modal-container,
body:has(.admin-table) .modal-container,
body.admin-page .modal-container,
body[data-page^="admin"] .modal-container {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: none;
}

body:has(.admin-btn) .modal-container.active,
body:has(.admin-card) .modal-container.active,
body:has(.admin-table) .modal-container.active,
body.admin-page .modal-container.active,
body[data-page^="admin"] .modal-container.active {
  pointer-events: auto;
}

/* 4. Admin modal content - responsive sizing with scroll */
body:has(.admin-btn) .modal-content,
body:has(.admin-card) .modal-content,
body:has(.admin-table) .modal-content,
body.admin-page .modal-content,
body[data-page^="admin"] .modal-content {
  width: min(90vw, 500px);
  max-width: 90vw;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 1;
}

/* 5. Lock background scrolling when admin modal is visible */
html:has(#modal-root .modal-container.active),
body:has(#modal-root .modal-container.active) {
  overflow: hidden;
}

/* 6. Ensure main-content doesn't interfere with modal stacking */
body:has(.admin-btn) .main-content,
body:has(.admin-card) .main-content,
body:has(.admin-table) .main-content,
body.admin-page .main-content,
body[data-page^="admin"] .main-content {
  position: static;
  z-index: auto;
}

/* 7. Ensure footer doesn't block modal */
body:has(.admin-btn) .footer,
body:has(.admin-card) .footer,
body:has(.admin-table) .footer,
body.admin-page .footer,
body[data-page^="admin"] .footer {
  position: static;
  z-index: auto;
}

/* 8. Modal body scrollbar styling for admin */
body:has(.admin-btn) .modal-body::-webkit-scrollbar,
body:has(.admin-card) .modal-body::-webkit-scrollbar,
body:has(.admin-table) .modal-body::-webkit-scrollbar,
body.admin-page .modal-body::-webkit-scrollbar,
body[data-page^="admin"] .modal-body::-webkit-scrollbar {
  width: 8px;
}

body:has(.admin-btn) .modal-body::-webkit-scrollbar-track,
body:has(.admin-card) .modal-body::-webkit-scrollbar-track,
body:has(.admin-table) .modal-body::-webkit-scrollbar-track,
body.admin-page .modal-body::-webkit-scrollbar-track,
body[data-page^="admin"] .modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

body:has(.admin-btn) .modal-body::-webkit-scrollbar-thumb,
body:has(.admin-card) .modal-body::-webkit-scrollbar-thumb,
body:has(.admin-table) .modal-body::-webkit-scrollbar-thumb,
body.admin-page .modal-body::-webkit-scrollbar-thumb,
body[data-page^="admin"] .modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

body:has(.admin-btn) .modal-body::-webkit-scrollbar-thumb:hover,
body:has(.admin-card) .modal-body::-webkit-scrollbar-thumb:hover,
body:has(.admin-table) .modal-body::-webkit-scrollbar-thumb:hover,
body.admin-page .modal-body::-webkit-scrollbar-thumb:hover,
body[data-page^="admin"] .modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* End of Admin Modal Positioning Fix */


/* ================================================
   TOAST NOTIFICATIONS - Premium Glassmorphism
   ================================================ */

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  max-width: 420px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 480px) {
  #toast-container {
    top: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }
}

.toast {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 
    0 16px 48px rgba(0, 0, 0, 0.6),
    0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 1px rgba(255, 255, 255, 0.03);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%) translateY(-10px) scale(0.96);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: none;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
  opacity: 0.9;
}

.toast.show {
  opacity: 1;
  transform: translateX(0) translateY(0) scale(1);
}

.toast-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.toast-message {
  font-size: 0.88rem;
  color: #f5f5f5;
  line-height: 1.55;
  word-break: break-word;
  font-weight: 400;
}

.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #6b6b6b;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5f5;
  transform: scale(1.1);
}

.toast-close:active {
  transform: scale(0.95);
}

/* Toast color variants */
.toast-success {
  border-color: rgba(34, 197, 94, 0.25);
}

.toast-success::before {
  background: linear-gradient(180deg, #22c55e, #16a34a);
}

.toast-success .toast-icon {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.25);
}

.toast-error::before {
  background: linear-gradient(180deg, #ef4444, #dc2626);
}

.toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.toast-warning {
  border-color: rgba(234, 179, 8, 0.25);
}

.toast-warning::before {
  background: linear-gradient(180deg, #eab308, #ca8a04);
}

.toast-warning .toast-icon {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.toast-info {
  border-color: rgba(59, 130, 246, 0.25);
}

.toast-info::before {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
}

.toast-info .toast-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Responsive */
@media (max-width: 480px) {
  .toast {
    padding: 14px 16px;
    border-radius: 12px;
  }
  .toast-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
  .toast-message {
    font-size: 0.85rem;
  }
  .toast-close {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
}





/* ============================================================
   FINAL ACCESSIBILITY, RESPONSIVE, AND MODAL SAFETY FIXES
   ============================================================ */

/* Keep modal layers above page content without creating a second animation. */
.modal-backdrop,
.modal-container {
  box-sizing: border-box;
}

.modal-backdrop {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-content {
  min-width: 0;
  max-width: min(500px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overscroll-behavior: contain;
}

.modal-content > * {
  min-width: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 3px;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

@media (max-width: 600px) {
  .page-content {
    padding: 18px 14px;
  }

  .header {
    padding-left: 14px;
    padding-right: 14px;
  }

  .server-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-backdrop,
  .modal-container {
    padding: 12px;
  }

  .modal-content,
  .modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .modal-header {
    padding: 18px 18px 14px;
  }

  .modal-body {
    padding: 16px 18px;
  }

  .modal-footer {
    padding: 14px 18px 18px;
  }

  .file-meta {
    gap: 10px;
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
