

:root {
  --glass-bg: rgba(15, 23, 42, 0.65);
  --glass-border: rgba(99, 102, 241, 0.12);
  --glass-border-hover: rgba(99, 102, 241, 0.3);
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --bg-deep: #020617;
  --bg-surface: #0f172a;
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.25);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.2);
  --sidebar-width: 280px;
  --header-height: 70px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-deep);
  color: #e2e8f0;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ========== BACKGROUND LAYERS (FIXED Z-INDEX) ========== */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 15% 15%, rgba(99, 102, 241, 0.07) 0%, transparent 50%),
              radial-gradient(ellipse at 85% 85%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 50%, rgba(59, 130, 246, 0.03) 0%, transparent 60%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(99, 102, 241, 0.025) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(99, 102, 241, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
}

/* ========== SIDEBAR (NAVBAR) — COMPLETELY FIXED ========== */
#sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: #0b1220;
  backdrop-filter: blur(16px);
  background: rgba(8, 14, 26, 0.98);
  border-right: 1px solid rgba(99, 102, 241, 0.2);
  padding: 24px 20px;
  transition: left 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  z-index: 1000;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

#sidebar.active {
  left: 0;
}

/* Sidebar brand + text fix */
#sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(135deg, #c084fc, #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 32px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.25);
  letter-spacing: -0.3px;
}

#sidebar .brand i {
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  color: #818cf8;
  font-size: 1.4rem;
}

/* Nav items — clean & readable */
.nav-item {
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: transparent;
  border: none;
  color: #cbd5e1;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Inter', sans-serif;
}

.nav-item i {
  width: 22px;
  font-size: 1.1rem;
  color: #64748b;
  transition: color 0.2s;
}

.nav-item:hover {
  background: rgba(99, 102, 241, 0.15);
  color: white;
}

.nav-item:hover i {
  color: #a5b4fc;
}

/* Close button inside sidebar */
.close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: #ef4444;
}

/* ========== OVERLAY (SIDEBAR BACKDROP) ========== */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  z-index: 999;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

#overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ========== MENU BUTTON (HAMBURGER) ========== */
.menu-btn {
  position: fixed;
  top: 18px;
  left: 20px;
  z-index: 1100;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 14px;
  color: #e2e8f0;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.menu-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(0.97);
  color: white;
}

/* ========== HEADER (Text completely fixed, no overlap) ========== */
.dashboard-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(16px);
  padding: 16px 0;
  margin-left: 0;
  width: 100%;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

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

.icon-box {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818cf8;
  font-size: 1.4rem;
}

.header-left div h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f1f5f9, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.3px;
}

.header-left div p {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 2px;
  font-weight: 500;
}

.header-glow {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

/* ========== MAIN CONTENT / CARDS (text improvement) ========== */
main {
  position: relative;
  z-index: 10;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Glassmorphism card */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
}

/* stat cards + typography */
.stat-card {
  position: relative;
  padding: 1.4rem;
  border-radius: 1.25rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--glass-border);
  transition: all 0.25s ease;
  backdrop-filter: blur(4px);
}

.stat-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-2px);
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.7rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.2;
}

.stat-value-sm {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  font-weight: 600;
  color: #e2e8f0;
}

.bot-number-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: #facc15;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #facc15, #fde047);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* status pill text fix */
.online-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.online-pill.online {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #4ade80;
}

.online-pill.offline {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.online .status-dot {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse 1.8s infinite;
}

.offline .status-dot {
  background: #ef4444;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1);}
  50% { opacity: 0.6; transform: scale(0.8);}
}

/* input group (phone) */
.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.6);
  transition: all 0.2s;
  overflow: hidden;
}

.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.phone-input {
  background: transparent;
  border: none;
  outline: none;
  padding: 0.9rem 1rem;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
  width: 100%;
}

.check-btn {
  background: linear-gradient(105deg, #6366f1, #7c3aed);
  border: none;
  padding: 12px 28px;
  border-radius: 1rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.check-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.5);
}

/* messages */
.msg-box {
  display: none;
  padding: 1rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  border: 1px solid transparent;
}

.msg-box.show {
  display: block;
}

.msg-error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.msg-warn {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

/* loading */
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top: 3px solid #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* poll bar */
.poll-bar {
  height: 3px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.poll-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  transition: width 0.1s linear;
}

/* footer text */
footer p {
  color: #64748b;
  font-size: 0.7rem;
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid rgba(71, 85, 105, 0.3);
  margin-top: 2rem;
}

/* responsive fixes */
@media (max-width: 640px) {
  .stat-value {
    font-size: 1.3rem;
  }
  .header-left div h1 {
    font-size: 1.2rem;
  }
  .menu-btn {
    top: 14px;
    left: 14px;
    width: 40px;
    height: 40px;
  }
  .dashboard-header {
    padding-left: 0;
  }
  .header-inner {
    padding-left: 70px;
  }
}

/* scrollbar */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 10px;
}

/* dashboard animation */
.dashboard {
  animation: fadeUp 0.4s ease;
}

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

/* extra: fix any broken text contrast */
.text-slate-400 {
  color: #94a3b8;
}

.glass .stat-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.8rem;
  color: #a5b4fc;
}

/* sidebar text additional polish */
.nav-item span {
  font-weight: 500;
}

/* button & spacing coherence */
#loadingStatus p {
  color: #94a3b8;
}
.icon-box {
  width: 45px;
  height: 45px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
