@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #000000;
  --bg-secondary: rgba(18, 18, 20, 0.85);
  --bg-tertiary: rgba(28, 28, 30, 0.7);
  --bg-elevated: rgba(38, 38, 40, 0.6);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-hover: rgba(255, 255, 255, 0.08);
  --glass-active: rgba(255, 255, 255, 0.1);
  --text-primary: #f5f5f7;
  --text-secondary: rgba(235, 235, 245, 0.55);
  --text-tertiary: rgba(235, 235, 245, 0.25);
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.15);
  --green: #30d158;
  --green-dim: rgba(48, 209, 88, 0.12);
  --red: #ff453a;
  --red-dim: rgba(255, 69, 58, 0.12);
  --orange: #ff9f0a;
  --orange-dim: rgba(255, 159, 10, 0.12);
  --yellow: #ffd60a;
  --yellow-dim: rgba(255, 214, 10, 0.12);
  --purple: #bf5af2;
  --purple-dim: rgba(191, 90, 242, 0.12);
  --blur: 40px;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html { background: #000000; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#spa-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}


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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

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

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

.animate-in, .animate-in-delay-1, .animate-in-delay-2, .animate-in-delay-3, .animate-in-delay-4, .animate-in-delay-5 {}

.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(255, 255, 255, 0.04), transparent),
    radial-gradient(ellipse 60% 40% at 80% 50%, rgba(255, 255, 255, 0.02), transparent);
  animation: gradientShift 20s ease infinite;
  background-size: 200% 200%;
}

.glass {
  background: var(--bg-secondary);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 220px;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
}

.sidebar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  padding: 8px 10px;
  margin-bottom: 24px;
}

.sidebar .logo img { width: 24px; height: 24px; border-radius: 6px; }

.sidebar-bot-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin: 0 4px 14px;
}

.sidebar-bot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sidebar-bot-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.sidebar-bot-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  background: var(--glass-hover);
  color: var(--text-primary);
}

.sidebar-bot-badge.online {
  background: var(--green-dim);
  color: var(--green);
}

.sidebar-bot-badge.offline,
.sidebar-bot-badge.stopped {
  color: var(--text-secondary);
}

.sidebar-bot-badge.error {
  background: var(--red-dim);
  color: var(--red);
}

.sidebar-bot-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.sidebar-bot-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.sidebar-bot-avatar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.sidebar-bot-avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--glass-border);
  background: var(--glass);
}

.sidebar-bot-avatar.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  opacity: 0.5;
  user-select: none;
}

.sidebar-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-nav a:hover {
  color: var(--text-primary);
  background: var(--glass-hover);
}

.sidebar-nav a.active {
  color: var(--text-primary);
  background: var(--glass-active);
}

.sidebar-footer {
  border-top: 1px solid var(--glass-border);
  padding-top: 12px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-footer .user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  margin-bottom: 4px;
}

.sidebar-footer .user-pill img { width: 24px; height: 24px; border-radius: 50%; }

.sidebar-footer .user-pill span { color: var(--text-primary); font-size: 12px; font-weight: 500; }

.sidebar-footer .btn-logout {
  color: var(--text-tertiary);
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: all 0.15s var(--transition);
}

.sidebar-footer .btn-logout:hover {
  color: var(--red);
  background: var(--red-dim);
}

/* MAIN CONTENT */
.main-content {
  margin-left: 220px;
  min-height: 100vh;
}

/* INLINE SEARCH */
.inline-search {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.inline-search input {
  padding: 7px 12px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s var(--transition);
  width: 220px;
}

.inline-search input:focus {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--glass-hover);
}

.inline-search input::placeholder {
  color: var(--text-tertiary);
}

/* CONTAINER */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* CONTAINER */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* PAGE HEADER */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px;
  transition: all 0.2s var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.stat-card .stat-icon svg { width: 18px; height: 18px; }

.stat-card .stat-icon.white { background: var(--accent-dim); color: var(--text-primary); }
.stat-card .stat-icon.green { background: var(--green-dim); color: var(--green); }
.stat-card .stat-icon.orange { background: var(--orange-dim); color: var(--orange); }
.stat-card .stat-icon.purple { background: var(--purple-dim); color: var(--purple); }

