/* ========== Design Tokens ========== */
:root {
  --bg-primary: #070714;
  --bg-secondary: #0c0c1d;
  --bg-tertiary: #131330;
  --bg-card: rgba(19, 19, 48, 0.6);
  --bg-card-hover: rgba(25, 25, 60, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);

  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(99, 102, 241, 0.3);

  --text-primary: #eaeaf4;
  --text-secondary: #9898b8;
  --text-muted: #5a5a7a;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --gradient: linear-gradient(135deg, #8B5CF6, #6366F1, #3B82F6);
  --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
  --gradient-green: linear-gradient(135deg, #22c55e, #10b981);

  --ultra: #f59e0b;
  --ultra-bg: rgba(245, 158, 11, 0.1);
  --ultra-border: rgba(245, 158, 11, 0.3);
  --pro: #6366f1;
  --pro-bg: rgba(99, 102, 241, 0.1);
  --pro-border: rgba(99, 102, 241, 0.3);
  --normal: #22c55e;
  --normal-bg: rgba(34, 197, 94, 0.1);
  --normal-border: rgba(34, 197, 94, 0.3);

  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px var(--accent-glow);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Reset ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: var(--text-primary); outline: none; }
input, textarea, select { font-family: inherit; outline: none; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.hidden { display: none !important; }

/* ========== Background Effects ========== */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  z-index: -1;
  animation: bgShift 20s ease-in-out infinite alternate;
}
@keyframes bgShift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-3%, -2%); }
}

/* ========== Navbar ========== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  background: rgba(7, 7, 20, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-brand svg { filter: drop-shadow(0 0 8px var(--accent-glow)); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-glass-hover); text-decoration: none; }
.nav-link.active { color: var(--text-primary); background: rgba(99, 102, 241, 0.1); }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.btn-outline {
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--text-primary); background: var(--bg-glass-hover); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-glass-hover); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn-ultra { background: var(--ultra); color: #000; }
.btn-ultra:hover { box-shadow: 0 0 20px rgba(245,158,11,0.3); }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #dc2626; }

/* ========== Hero Section ========== */
.hero {
  text-align: center;
  padding: 60px 24px 40px;
  max-width: 720px;
  margin: 0 auto;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.hero-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}
.hero h1 {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}
.hero h1 .gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto;
}

/* ========== Status Bar ========== */
.status-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0 24px;
  margin: 24px auto 0;
  flex-wrap: wrap;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}
.status-chip .dot-online { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }

/* ========== Announcements ========== */
.announcement-bar {
  max-width: 600px;
  margin: 20px auto 0;
  padding: 0 24px;
}
.announcement-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.announcement-item:hover { border-color: var(--accent); background: var(--bg-glass-hover); }
.announcement-item .ann-icon { color: var(--accent); font-size: 16px; }

/* ========== Node Grid ========== */
.section { padding: 40px 24px; max-width: 1100px; margin: 0 auto; }
.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.node-card {
  position: relative;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  transition: all var(--transition);
  cursor: pointer;
  overflow: hidden;
}
.node-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity var(--transition);
}
.node-card:hover {
  border-color: var(--border-glow);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.node-card:hover::before { opacity: 1; }
.node-card.ultra { border-color: var(--ultra-border); }
.node-card.ultra::before { background: var(--gradient-warm); opacity: 1; }
.node-card.pro::before { background: var(--gradient); }
.node-card.offline { opacity: 0.5; pointer-events: none; }

.node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.node-info { display: flex; align-items: center; gap: 12px; }
.node-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.node-icon.ultra { background: var(--ultra-bg); }
.node-icon.pro { background: var(--pro-bg); }
.node-icon.normal { background: var(--normal-bg); }

.node-name { font-size: 15px; font-weight: 600; }
.node-type-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.node-type-badge.ultra { background: var(--ultra-bg); color: var(--ultra); border: 1px solid var(--ultra-border); }
.node-type-badge.pro { background: var(--pro-bg); color: var(--pro); border: 1px solid var(--pro-border); }
.node-type-badge.normal { background: var(--normal-bg); color: var(--normal); border: 1px solid var(--normal-border); }

.node-load {
  margin-top: 4px;
}
.load-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.load-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}
.load-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.load-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
  background: var(--gradient-green);
}
.load-fill.medium { background: linear-gradient(90deg, #22c55e, #f59e0b); }
.load-fill.high { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.load-fill.full { background: var(--error); }
.load-text { font-size: 12px; color: var(--text-muted); min-width: 55px; text-align: right; }
.node-status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-top: 10px; }
.node-status .dot { width: 6px; height: 6px; border-radius: 50%; }
.node-status .dot.online { background: var(--success); animation: pulse 2s infinite; }
.node-status .dot.busy { background: var(--warning); }
.node-status .dot.offline { background: var(--error); }

/* ========== Modal ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 92%;
  max-width: 440px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease-out;
  overflow: hidden;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 17px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); justify-content: flex-end; }

/* ========== Form ========== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition);
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text-muted); }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--error); margin-top: 4px; }
.form-tabs { display: flex; gap: 2px; margin-bottom: 24px; background: var(--bg-tertiary); border-radius: var(--radius-sm); padding: 3px; }
.form-tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all var(--transition);
}
.form-tab.active { background: var(--accent); color: white; }
.form-tab:hover:not(.active) { color: var(--text-primary); }

/* ========== Profile Page ========== */
.profile-page { max-width: 600px; margin: 0 auto; padding: 40px 24px; }
.profile-card {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  margin-bottom: 20px;
}
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}
.stat-item { text-align: center; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-value.ultra { color: var(--ultra); }
.stat-value.pro { color: var(--pro); }
.stat-value.normal { color: var(--normal); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ========== Admin Page ========== */
.admin-page { max-width: 1000px; margin: 0 auto; padding: 40px 24px; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }
.admin-stat-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}
.admin-stat-card .stat-value { font-size: 32px; font-weight: 800; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.admin-stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.admin-actions { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table tr:hover td { background: var(--bg-glass-hover); }

/* ========== Guide Page ========== */
.guide-page { max-width: 700px; margin: 0 auto; padding: 40px 24px; }
.guide-page h2 { font-size: 22px; margin-bottom: 16px; }
.guide-page p, .guide-page li { color: var(--text-secondary); line-height: 1.8; font-size: 14px; }
.guide-step {
  display: flex; gap: 16px; margin-bottom: 20px; padding: 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.guide-step-num {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: white; border-radius: 50%;
  font-weight: 700; font-size: 14px;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transition: transform 0.3s ease-out;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error { border-color: rgba(239,68,68,0.3); }

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  margin-top: 60px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ========== Page Views ========== */
.page-view { display: none; animation: fadeIn 0.3s ease-out; }
.page-view.active { display: block; }

/* ========== Mobile ========== */
.mobile-menu-btn { display: none; }
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .nav-links { display: none; position: fixed; top: 64px; left: 0; right: 0; background: var(--bg-secondary); border-bottom: 1px solid var(--border); flex-direction: column; padding: 12px; z-index: 99; }
  .nav-links.show { display: flex; }
  .mobile-menu-btn { display: flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text-secondary); }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 14px; }
  .node-grid { grid-template-columns: 1fr; }
  .section { padding: 24px 16px; }
  .nav-actions .btn span.desktop-only { display: none; }
  .profile-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .admin-grid { grid-template-columns: repeat(2, 1fr); }
}
