/* ==========================================================================
   TikTok User Directory & Monitoring Platform - Modern Mobile-App Design System
   ========================================================================== */

:root {
  --primary: #fe2c55;
  --primary-hover: #e02449;
  --secondary: #25f4ee;
  --accent: #00f2fe;
  --bg-main: #090d16;
  --bg-surface: #121826;
  --bg-card: #182234;
  --bg-card-hover: #1f2c42;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(254, 44, 85, 0.5);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --badge-bg: rgba(255, 255, 255, 0.06);
  --glass-bg: rgba(18, 24, 38, 0.85);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --bottom-nav-height: 64px;
  --sidebar-width: 250px;
  --navbar-height: 57px;

  /* Metric tokens (Default / Dark) */
  --stat-val-default: #f8fafc;
  --stat-val-primary: #60a5fa;
  --stat-val-success: #4ade80;
  --stat-val-warning: #fbbf24;
  --stat-val-danger: #f87171;
  --stat-val-info: #38bdf8;
}

[data-theme="light"] {
  --bg-main: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-color: rgba(0, 0, 0, 0.09);
  --border-focus: rgba(254, 44, 85, 0.4);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --badge-bg: rgba(0, 0, 0, 0.05);
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.08);

  /* Metric tokens in Light Theme - High contrast & crisp */
  --stat-val-default: #0f172a;
  --stat-val-primary: #1d4ed8;
  --stat-val-success: #15803d;
  --stat-val-warning: #b45309;
  --stat-val-danger: #dc2626;
  --stat-val-info: #0284c7;
}

[data-theme="dark"] {
  --bg-main: #090d16;
  --bg-surface: #121826;
  --bg-card: #182234;
  --bg-card-hover: #1f2c42;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(254, 44, 85, 0.5);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --badge-bg: rgba(255, 255, 255, 0.06);
  --glass-bg: rgba(18, 24, 38, 0.85);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);

  --stat-val-default: #f8fafc;
  --stat-val-primary: #60a5fa;
  --stat-val-success: #4ade80;
  --stat-val-warning: #fbbf24;
  --stat-val-danger: #f87171;
  --stat-val-info: #38bdf8;
}

/* Base resets & typography */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

/* Glassmorphic Navbar */
.app-navbar {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1030;
  transition: background 0.3s ease;
}

.brand-text {
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 40%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-text {
  background: linear-gradient(135deg, #0f172a 40%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Cards */
.app-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.app-card:hover {
  border-color: rgba(254, 44, 85, 0.3);
  box-shadow: var(--shadow-md);
}

/* TikTok Inspired User Card */
.tiktok-user-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.5rem;
  transition: all 0.25s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tiktok-user-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  border-color: rgba(254, 44, 85, 0.4);
}

.tiktok-avatar-wrapper {
  position: relative;
  width: 84px;
  height: 84px;
  margin: 0 auto 12px auto;
}

.tiktok-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  background: #111827;
}

.verified-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  background: #20d5ec;
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border: 2px solid var(--bg-card);
}

.tiktok-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  padding: 12px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin: 14px 0;
}

.stat-metric {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Buttons */
.btn-tiktok-primary {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  font-weight: 600;
  border-radius: 12px;
  padding: 8px 16px;
  transition: all 0.2s ease;
}

.btn-tiktok-primary:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(254, 44, 85, 0.4);
}

.btn-tiktok-outline {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-weight: 600;
  border-radius: 12px;
  padding: 8px 14px;
  transition: all 0.2s ease;
}

.btn-tiktok-outline:hover {
  background-color: var(--badge-bg);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-main);
}

/* ==========================================================================
   Mobile Bottom Navigation Bar (Native App-Like UI)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-color);
  z-index: 1045;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  align-items: center;
  justify-content: space-around;
}

[data-theme="light"] .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.94);
  border-top-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .mobile-bottom-nav {
  background: rgba(15, 23, 42, 0.95);
  border-top-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
}

.mobile-bottom-nav .nav-item {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 6px 0;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav .nav-item:active {
  transform: scale(0.92);
}

.mobile-bottom-nav .nav-item i {
  font-size: 1.3rem;
  margin-bottom: 2px;
  line-height: 1;
  transition: transform 0.2s ease, color 0.2s ease;
}

.mobile-bottom-nav .nav-item.active,
.mobile-bottom-nav .nav-item:hover {
  color: var(--primary) !important;
}

.mobile-bottom-nav .nav-item.active i {
  transform: translateY(-2px);
  color: var(--primary);
}

.mobile-bottom-nav .nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}

/* Center Floating Add Action Button (TikTok Signature Style) */
.mobile-bottom-nav .nav-item-add {
  flex: 0 0 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-decoration: none;
}