.stat-card .stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.stat-card .stat-value.small {
  font-size: 14px;
  font-weight: 600;
}

/* CARD */
.card {
  padding: 20px;
  margin-bottom: 16px;
}

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

.card-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header h2 svg {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
}

.card-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* FILTER BAR */
.filter-bar {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--glass);
  border-radius: var(--radius-xs);
  border: 1px solid var(--glass-border);
}

.filter-bar a {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s var(--transition);
}

.filter-bar a:hover {
  color: var(--text-primary);
}

.filter-bar a.active {
  background: var(--glass-active);
  color: var(--text-primary);
}

/* MEMBER LIST */
.member-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-xs);
  transition: all 0.15s var(--transition);
}

.member-item:hover {
  background: var(--glass-hover);
}

.member-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.member-avatar.default {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.member-info {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-id {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: 'SF Mono', 'Menlo', monospace;
}

.member-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* TABLE */
.table-wrapper {
  overflow-x: auto;
}

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

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--glass-border);
}

td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  transition: background 0.1s;
}

tr:hover td {
  background: var(--glass);
}

tr:last-child td {
  border-bottom: none;
}

td code {
  background: var(--glass);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-family: 'SF Mono', 'Menlo', monospace;
  color: var(--text-secondary);
}

/* BADGE */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: var(--green-dim);
  color: var(--green);
}

.badge-warning {
  background: var(--yellow-dim);
  color: var(--yellow);
}

.badge-active {
  background: var(--green-dim);
  color: var(--green);
}

.badge-inactive {
  background: var(--glass);
  color: var(--text-tertiary);
}

.badge svg { width: 11px; height: 11px; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; }

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

.btn-primary:hover {
  background: rgba(255, 255, 255, 0.85);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--green);
  color: #000;
}

.btn-success:hover {
  filter: brightness(1.1);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255, 69, 58, 0.15);
}

.btn-danger:hover {
  background: rgba(255, 69, 58, 0.2);
}

.btn-ghost {
  background: var(--glass);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

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

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-icon {
  padding: 7px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-icon.danger:hover {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(255, 69, 58, 0.15);
}

.btn-icon svg { width: 15px; height: 15px; }

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-hint {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  transition: all 0.15s var(--transition);
  outline: none;
}

input:focus {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--glass-hover);
}

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

/* PAGINATION */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 20px;
}

.pagination a {
  padding: 7px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  transition: all 0.15s var(--transition);
}

.pagination a:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.pagination a.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

/* SERVER ITEMS */
.server-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  margin-bottom: 8px;
  transition: all 0.15s var(--transition);
}

.server-item:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: var(--glass-hover);
}

.server-info h3 {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.server-info p {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 2px;
}

.server-info .server-date {
  color: var(--text-tertiary);
  font-size: 11px;
  margin-top: 4px;
}

.server-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* PULL RESULT */
.pull-result {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  display: none;
}

.pull-result.show { display: block; }
.pull-result.success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(48, 209, 88, 0.15); }
.pull-result.error { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255, 69, 58, 0.15); }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 13px;
}

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  animation: fadeIn 0.15s ease both;
  backdrop-filter: blur(20px);
}

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

/* SPIN */
.spin { animation: spin 1s linear infinite; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
    padding: 12px 8px;
  }
  .sidebar .logo span { display: none; }
  .sidebar-bot-card { display: none; }
  .sidebar-nav a span { display: none; }
  .nav-section-label { display: none; }
  .sidebar-nav a { justify-content: center; padding: 10px; }
  .sidebar-footer .user-pill span { display: none; }
  .sidebar-footer .btn-logout span { display: none; }
  .sidebar-footer .btn-logout { justify-content: center; }
  .main-content { margin-left: 60px; }
  .container { padding: 20px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .card-header { flex-direction: column; align-items: flex-start; }
  .server-item { flex-direction: column; gap: 12px; align-items: flex-start; }
  .server-actions { width: 100%; }
  .server-actions .btn { flex: 1; }
  .filter-bar { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* SCROLLBAR THEME */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }
::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.1) transparent; }
