:root {
  --bg-main: #07070b;
  --bg-sidebar: #0b0b12;
  --bg-card: rgba(18, 18, 28, 0.7);
  --bg-card-hover: rgba(26, 26, 40, 0.85);
  --border-color: rgba(124, 58, 237, 0.2);
  --border-glow: rgba(168, 85, 247, 0.4);

  --accent-primary: #7c3aed;
  --accent-secondary: #9333ea;
  --accent-hover: #a855f7;
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;

  --sidebar-width: 280px;
  --header-height: 72px;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Glassmorphism primitives */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 0 20px -5px rgba(124, 58, 237, 0.08);
  transition: var(--transition);
}

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

.highlight-card {
  border-color: rgba(124, 58, 237, 0.5);
  box-shadow: 0 0 25px -5px rgba(124, 58, 237, 0.25);
}

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-badge {
  background: var(--accent-gradient);
  color: white;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.sidebar-brand h1 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.sidebar-brand span {
  font-size: 11px;
  color: var(--accent-hover);
  display: block;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.2);
  border-radius: 4px;
}

.nav-group-title {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 1.2px;
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item small {
  display: block;
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 400;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(124, 58, 237, 0.1);
  transform: translateX(3px);
}

.nav-item.active {
  color: #ffffff;
  background: var(--accent-gradient);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.35);
  font-weight: 600;
}

.nav-item.active small {
  color: rgba(255, 255, 255, 0.85);
}

.nav-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: radial-gradient(circle at 85% 10%, rgba(124, 58, 237, 0.09) 0%, transparent 55%),
              radial-gradient(circle at 15% 90%, rgba(147, 51, 234, 0.06) 0%, transparent 45%),
              var(--bg-main);
}

/* Header */
.top-header {
  height: var(--header-height);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(11, 11, 18, 0.5);
  backdrop-filter: blur(12px);
}

.server-badge-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guild-indicator {
  font-size: 11px;
  font-weight: 700;
  color: var(--status-success);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.server-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

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

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-role-badge {
  font-size: 9px;
  font-weight: 800;
  background: var(--accent-gradient);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

/* Content Body */
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 36px;
}

.content-body::-webkit-scrollbar {
  width: 6px;
}
.content-body::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.3);
  border-radius: 6px;
}

/* Section Banner */
.section-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 20px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-desc {
  color: var(--text-muted);
  font-size: 13px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 22px;
}

.stat-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
}

.stat-footer {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-dim);
}

/* Control Cards Grid */
.control-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
}

.control-card {
  padding: 26px;
}

.card-top-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.icon-circle {
  font-size: 24px;
  width: 46px;
  height: 46px;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-top-badge h3 {
  font-size: 16px;
  font-weight: 700;
}

.card-top-badge small {
  color: var(--text-muted);
  font-size: 12px;
}

/* Status Radio Pills */
.status-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.status-pill input {
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.status-pill:hover {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.3);
}

.status-pill.active {
  border-color: var(--accent-primary);
  background: rgba(124, 58, 237, 0.15);
}

/* Channel Mapping Grid */
.channel-mapping-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel-setup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  gap: 20px;
}

.channel-desc-col strong {
  display: block;
  font-size: 14px;
  color: #fff;
  margin-bottom: 2px;
}

.channel-desc-col p {
  font-size: 12px;
  color: var(--text-muted);
}

.channel-select-col {
  min-width: 280px;
}

/* Tab Navigation Visibility */
.page-tab {
  display: none;
  animation: fadeIn 0.22s ease-out;
}

.page-tab.active {
  display: block;
}

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

/* Form inputs & tables */
.form-group {
  margin-bottom: 16px;
}

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

.field-hint {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--text-dim);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: rgba(9, 9, 14, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  text-decoration: none;
  transition: var(--transition);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-block {
  width: 100%;
}

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

.table-container {
  overflow-x: auto;
  margin-top: 12px;
}

.glass-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.glass-table th {
  padding: 12px 16px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  border-bottom: 1px solid var(--border-color);
}

.glass-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.glass-table tr:hover td {
  background: rgba(124, 58, 237, 0.04);
  color: var(--text-main);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-purple {
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-hover);
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background: var(--accent-gradient);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: rgba(18, 18, 28, 0.95);
  border: 1px solid var(--accent-primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  font-size: 13px;
}