.mobile-bottom-nav .mobile-add-btn {
  width: 42px;
  height: 32px;
  border-radius: 9px;
  background: #ffffff;
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  position: relative;
  box-shadow: -3px 0 0 #25f4ee, 3px 0 0 #fe2c55;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

[data-theme="dark"] .mobile-bottom-nav .mobile-add-btn {
  background: #ffffff;
  color: #000000;
  box-shadow: -3px 0 0 #25f4ee, 3px 0 0 #fe2c55;
}

.mobile-bottom-nav .nav-item-add:active .mobile-add-btn {
  transform: scale(0.9);
}

@media (max-width: 991.98px) {
  .mobile-bottom-nav {
    display: flex;
  }
  body {
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 24px) !important;
  }
}

/* ==========================================================================
   Hamburger Button & Theme-Adaptive Mobile Drawer (Offcanvas)
   ========================================================================== */
.btn-hamburger {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-hamburger:hover, .btn-hamburger:focus {
  background: var(--bg-card-hover);
  color: var(--primary);
  border-color: var(--border-focus);
}

.app-offcanvas {
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border-right: 1px solid var(--border-color) !important;
  max-width: 320px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .app-offcanvas {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-right-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="dark"] .app-offcanvas {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-right-color: rgba(255, 255, 255, 0.08) !important;
}

.app-offcanvas .offcanvas-header {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
}

.app-offcanvas .offcanvas-title {
  color: var(--text-main);
  font-weight: 800;
  margin: 0;
}

.app-drawer-link {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  transition: all 0.18s ease;
  margin-bottom: 3px;
}

.app-drawer-link i {
  font-size: 1.15rem;
  margin-right: 12px;
  width: 22px;
  text-align: center;
  color: var(--text-muted);
  transition: color 0.18s ease, transform 0.18s ease;
}

.app-drawer-link:hover, .app-drawer-link:focus {
  background: rgba(254, 44, 85, 0.08);
  color: var(--primary);
}

.app-drawer-link:hover i {
  color: var(--primary);
  transform: translateX(2px);
}

.app-drawer-link.active {
  background: var(--primary);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(254, 44, 85, 0.35);
}

.app-drawer-link.active i {
  color: #ffffff !important;
}

.app-drawer-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 12px 14px 4px 14px;
}

/* User Card inside Drawer */
.app-drawer-user-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

[data-theme="light"] .app-drawer-user-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

/* Theme Adaptive Dropdowns */
.dropdown-menu {
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
}

[data-theme="light"] .dropdown-menu {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(0, 0, 0, 0.09) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .dropdown-menu {
  background-color: #121826 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.dropdown-item {
  color: var(--text-main) !important;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 500;
  font-size: 0.88rem;
  transition: all 0.15s ease;
}

.dropdown-item:hover, .dropdown-item:focus {
  background-color: rgba(254, 44, 85, 0.08) !important;
  color: var(--primary) !important;
}

.dropdown-divider {
  border-color: var(--border-color);
  opacity: 1;
  margin: 6px 0;
}

/* Live Search Suggestions Dropdown */
.search-wrapper {
  position: relative;
}

.search-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  margin-top: 8px;
  z-index: 1050;
  max-height: 380px;
  overflow-y: auto;
  display: none;
}

/* Hero Search Bar Theme Adaptation */
.hero-search-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  transition: all 0.25s ease;
}
[data-theme="light"] .hero-search-bar {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .hero-search-bar {
  background: #121826;
  border-color: rgba(255, 255, 255, 0.12);
}

.hero-search-addon {
  background: transparent !important;
  color: var(--text-muted) !important;
  border: none !important;
}

.hero-search-input {
  background: transparent !important;
  color: var(--text-main) !important;
  border: none !important;
}
.hero-search-input:focus {
  background: transparent !important;
  color: var(--text-main) !important;
  box-shadow: none !important;
}

.hero-tag-badge {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}
[data-theme="light"] .hero-tag-badge {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}
[data-theme="dark"] .hero-tag-badge {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.12);
}
.hero-tag-badge:hover {
  background: rgba(254, 44, 85, 0.1);
  color: var(--primary);
  border-color: rgba(254, 44, 85, 0.4);
}

