/* =============================================
   K2 Teams Bot Admin Portal — Design System
   ============================================= */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Primary Palette */
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --primary-light: #818CF8;
  --primary-50: #EEF2FF;
  --primary-100: #E0E7FF;
  --primary-200: #C7D2FE;
  --primary-900: #312E81;

  /* Accent */
  --accent: #06B6D4;
  --accent-dark: #0891B2;
  --accent-light: #67E8F9;

  /* Sidebar */
  --sidebar-bg: #1E1B4B;
  --sidebar-hover: #312E81;
  --sidebar-active: #4F46E5;
  --sidebar-text: #C7D2FE;
  --sidebar-text-active: #FFFFFF;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;

  /* Status Colors */
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --info: #3B82F6;
  --info-light: #DBEAFE;

  /* Neutrals */
  --bg-body: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border-color: #E2E8F0;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 250ms ease;
  --transition-slow: 350ms ease;

  /* Z-index */
  --z-sidebar: 1040;
  --z-topnav: 1030;
  --z-overlay: 1050;
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
  --bg-body: #0F172A;
  --bg-card: #1E293B;
  --bg-input: #334155;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -2px rgba(0,0,0,0.3);
  --sidebar-bg: #0F0D2E;
  --sidebar-hover: #1a1745;
}

/* ---------- Base Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition), color var(--transition);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

/* ---------- Google Font Import ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  z-index: var(--z-sidebar);
  transition: width var(--transition-slow);
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

/* Sidebar Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 72px;
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--transition);
}

.sidebar.collapsed .brand-text {
  opacity: 0;
  width: 0;
}

.sidebar-brand .brand-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.025em;
}

.sidebar-brand .brand-subtitle {
  font-size: 11px;
  color: var(--sidebar-text);
  font-weight: 400;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  list-style: none;
  margin: 0;
}

.sidebar-nav .nav-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(199,210,254,0.5);
  padding: 16px 14px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-section-title {
  text-align: center;
  font-size: 0;
  padding: 16px 0 6px;
}
.sidebar.collapsed .nav-section-title::after {
  content: '•••';
  font-size: 10px;
  color: rgba(199,210,254,0.3);
}

.sidebar-nav .nav-item {
  margin-bottom: 2px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--sidebar-text);
  border-radius: var(--border-radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.sidebar-nav .nav-link i {
  font-size: 18px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.sidebar-nav .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.sidebar.collapsed .nav-link span {
  opacity: 0;
  width: 0;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 10px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Sidebar Toggle */
.sidebar-toggle {
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar.collapsed .sidebar-toggle {
  justify-content: center;
}

.sidebar.collapsed .sidebar-toggle span {
  display: none;
}

/* =============================================
   TOP NAVIGATION
   ============================================= */
.topnav {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 64px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  z-index: var(--z-topnav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  transition: left var(--transition-slow), background-color var(--transition), border-color var(--transition);
  box-shadow: var(--shadow-sm);
}

.sidebar.collapsed ~ .topnav {
  left: var(--sidebar-collapsed-width);
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topnav-left .page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.topnav-left .breadcrumb {
  font-size: 13px;
  margin: 0;
  padding: 0;
  background: none;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Environment Selector */
.env-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.env-selector select {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 6px 32px 6px 12px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-input);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition-fast);
  appearance: auto;
}

.env-selector select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-200);
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Notification Bell */
.topnav-icon-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--border-radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  position: relative;
  transition: all var(--transition-fast);
}

.topnav-icon-btn:hover {
  background: var(--primary-50);
  color: var(--primary);
}

[data-theme="dark"] .topnav-icon-btn:hover {
  background: rgba(79,70,229,0.15);
}

.topnav-icon-btn .badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* User Avatar */
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
}

