/* ============================================================
   style.css — MCP Platform Marketplace
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-info: #0891b2;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.15);

  --transition: 0.2s ease;
  --max-width: 1280px;
  --nav-height: 56px;
}

/* Dark theme (default) */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-hover: #263548;
  --bg-elevated: #334155;
  --border: #334155;
  --border-light: #475569;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --input-bg: #1e293b;
  --input-border: #475569;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.3);
  --nav-bg: rgba(15,23,42,0.95);
}

/* Light theme */
[data-theme="light"] {
  --bg: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-elevated: #e2e8f0;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
  --nav-bg: rgba(248,250,252,0.95);
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Navigation ────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 16px;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-logo:hover { text-decoration: none; }

.nav-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.nav-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
}

.nav-search input:focus { border-color: var(--color-primary); }

.nav-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--color-primary);
  font-weight: 600;
}

#user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

#user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

#user-name {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-surface-hover); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 8px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-surface-hover); }

.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 6px; border-radius: var(--radius-sm); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.6;
}

.badge-green { background: rgba(22,163,74,0.15); color: #22c55e; }
.badge-blue { background: rgba(37,99,235,0.15); color: #60a5fa; }
.badge-amber { background: rgba(217,119,6,0.15); color: #fbbf24; }
.badge-yellow { background: rgba(234,179,8,0.15); color: #facc15; }
.badge-orange { background: rgba(234,88,12,0.15); color: #fb923c; }
.badge-red { background: rgba(220,38,38,0.15); color: #f87171; }
.badge-gray { background: rgba(100,116,139,0.15); color: #94a3b8; }
.badge-gold { background: rgba(245,158,11,0.15); color: #f59e0b; }

[data-theme="light"] .badge-green { background: rgba(22,163,74,0.1); color: #16a34a; }
[data-theme="light"] .badge-blue { background: rgba(37,99,235,0.1); color: #2563eb; }
[data-theme="light"] .badge-amber { background: rgba(217,119,6,0.1); color: #d97706; }
[data-theme="light"] .badge-yellow { background: rgba(234,179,8,0.1); color: #ca8a04; }
[data-theme="light"] .badge-orange { background: rgba(234,88,12,0.1); color: #ea580c; }
[data-theme="light"] .badge-red { background: rgba(220,38,38,0.1); color: #dc2626; }
[data-theme="light"] .badge-gray { background: rgba(100,116,139,0.1); color: #64748b; }
[data-theme="light"] .badge-gold { background: rgba(245,158,11,0.1); color: #d97706; }

.badge-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge-official {
  background: var(--color-primary);
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 6px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--card-shadow);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-title a {
  color: inherit;
}
.card-title a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.card-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.tag {
  padding: 2px 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

/* ── Server Card Grid ──────────────────────────────────────── */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* ── Layout ────────────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

.page-content {
  padding: 24px 0;
}

.layout-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
}

/* ── Hero Section ──────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 48px 16px 32px;
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--color-primary), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 24px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.hero-stat {
  text-align: center;
}

.hero-stat .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.hero-stat .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Sidebar Filters ───────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 24px);
  align-self: start;
}

.filter-section {
  margin-bottom: 20px;
}

.filter-section h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-option:hover { color: var(--text-primary); }

.filter-option input[type="checkbox"] {
  accent-color: var(--color-primary);
}

/* ── Sort Bar ──────────────────────────────────────────────── */
.sort-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.sort-bar .result-count {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.sort-options {
  display: flex;
  gap: 4px;
}

.sort-options button {
  padding: 4px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.sort-options button:hover {
  border-color: var(--color-primary);
  color: var(--text-primary);
}

.sort-options button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ── Category Tabs ─────────────────────────────────────────── */
.category-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.category-tabs button {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.category-tabs button:hover {
  border-color: var(--color-primary);
  color: var(--text-primary);
}

.category-tabs button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.form-group .hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--color-primary);
}

textarea { resize: vertical; min-height: 80px; }

select { cursor: pointer; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  background: var(--bg-elevated);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--bg-surface-hover); }

/* ── Modals ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 32px;
}

.pagination button {
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}

.pagination button:hover {
  border-color: var(--color-primary);
  color: var(--text-primary);
}

.pagination button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Wizard ────────────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wizard-step .step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
}

.wizard-step.active { color: var(--color-primary); }
.wizard-step.active .step-num {
  background: var(--color-primary);
  color: #fff;
}

.wizard-step.done { color: var(--color-success); }
.wizard-step.done .step-num {
  background: var(--color-success);
  color: #fff;
}

.wizard-connector {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
}

.wizard-connector.done { background: var(--color-success); }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; }

/* ── Tabs ──────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Server Detail ─────────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.detail-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-header .version {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.detail-section {
  margin-bottom: 32px;
}

.detail-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.badge-explain {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.badge-explain-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}

.badge-explain-item .badge-type {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ── Timeline ──────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
}

.timeline-item.success::before { background: var(--color-success); border-color: var(--color-success); }
.timeline-item.warning::before { background: var(--color-warning); border-color: var(--color-warning); }
.timeline-item.danger::before { background: var(--color-danger); border-color: var(--color-danger); }

.timeline-item .time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Code Block ────────────────────────────────────────────── */
.code-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.8rem;
  overflow-x: auto;
  position: relative;
  white-space: pre;
  line-height: 1.5;
}

.code-block .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
}
.code-block .copy-btn:hover { color: var(--text-primary); }

/* ── Stats Card ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Composition Card ──────────────────────────────────────── */
.comp-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.comp-card .comp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.comp-card .comp-name {
  font-size: 1.05rem;
  font-weight: 600;
}

.comp-endpoint {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin: 8px 0;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.comp-endpoint code { flex: 1; }

.comp-servers {
  margin-top: 12px;
}

.comp-server-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.comp-server-item:hover { background: var(--bg-surface-hover); }

.comp-server-item .prefix {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--color-primary);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* ── Status Indicator ──────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-dot.active { background: var(--color-success); }
.status-dot.inactive { background: var(--text-muted); }
.status-dot.pending { background: var(--color-warning); }
.status-dot.error { background: var(--color-danger); }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ── Loading ───────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alert ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 16px;
  border: 1px solid;
}

.alert-info {
  background: rgba(8,145,178,0.1);
  border-color: rgba(8,145,178,0.3);
  color: var(--color-info);
}

.alert-warning {
  background: rgba(217,119,6,0.1);
  border-color: rgba(217,119,6,0.3);
  color: var(--color-warning);
}

.alert-danger {
  background: rgba(220,38,38,0.1);
  border-color: rgba(220,38,38,0.3);
  color: var(--color-danger);
}

.alert-success {
  background: rgba(22,163,74,0.1);
  border-color: rgba(22,163,74,0.3);
  color: var(--color-success);
}

/* ── Toggle Switch ─────────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-elevated);
  border-radius: 11px;
  transition: var(--transition);
}

.toggle .slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .slider { background: var(--color-primary); }
.toggle input:checked + .slider::before { transform: translateX(18px); background: #fff; }

/* ── Tooltip ───────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 10;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ── Login Providers ───────────────────────────────────────── */
.login-providers {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.btn-login-github,
.btn-login-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid var(--border);
}

.btn-login-github {
  background: #24292e;
  color: #fff;
  border-color: #24292e;
}
.btn-login-github:hover { background: #1b1f23; }

.btn-login-google {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-login-google:hover { background: var(--bg-surface-hover); }

[data-theme="light"] .btn-login-google {
  background: #fff;
  border-color: #dadce0;
}
[data-theme="light"] .btn-login-google:hover {
  background: #f8f9fa;
}

/* ── Utility ───────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: none;
  }

  .sidebar.open { display: block; }

  .nav-search { max-width: none; }

  .nav-links a.hide-mobile { display: none; }

  .hero h1 { font-size: 1.5rem; }

  .hero-stats { gap: 16px; }

  .server-grid {
    grid-template-columns: 1fr;
  }

  .detail-header {
    flex-direction: column;
  }

  .detail-actions {
    width: 100%;
  }

  .detail-actions .btn { flex: 1; justify-content: center; }

  .badge-explain {
    grid-template-columns: 1fr 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .wizard-step .step-label { display: none; }

  .modal { max-width: 100%; margin: 16px; }
}

@media (max-width: 480px) {
  .badge-explain {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    flex-direction: column;
    gap: 8px;
  }
}