.search-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
  color: var(--text-main);
  text-decoration: none;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover,
.search-item.active {
  background: rgba(254, 44, 85, 0.1);
  color: var(--text-main);
}

.search-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
}

/* Badges */
.badge-status-synced {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

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

.badge-status-failed {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-status-active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status-inactive {
  background: rgba(100, 116, 139, 0.15);
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.badge-status-banned {
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  font-weight: 700;
}

.status-pill-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  white-space: nowrap;
}

.badge-status-micro {
  font-size: 0.65rem !important;
  font-weight: 600 !important;
  padding: 2px 6px !important;
  border-radius: 6px !important;
  line-height: 1.15 !important;
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  letter-spacing: 0.2px;
}

.badge-status-micro i {
  font-size: 0.60rem !important;
  margin-right: 3px !important;
  line-height: 1 !important;
}

/* Banned Account Row Highlights */
.row-banned td {
  background-color: rgba(239, 68, 68, 0.05) !important;
}
.row-banned:hover td {
  background-color: rgba(239, 68, 68, 0.11) !important;
}
[data-theme="dark"] .row-banned td {
  background-color: rgba(239, 68, 68, 0.12) !important;
}
[data-theme="dark"] .row-banned:hover td {
  background-color: rgba(239, 68, 68, 0.18) !important;
}

.banned-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ef4444;
  color: #ffffff !important;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.ban-date-badge {
  color: #ef4444;
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Desktop Fixed Sidebar & Main Layout Wrapper (Admin & User Portals)
   ========================================================================== */
.app-layout-wrapper {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  position: relative;
}

.app-main-content {
  flex: 1 1 auto;
  min-width: 0; /* CRITICAL: Prevents wide tables & cards from squishing sidebar */
  width: calc(100% - var(--sidebar-width, 250px));
  max-width: calc(100% - var(--sidebar-width, 250px));
  background: var(--bg-main);
  box-sizing: border-box;
}

@media (max-width: 991.98px) {
  .app-main-content {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Fixed Desktop Sidebar */
.admin-sidebar {
  width: var(--sidebar-width, 250px) !important;
  min-width: var(--sidebar-width, 250px) !important;
  max-width: var(--sidebar-width, 250px) !important;
  flex: 0 0 var(--sidebar-width, 250px) !important;
  flex-shrink: 0 !important;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: var(--navbar-height, 57px);
  height: calc(100vh - var(--navbar-height, 57px));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem 0.75rem 1rem 0.75rem;
  box-sizing: border-box;
  z-index: 1020;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Sleek minimalist scrollbar for sidebar */
.admin-sidebar::-webkit-scrollbar {
  width: 4px;
}
.admin-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.admin-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
.admin-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Sidebar Section Headers */
.sidebar-section-title {
  font-size: 0.67rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  opacity: 0.75;
  padding: 0.85rem 0.65rem 0.35rem 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.sidebar-section-title:first-child {
  padding-top: 0.15rem;
}

/* Sidebar Navigation Items */
.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  margin-bottom: 3px;
  text-decoration: none;
  position: relative;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex-shrink: 0;
  background: rgba(125, 125, 125, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .sidebar-nav-icon {
  background: #f1f5f9;
  border-color: rgba(0, 0, 0, 0.07);
}

.sidebar-nav-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.15px;
}

/* Hover state */
.sidebar-nav-link:hover {
  background: rgba(254, 44, 85, 0.08);
  color: var(--text-main);
  transform: translateX(3px);
}

.sidebar-nav-link:hover .sidebar-nav-icon {
  background: rgba(254, 44, 85, 0.14);
  color: var(--primary);
  border-color: rgba(254, 44, 85, 0.3);
  box-shadow: 0 2px 8px rgba(254, 44, 85, 0.2);
}

/* Active state */
.sidebar-nav-link.active {
  background: linear-gradient(90deg, rgba(254, 44, 85, 0.14) 0%, rgba(254, 44, 85, 0.03) 100%);
  color: var(--primary);
  font-weight: 700;
}

.sidebar-nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(254, 44, 85, 0.6);
}

.sidebar-nav-link.active .sidebar-nav-icon {
  background: linear-gradient(135deg, #fe2c55 0%, #ff4c74 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(254, 44, 85, 0.38);
}

/* Sidebar Footer User Pill */
.sidebar-footer-card {
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
}

.sidebar-user-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}
.sidebar-user-pill:hover {
  border-color: rgba(254, 44, 85, 0.3);
}

/* Responsive Table into Cards on Mobile */
@media (max-width: 767.98px) {
  .table-responsive-stack thead {
    display: none;
  }
  .table-responsive-stack tr {
    display: block;
    margin-bottom: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 12px;
  }
  .table-responsive-stack td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding: 8px 4px;
  }
  .table-responsive-stack td:last-child {
    border-bottom: none;
  }
  .table-responsive-stack td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
  }
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

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

/* Toast container */
.toast-container-custom {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1090;
}

/* ==========================================================================
   Compact Metric Cards (Smaller height, very small grid)
   ========================================================================== */
.stat-card-compact {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.5rem 0.8rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
}

.stat-card-compact:hover {
  border-color: rgba(254, 44, 85, 0.35);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.stat-card-compact .stat-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.stat-card-compact .stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  line-height: 1.15;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card-compact .stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--stat-val-default);
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.stat-card-compact .stat-value.val-primary {
  color: var(--stat-val-primary);
}

.stat-card-compact .stat-value.val-success {
  color: var(--stat-val-success);
}

.stat-card-compact .stat-value.val-warning {
  color: var(--stat-val-warning);
}

.stat-card-compact .stat-value.val-danger {
  color: var(--stat-val-danger);
}

.stat-card-compact .stat-value.val-info {
  color: var(--stat-val-info);
}

.stat-card-compact .stat-icon-box {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  margin-left: 8px;
}

/* ==========================================================================
   Universal Theme Contrast & Color Fit Fixes (Light & Dark Themes)
   ========================================================================== */
.text-main {
  color: var(--text-main) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-dim {
  color: var(--text-dim) !important;
}

/* Safety contrast overrides: prevent invisible light-on-light or dark-on-dark */
[data-theme="light"] .text-light {
  color: var(--text-main) !important;
}

[data-theme="dark"] .text-dark {
  color: var(--text-main) !important;
}

[data-theme="light"] .bg-dark {
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .bg-light {
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
}

[data-theme="light"] .border-secondary {
  border-color: rgba(0, 0, 0, 0.12) !important;
}

[data-theme="dark"] .border-secondary {
  border-color: rgba(255, 255, 255, 0.12) !important;
}

code {
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 6px;
}

[data-theme="light"] code {
  background-color: rgba(254, 44, 85, 0.08);
  color: #dc2626 !important;
  border: 1px solid rgba(254, 44, 85, 0.15);
}

[data-theme="dark"] code {
  background-color: rgba(254, 44, 85, 0.15);
  color: #ff6b8b !important;
  border: 1px solid rgba(254, 44, 85, 0.25);
}

/* Form inputs & selects adaptive styling */
.form-control,
.form-select,
.input-group-text {
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.2) !important;
}

.form-control::placeholder {
  color: var(--text-dim) !important;
}

/* Adaptive table rules */
.table {
  color: var(--text-main) !important;
  border-color: var(--border-color) !important;
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-main);
  --bs-table-border-color: var(--border-color);
  --bs-table-hover-bg: var(--bg-card-hover);
  --bs-table-hover-color: var(--text-main);
}

.table thead th,
.theme-table-head th {
  background-color: var(--bg-main) !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border-color) !important;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 12px;
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.col-sync {
  width: 110px;
  min-width: 105px;
  max-width: 125px;
}

/* Dropdown menus & 3-Dots Action Trigger */
.btn-action-trigger {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-action-trigger i {
  font-size: 1rem;
  line-height: 1;
}

.btn-action-trigger:hover,
.btn-action-trigger:focus,
.btn-action-trigger[aria-expanded="true"] {
  background: var(--bg-card-hover);
  color: var(--primary);
  border-color: rgba(254, 44, 85, 0.45);
  box-shadow: 0 2px 8px rgba(254, 44, 85, 0.15);
  transform: translateY(-1px);
}

.btn-action-trigger:active {
  transform: translateY(0);
}

.dropdown-menu {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.15), 0 4px 12px -2px rgba(0, 0, 0, 0.08) !important;
  border-radius: 12px !important;
  padding: 6px !important;
  min-width: 185px;
  z-index: 1060;
  animation: dropdownSlideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.dropdown-item {
  color: var(--text-main) !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px;
  transition: all 0.15s ease !important;
}

.dropdown-item i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: rgba(254, 44, 85, 0.08) !important;
  color: var(--primary) !important;
  transform: translateX(2px);
}

.dropdown-item.text-danger:hover,
.dropdown-item.text-danger:focus {
  background-color: rgba(239, 68, 68, 0.1) !important;
  color: #ef4444 !important;
  transform: translateX(2px);
}

.dropdown-divider {
  border-color: var(--border-color) !important;
  margin: 5px 0 !important;
  opacity: 0.6;
}

/* ==========================================================================
   Micro Status & Privacy Badges (Single-line, compact typography)
   ========================================================================== */
.status-pill-group {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex-wrap: nowrap !important;
  vertical-align: middle;
}

.badge-status-micro {
  font-size: 0.65rem !important;
  font-weight: 600 !important;
  padding: 2px 6px !important;
  line-height: 1.2 !important;
  letter-spacing: 0.2px;
  border-radius: 4px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  white-space: nowrap !important;
}

.badge-status-micro i {
  font-size: 0.65rem !important;
  line-height: 1;
}

.badge-status-active {
  background-color: rgba(16, 185, 129, 0.12) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.badge-status-inactive {
  background-color: rgba(107, 114, 128, 0.15) !important;
  color: #9ca3af !important;
  border: 1px solid rgba(107, 114, 128, 0.25) !important;
}

.badge-status-banned {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  font-weight: 700 !important;
}

.row-banned {
  background-color: rgba(239, 68, 68, 0.04) !important;
}

.banned-pill {
  font-size: 0.62rem !important;
  padding: 1px 5px !important;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.18);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* ==========================================================================
   Live Sync & Real-time Update Feedback
   ========================================================================== */
@keyframes liveSyncPulse {
  0% { background-color: rgba(16, 185, 129, 0.28); }
  50% { background-color: rgba(16, 185, 129, 0.12); }
  100% { background-color: transparent; }
}

.row-synced-highlight > td {
  animation: liveSyncPulse 1.8s ease-out;
}

.card-synced-highlight {
  animation: liveSyncPulse 1.8s ease-out;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.35) !important;
}

/* ==========================================================================
   Theme-Adaptive Diagnostic Connection Panel & Form Styling
   ========================================================================== */
.diag-main-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  color: var(--text-main);
  transition: all 0.25s ease;
}
[data-theme="light"] .diag-main-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.09);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .diag-main-card {
  background: linear-gradient(145deg, rgba(24, 34, 52, 0.95), rgba(18, 24, 38, 0.98));
  border-color: rgba(255, 255, 255, 0.1);
}

.diag-title {
  color: var(--text-main) !important;
  letter-spacing: -0.3px;
}
.diag-subtitle {
  color: var(--text-muted) !important;
}

/* Theme Adaptive Form Inputs & Addons */
.diag-input {
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px;
  font-weight: 500;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.diag-input:focus {
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border-color: var(--border-focus) !important;
  box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.18) !important;
}
[data-theme="light"] .diag-input {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
[data-theme="dark"] .diag-input {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.diag-input-addon {
  background-color: var(--badge-bg) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border-color) !important;
  font-weight: 700;
}
[data-theme="light"] .diag-input-addon {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
}
[data-theme="dark"] .diag-input-addon {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: #94a3b8 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Channel Sub-Cards */
.diag-channel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.1rem;
  transition: all 0.25s ease;
}
[data-theme="light"] .diag-channel-card {
  background: #f8fafc;
  border-color: #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}
[data-theme="dark"] .diag-channel-card {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
.diag-channel-card:hover {
  border-color: rgba(254, 44, 85, 0.35);
  transform: translateY(-1px);
}

.diag-channel-title {
  color: var(--text-main) !important;
  font-weight: 700;
}
.diag-channel-label {
  color: var(--text-muted) !important;
}
.diag-channel-val {
  color: var(--text-main) !important;
  font-weight: 600;
}

.diag-latency-pill {
  font-family: monospace;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
[data-theme="light"] .diag-latency-pill {
  background: #e2e8f0;
  color: #334155;
}
[data-theme="dark"] .diag-latency-pill {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

/* Badges with High Contrast */
.diag-badge-success {
  background: rgba(16, 185, 129, 0.14) !important;
  color: #059669 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  font-weight: 700;
}
[data-theme="dark"] .diag-badge-success {
  color: #10b981 !important;
}
.diag-badge-warning {
  background: rgba(245, 158, 11, 0.14) !important;
  color: #d97706 !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  font-weight: 700;
}
[data-theme="dark"] .diag-badge-warning {
  color: #fbbf24 !important;
}
.diag-badge-danger {
  background: rgba(239, 68, 68, 0.14) !important;
  color: #dc2626 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  font-weight: 700;
}
[data-theme="dark"] .diag-badge-danger {
  color: #ef4444 !important;
}
.diag-badge-info {
  background: rgba(59, 130, 246, 0.14) !important;
  color: #2563eb !important;
  border: 1px solid rgba(59, 130, 246, 0.35) !important;
  font-weight: 700;
}
[data-theme="dark"] .diag-badge-info {
  color: #38bdf8 !important;
}

/* Corroborated Real Data Box */
.diag-corrob-box {
  border-radius: 14px;
  padding: 1.1rem;
}
[data-theme="light"] .diag-corrob-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
[data-theme="dark"] .diag-corrob-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.diag-metric-card {
  border-radius: 10px;
  padding: 0.6rem 0.4rem;
}
[data-theme="light"] .diag-metric-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
[data-theme="dark"] .diag-metric-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.diag-metric-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.diag-metric-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

/* JSON Technical Inspector */
.diag-json-pre {
  border-radius: 12px;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.8rem;
  max-height: 220px;
  overflow-y: auto;
}
[data-theme="light"] .diag-json-pre {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}
[data-theme="dark"] .diag-json-pre {
  background: #090d16;
  color: #38bdf8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Settings Nav Pills */
.settings-nav-pills {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px;
  border-radius: 14px;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
[data-theme="light"] .settings-nav-pills {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .settings-nav-pills {
  background: rgba(18, 24, 38, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
}
.settings-nav-pills .nav-link {
  color: var(--text-muted) !important;
  border-radius: 10px;
  padding: 8px 18px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}
.settings-nav-pills .nav-link:hover {
  color: var(--text-main) !important;
  background: rgba(254, 44, 85, 0.08);
}
.settings-nav-pills .nav-link.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(254, 44, 85, 0.35);
  border-color: transparent;
}

/* Theme utility classes */
.text-main {
  color: var(--text-main) !important;
}
.text-theme-muted {
  color: var(--text-muted) !important;
}

/* ==========================================================================
   Mobile-App Layout Polish (< 992px & < 768px)
   ========================================================================== */
@media (max-width: 991.98px) {
  /* Prevent horizontal scroll on small devices */
  html, body {
    overflow-x: hidden;
  }

  .container, .container-fluid {
    padding-left: 14px;
    padding-right: 14px;
  }

  /* Compact top navbar on mobile */
  .app-navbar {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  /* Touch-friendly buttons (minimum 40px touch targets) */
  .btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* App cards mobile touch feedback */
  .app-card {
    border-radius: 14px;
  }
}

@media (max-width: 767.98px) {
  /* Tables with smooth touch momentum scrolling */
  .table-responsive {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-sm);
  }

  .table td, .table th {
    padding: 10px 8px;
    font-size: 0.84rem;
  }

  /* Metric cards on mobile */
  .row.g-2.mb-3 .app-card {
    padding: 10px 12px !important;
  }

  /* Form controls touch target */
  .form-control, .form-select {
    font-size: 16px !important; /* Prevents iOS auto-zoom on inputs */
    padding: 9px 12px;
  }

  /* Mobile page header sizing */
  h1, .h1 { font-size: 1.65rem !important; }
  h2, .h2 { font-size: 1.4rem !important; }
  h3, .h3 { font-size: 1.25rem !important; }
}

/* ==========================================================================
   PDF Export & Multiple Selection Styling
   ========================================================================== */
.profile-select-cb,
#checkSelectAll {
  cursor: pointer;
  width: 17px;
  height: 17px;
  border-radius: 5px;
  border-color: var(--border-color);
  background-color: var(--bg-card);
  transition: all 0.15s ease;
}

.profile-select-cb:checked,
#checkSelectAll:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

#selectionFloatingBar {
  animation: slideUpFloat 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFloat {
  from {
    transform: translate(-50%, 40px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