.user-avatar:hover {
  box-shadow: 0 0 0 3px var(--primary-200);
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: 64px;
  padding: 24px;
  min-height: calc(100vh - 64px);
  transition: margin-left var(--transition-slow);
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body {
  padding: 20px;
}

/* Metric Cards */
.metric-card {
  position: relative;
  overflow: hidden;
  border: none;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 4px 0 0 4px;
}

.metric-card.primary::before { background: var(--primary); }
.metric-card.success::before { background: var(--success); }
.metric-card.warning::before { background: var(--warning); }
.metric-card.danger::before { background: var(--danger); }
.metric-card.info::before { background: var(--info); }
.metric-card.accent::before { background: var(--accent); }

.metric-card .metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.metric-card.primary .metric-icon { background: var(--primary-50); color: var(--primary); }
.metric-card.success .metric-icon { background: var(--success-light); color: var(--success); }
.metric-card.warning .metric-icon { background: var(--warning-light); color: var(--warning); }
.metric-card.danger .metric-icon { background: var(--danger-light); color: var(--danger); }
.metric-card.info .metric-icon { background: var(--info-light); color: var(--info); }
.metric-card.accent .metric-icon { background: rgba(6,182,212,0.1); color: var(--accent); }

[data-theme="dark"] .metric-card.primary .metric-icon { background: rgba(79,70,229,0.15); }
[data-theme="dark"] .metric-card.success .metric-icon { background: rgba(16,185,129,0.15); }
[data-theme="dark"] .metric-card.warning .metric-icon { background: rgba(245,158,11,0.15); }
[data-theme="dark"] .metric-card.danger .metric-icon { background: rgba(239,68,68,0.15); }
[data-theme="dark"] .metric-card.info .metric-icon { background: rgba(59,130,246,0.15); }
[data-theme="dark"] .metric-card.accent .metric-icon { background: rgba(6,182,212,0.15); }

.metric-card .metric-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--text-primary);
}

.metric-card .metric-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 4px;
}

/* Glassmorphism Card */
.glass-card {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.3);
}

[data-theme="dark"] .glass-card {
  background: rgba(30,41,59,0.7);
  border: 1px solid rgba(255,255,255,0.08);
}

/* =============================================
   STATUS BADGES
   ============================================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.connected, .status-badge.online, .status-badge.healthy, .status-badge.enabled, .status-badge.active {
  background: var(--success-light);
  color: #065F46;
}
.status-badge.connected::before, .status-badge.online::before, .status-badge.healthy::before, .status-badge.enabled::before, .status-badge.active::before {
  background: var(--success);
  animation: pulse-dot 2s infinite;
}

.status-badge.failed, .status-badge.offline, .status-badge.error, .status-badge.disabled {
  background: var(--danger-light);
  color: #991B1B;
}
.status-badge.failed::before, .status-badge.offline::before, .status-badge.error::before, .status-badge.disabled::before {
  background: var(--danger);
}

.status-badge.warning, .status-badge.degraded {
  background: var(--warning-light);
  color: #92400E;
}
.status-badge.warning::before, .status-badge.degraded::before {
  background: var(--warning);
  animation: pulse-dot 2s infinite;
}

.status-badge.pending, .status-badge.inactive {
  background: #F1F5F9;
  color: #475569;
}
.status-badge.pending::before, .status-badge.inactive::before {
  background: #94A3B8;
}

[data-theme="dark"] .status-badge.connected, [data-theme="dark"] .status-badge.online,
[data-theme="dark"] .status-badge.healthy, [data-theme="dark"] .status-badge.enabled,
[data-theme="dark"] .status-badge.active {
  background: rgba(16,185,129,0.15);
  color: #6EE7B7;
}

[data-theme="dark"] .status-badge.failed, [data-theme="dark"] .status-badge.offline,
[data-theme="dark"] .status-badge.error, [data-theme="dark"] .status-badge.disabled {
  background: rgba(239,68,68,0.15);
  color: #FCA5A5;
}

[data-theme="dark"] .status-badge.warning, [data-theme="dark"] .status-badge.degraded {
  background: rgba(245,158,11,0.15);
  color: #FCD34D;
}

[data-theme="dark"] .status-badge.pending, [data-theme="dark"] .status-badge.inactive {
  background: rgba(148,163,184,0.15);
  color: #94A3B8;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  font-family: var(--font-family);
  font-weight: 500;
  font-size: 13.5px;
  border-radius: var(--border-radius-sm);
  padding: 8px 16px;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(79,70,229,0.2);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(79,70,229,0.35);
  transform: translateY(-1px);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-body);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.btn-sm {
  font-size: 12px;
  padding: 5px 10px;
}

.btn-lg {
  font-size: 15px;
  padding: 12px 24px;
}

.btn i {
  font-size: 16px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
}

/* =============================================
   FORMS
   ============================================= */
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control, .form-select {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: var(--font-family);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
  outline: none;
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.form-control.is-valid {
  border-color: var(--success);
}

.form-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* Password Field with Eye Toggle */
.password-field {
  position: relative;
}

.password-field .form-control {
  padding-right: 44px;
  font-family: var(--font-mono);
  letter-spacing: 2px;
}

.password-field .toggle-password {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px;
  transition: color var(--transition-fast);
}

.password-field .toggle-password:hover {
  color: var(--primary);
}

/* Secret Status Indicator */
.secret-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.secret-status i {
  font-size: 12px;
}

.secret-status.stored { color: var(--success); }
.secret-status.not-stored { color: var(--warning); }

/* Toggle Switches */
.form-switch .form-check-input {
  width: 42px;
  height: 22px;
  border: 2px solid var(--border-color);
  background-color: var(--bg-body);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-switch .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.form-switch .form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

/* Range Input */
.form-range::-webkit-slider-thumb {
  background: var(--primary);
}

/* =============================================
   TABLES
   ============================================= */
.table {
  color: var(--text-primary);
  font-size: 13.5px;
}

.table thead th {
  background: var(--bg-body);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border-color);
  padding: 12px 16px;
  white-space: nowrap;
}

[data-theme="dark"] .table thead th {
  background: rgba(0,0,0,0.2);
}

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
  background: var(--primary-50);
}

[data-theme="dark"] .table tbody tr:hover {
  background: rgba(79,70,229,0.05);
}

/* DataTables Overrides */
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius-sm) !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
  background: var(--bg-input) !important;
  color: var(--text-primary) !important;
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border-color) !important;
  border-radius: var(--border-radius-sm) !important;
  padding: 4px 8px !important;
  font-size: 13px !important;
  background: var(--bg-input) !important;
  color: var(--text-primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--border-radius-sm) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

.dataTables_wrapper .dataTables_info {
  font-size: 13px;
  color: var(--text-muted);
}

/* =============================================
   TABS
   ============================================= */
.nav-tabs {
  border-bottom: 2px solid var(--border-color);
  gap: 4px;
}

.nav-tabs .nav-link {
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 18px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
  border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
}

.nav-tabs .nav-link:hover {
  color: var(--primary);
  background: var(--primary-50);
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
  background: rgba(79,70,229,0.1);
}

.nav-tabs .nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: transparent;
}

.tab-content {
  padding-top: 20px;
}

/* =============================================
   MODALS
   ============================================= */
.modal-content {
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
  background: var(--bg-card);
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 20px 24px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 16px 24px;
}

.modal-title {
  font-weight: 600;
  font-size: 16px;
}

/* =============================================
   ALERTS
   ============================================= */
.alert {
  border-radius: var(--border-radius-sm);
  font-size: 13.5px;
  border: none;
  padding: 12px 16px;
}

.alert-success {
  background: var(--success-light);
  color: #065F46;
}

.alert-warning {
  background: var(--warning-light);
  color: #92400E;
}

.alert-danger {
  background: var(--danger-light);
  color: #991B1B;
}

.alert-info {
  background: var(--info-light);
  color: #1E40AF;
}

[data-theme="dark"] .alert-success { background: rgba(16,185,129,0.15); color: #6EE7B7; }
[data-theme="dark"] .alert-warning { background: rgba(245,158,11,0.15); color: #FCD34D; }
[data-theme="dark"] .alert-danger { background: rgba(239,68,68,0.15); color: #FCA5A5; }
[data-theme="dark"] .alert-info { background: rgba(59,130,246,0.15); color: #93C5FD; }

/* =============================================
   PAGE HEADER
   ============================================= */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.025em;
}

.page-header .page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =============================================
   WORKFLOW DESIGNER
   ============================================= */
.workflow-flow {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 24px 0;
}

.workflow-step {
  flex-shrink: 0;
  min-width: 160px;
  text-align: center;
}

.workflow-step .step-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px;
  transition: all var(--transition);
}

.workflow-step .step-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.workflow-step .step-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 18px;
  color: white;
}

.workflow-step .step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.workflow-step .step-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.workflow-arrow {
  flex-shrink: 0;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 20px;
}

/* =============================================
   JSON / CODE EDITOR
   ============================================= */
.code-editor {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: #1E293B;
  color: #E2E8F0;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  resize: vertical;
  min-height: 300px;
  width: 100%;
  tab-size: 2;
}

.code-editor:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

[data-theme="dark"] .code-editor {
  background: #0F172A;
  border-color: #334155;
}

/* =============================================
   CONNECTION STRING PREVIEW
   ============================================= */
.connection-preview {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
  line-height: 1.6;
}

[data-theme="dark"] .connection-preview {
  background: rgba(0,0,0,0.2);
}

/* =============================================
   ARCHITECTURE FLOW DIAGRAM
   ============================================= */
.arch-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 32px 16px;
  overflow-x: auto;
}

.arch-node {
  text-align: center;
  flex-shrink: 0;
}

.arch-node .node-box {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px 20px;
  min-width: 120px;
  transition: all var(--transition);
}

.arch-node .node-box:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.arch-node .node-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.arch-node .node-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.arch-arrow {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 22px;
}

/* =============================================
   FEATURE TOGGLE CARDS
   ============================================= */
.feature-card {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  background: var(--bg-card);
  transition: all var(--transition);
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-card .feature-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.feature-card .feature-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--primary-50);
  color: var(--primary);
}

[data-theme="dark"] .feature-card .feature-icon {
  background: rgba(79,70,229,0.15);
}

.feature-card .feature-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 10px 0 4px;
}

.feature-card .feature-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.feature-card .feature-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

/* =============================================
   SPLIT PANEL LAYOUT
   ============================================= */
.split-panel {
  display: grid;
  gap: 20px;
  height: calc(100vh - 160px);
}

.split-panel.three-col {
  grid-template-columns: 260px 1fr 360px;
}

.split-panel.two-col {
  grid-template-columns: 280px 1fr;
}

.split-panel .panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.split-panel .panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.split-panel .panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Panel List Items */
.panel-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
  font-size: 13px;
}

.panel-list-item:hover {
  background: var(--primary-50);
}

[data-theme="dark"] .panel-list-item:hover {
  background: rgba(79,70,229,0.08);
}

.panel-list-item.active {
  background: var(--primary-50);
  border-left: 3px solid var(--primary);
  color: var(--primary);
  font-weight: 600;
}

[data-theme="dark"] .panel-list-item.active {
  background: rgba(79,70,229,0.12);
}

/* =============================================
   HEALTH CARDS
   ============================================= */
.health-card {
  text-align: center;
  padding: 24px 16px;
}

.health-card .health-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 24px;
  position: relative;
}

.health-card .health-icon.healthy {
  background: var(--success-light);
  color: var(--success);
}

.health-card .health-icon.unhealthy {
  background: var(--danger-light);
  color: var(--danger);
}

.health-card .health-icon.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.health-card .health-icon .pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: pulse-ring 2s infinite;
}

.health-card .health-icon.healthy .pulse-ring { border: 2px solid var(--success); }
.health-card .health-icon.unhealthy .pulse-ring { border: 2px solid var(--danger); }
.health-card .health-icon.warning .pulse-ring { border: 2px solid var(--warning); }

.health-card .health-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.health-card .health-latency {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-page {
  min-height: 100vh;
  display: flex;
}

.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bg-card);
}

.login-form-container {
  width: 100%;
  max-width: 420px;
}

.login-illustration-panel {
  flex: 1;
  background: linear-gradient(135deg, var(--sidebar-bg), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}

.login-illustration-panel::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(79,70,229,0.15);
  top: -50px;
  right: -50px;
}

.login-illustration-panel::after {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(6,182,212,0.1);
  bottom: -30px;
  left: -30px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form .btn-login {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
}

.login-form .login-extras {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 13px;
}

/* Login Illustration Content */
.login-illustration-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
  max-width: 400px;
}

.login-illustration-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.login-illustration-content p {
  font-size: 14px;
  opacity: 0.8;
  line-height: 1.6;
}

/* Integration Nodes */
.integration-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 32px;
}

.integration-node {
  width: 90px;
  height: 90px;
  border-radius: var(--border-radius);
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  transition: all var(--transition);
}

.integration-node:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-4px);
}

.integration-node i {
  font-size: 28px;
}

.integration-connector {
  display: flex;
  align-items: center;
  color: rgba(255,255,255,0.4);
  font-size: 20px;
}

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fadeInUp {
  animation: fadeInUp 0.5s ease forwards;
}

.animate-fadeIn {
  animation: fadeIn 0.4s ease forwards;
}

.animate-slideInLeft {
  animation: slideInLeft 0.4s ease forwards;
}

/* Staggered animations */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }
.stagger-6 { animation-delay: 0.3s; }

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-body) 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
}

/* =============================================
   DEPLOYMENT STATUS
   ============================================= */
.deploy-option {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.deploy-option:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.deploy-option.selected {
  border-color: var(--primary);
  background: var(--primary-50);
}

[data-theme="dark"] .deploy-option.selected {
  background: rgba(79,70,229,0.1);
}

.deploy-option .deploy-icon {
  font-size: 36px;
  color: var(--primary);
  margin-bottom: 10px;
}

.deploy-option .deploy-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* =============================================
   TOAST OVERRIDES
   ============================================= */
#toast-container > .toast {
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-family);
}

/* =============================================
   MISC UTILITIES
   ============================================= */
.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.divider {
  height: 1px;
  background: var(--border-color);
  margin: 20px 0;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h5 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
}

/* Quick Action Button */
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text-primary);
}

.quick-action-btn:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  color: var(--primary);
}

.quick-action-btn i {
  font-size: 24px;
  color: var(--primary);
}

.quick-action-btn span {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* Mobile sidebar toggle button (visible only on mobile) */
.mobile-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: calc(var(--z-sidebar) - 1);
}

.sidebar-overlay.show {
  display: block;
}

/* Preview Card for Adaptive Cards */
.preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px;
  max-width: 100%;
}

.preview-card .preview-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.preview-card .preview-body {
  font-size: 13px;
  color: var(--text-secondary);
}

.preview-card .preview-action {
  margin-top: 12px;
}

/* Warning Banner */
.config-warning {
  background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(239,68,68,0.05));
  border: 1px solid var(--warning);
  border-radius: var(--border-radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.config-warning i {
  font-size: 24px;
  color: var(--warning);
  flex-shrink: 0;
}

.config-warning .warning-text h6 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2px;
}

.config-warning .warning-text p {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--bg-body);
  border-radius: var(--border-radius-sm);
  margin-bottom: 20px;
}

[data-theme="dark"] .filter-bar {
  background: rgba(0,0,0,0.2);
}

.filter-bar .form-control, .filter-bar .form-select {
  max-width: 200px;
  font-size: 13px;
}

/* NGrok Warning */
.ngrok-warning {
  background: linear-gradient(135deg, rgba(239,68,68,0.08), rgba(239,68,68,0.02));
  border: 2px dashed var(--danger);
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
}

.ngrok-warning i {
  font-size: 32px;
  color: var(--danger);
}

.ngrok-warning h5 {
  color: var(--danger);
  font-weight: 700;
}
