/* 
   Keep-Alive Manager - Premium Glassmorphic Stylesheet
   Designed with Tailormade HSL Colors, Sleek Dark Mode, and Dynamic Animations
*/

:root {
  /* Color Palette */
  --bg-dark: hsl(230, 24%, 6%);
  --bg-dark-rgb: 10, 11, 16;

  --primary: hsl(206, 100%, 50%);
  --primary-glow: hsl(206, 100%, 50%, 0.4);
  --primary-hover: hsl(210, 100%, 55%);

  --success: hsl(150, 85%, 45%);
  --success-glow: hsla(150, 85%, 45%, 0.35);

  --warning: hsl(38, 95%, 55%);
  --warning-glow: hsla(38, 95%, 55%, 0.35);

  --danger: hsl(335, 95%, 50%);
  --danger-glow: hsla(335, 95%, 50%, 0.35);

  --text-main: hsl(220, 25%, 90%);
  --text-muted: hsl(220, 15%, 65%);
  --text-dark: hsl(220, 20%, 15%);

  /* Card Glass Styles */
  --glass-bg: rgba(18, 20, 32, 0.45);
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-shadow: rgba(0, 0, 0, 0.35);
  --glass-glow-hover: rgba(255, 255, 255, 0.12);

  /* Transition Times */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);

  /* Font Families */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Base Setup */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Background Glowing Orbs */
.mesh-glow {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(140px);
  z-index: 0;
  mix-blend-mode: screen;
}

.bg-glow-1 {
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(79, 172, 254, 0.08) 0%, rgba(0, 242, 254, 0.01) 70%);
  top: -20%;
  left: -10%;
}

.bg-glow-2 {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(248, 87, 166, 0.06) 0%, rgba(255, 88, 88, 0.01) 70%);
  bottom: -10%;
  right: -10%;
}

.bg-glow-3 {
  width: 35vw;
  height: 35vw;
  background: radial-gradient(circle, rgba(161, 140, 209, 0.05) 0%, rgba(251, 194, 235, 0.01) 70%);
  top: 30%;
  left: 40%;
}

/* Main Container */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Glass Panel Utility */
.glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 var(--glass-shadow);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), transform var(--transition-normal);
  transform: translateZ(0);
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 2.5rem;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
}

.logo-icon {
  font-size: 1.8rem;
  color: var(--primary);
  background: rgba(0, 122, 255, 0.1);
  border: 1px solid rgba(0, 122, 255, 0.25);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(0, 122, 255, 0.2);
}

.logo-text h1 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.logo-text span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}



/* Dashboard Statistics Overview */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stats-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  contain: layout style;
}

.stats-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
  transform: translateY(-2px);
}

.stats-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stats-icon.blue {
  background: rgba(0, 122, 255, 0.1);
  color: var(--primary);
  border: 1px solid rgba(0, 122, 255, 0.2);
}

.stats-icon.green {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.stats-icon.purple {
  background: rgba(139, 92, 246, 0.1);
  color: hsl(263, 90%, 65%);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.stats-icon.orange {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.stats-info h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.stats-value {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
}

.stats-value .unit {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

/* Main Section */
.main-content {
  flex: 1;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title-wrap h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.25rem;
  border-radius: 30px;
}

.filter-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.4rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  color: #fff;
}

.filter-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.icon-btn-refresh {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  margin-left: 0.25rem;
}

.icon-btn-refresh:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  transform: rotate(180deg);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
}

/* Individual App Target Card */
.target-card {
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  contain: layout style;
}

.target-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 15px 45px 0 rgba(0, 0, 0, 0.5);
  transform: translateY(-4px);
}

/* Neon glow line top of active cards */
.target-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--card-theme-color, var(--primary)), transparent);
  opacity: 0.7;
}

.target-card.paused {
  opacity: 0.65;
}

.target-card.paused::before {
  background: linear-gradient(90deg, transparent, var(--text-muted), transparent);
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.target-title-wrap {
  max-width: 70%;
}

.target-title-wrap h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.15rem;
}

.target-url-link {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color var(--transition-fast);
}

.target-url-link:hover {
  color: var(--primary);
}

.card-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-status-badge.up {
  background: rgba(16, 185, 129, 0.07);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.15);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.05);
}

.card-status-badge.down {
  background: rgba(239, 68, 68, 0.07);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.15);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.05);
}

.card-status-badge.pending {
  background: rgba(245, 158, 11, 0.07);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.15);
}

.card-status-badge.paused-badge {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.05);
}

/* Card Stats Grid */
.card-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.75rem;
}

.card-stat-item {
  display: flex;
  flex-direction: column;
}

.card-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.card-stat-value {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 600;
}

/* Response Time Sparkline SVG */
.sparkline-container {
  height: 50px;
  position: relative;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.02);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sparkline-title {
  position: absolute;
  top: 5px;
  left: 8px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sparkline-svg {
  width: 100%;
  height: 100%;
}

.sparkline-path {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0px 2px 4px var(--card-theme-glow, rgba(0, 122, 255, 0.2)));
}

.sparkline-gradient {
  opacity: 0.15;
}

.sparkline-hover-info {
  position: absolute;
  right: 8px;
  top: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Card Action Footer */
.card-actions-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.75rem;
  margin-top: auto;
}

.card-control-btns {
  display: flex;
  gap: 0.5rem;
}

/* Toggles & Custom Switches */
.switch-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

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

/* Buttons */
.btn {
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 122, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #2563eb 100%);
  box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
  transform: translateY(-1px);
}

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

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Action Icon Buttons */
.action-icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.action-icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.action-icon-btn.ping-btn:hover {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

.action-icon-btn.edit-btn:hover {
  color: var(--primary);
  background: rgba(0, 122, 255, 0.1);
  border-color: rgba(0, 122, 255, 0.2);
}

.action-icon-btn.delete-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

/* Empty State */
.empty-state-container {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.08);
}

.empty-icon-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.empty-signal {
  font-size: 2.2rem;
  color: var(--text-muted);
}

.empty-state-container h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.empty-state-container p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 400px;
  margin-bottom: 1.5rem;
}

/* Footer Section */
.app-footer-bar {
  margin-top: auto;
  padding-top: 3rem;
  padding-bottom: 1rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.app-footer-bar p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 520px;
  padding: 2rem;
  position: relative;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}

.close-btn:hover {
  color: #fff;
}

/* Form Styling */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.input-wrapper input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all var(--transition-normal);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 15px rgba(0, 122, 255, 0.15);
}

.form-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Custom Interval Range */
.interval-selector {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 1rem;
}

.range-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.range-wrap input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.1);
  height: 6px;
  border-radius: 3px;
  outline: none;
}

.range-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary);
  transition: background var(--transition-fast);
}

.range-wrap input[type=range]::-webkit-slider-thumb:hover {
  background: var(--primary-hover);
}

.bubble {
  font-family: var(--font-heading);
  background: var(--primary);
  color: #fff;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 48px;
  text-align: center;
}

.interval-suggestions {
  display: flex;
  gap: 0.5rem;
}

.interval-suggestions span {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.interval-suggestions span:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.interval-suggestions span.active-preset {
  background: rgba(0, 122, 255, 0.15);
  border-color: rgba(0, 122, 255, 0.3);
  color: var(--primary-hover);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1.25rem;
}

/* Animations */
@keyframes pulse {
  0% {
    box-shadow: 0 0 4px var(--success);
  }

  100% {
    box-shadow: 0 0 14px var(--success);
  }
}

.animated-signal {
  animation: signal-wave 2s infinite ease-in-out;
}

@keyframes signal-wave {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }

  50% {
    transform: scale(1.15);
    opacity: 1;
    color: var(--primary-hover);
  }
}

/* Animations for open modal popup */
.popup-anim {
  transform: scale(0.9);
  opacity: 0;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
}

.modal-overlay.active .popup-anim {
  transform: scale(1);
  opacity: 1;
}

/* Spin Animation for Ping */
.spinning {
  animation: spin 1s linear infinite;
}

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

/* Toast System styling */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 380px;
  width: 100%;
}

.toast {
  background: rgba(18, 20, 32, 0.85);
  border-left: 4px solid var(--primary);
  border-top: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateX(120%);
  animation: slideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  transition: transform 0.35s, opacity 0.35s;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast-icon {
  font-size: 1.15rem;
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast-message {
  font-size: 0.85rem;
  font-weight: 500;
  flex: 1;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: #fff;
}

@keyframes slideIn {
  to {
    transform: translateX(0);
  }
}

.toast.slideOut {
  animation: slideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideOut {
  to {
    transform: translateX(120%);
    opacity: 0;
  }
}

/* ===== Theme Switcher UI ===== */
.theme-switcher-global {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.theme-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.theme-toggle-btn.active {
  background: rgba(0, 122, 255, 0.15);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 122, 255, 0.1);
}

/* ===== Light Theme Overrides ===== */
html.light-theme {
  --bg-dark: hsl(220, 20%, 96%);
  --bg-dark-rgb: 241, 243, 248;
  --text-main: hsl(220, 25%, 18%);
  --text-muted: hsl(220, 12%, 50%);
  --text-dark: hsl(220, 20%, 15%);
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.06);
  --glass-glow-hover: rgba(0, 0, 0, 0.04);
}

html.light-theme body {
  background-color: var(--bg-dark);
  color: var(--text-main);
}

html.light-theme .mesh-glow { opacity: 0.4; }

html.light-theme .bg-glow-1 {
  background: radial-gradient(circle, rgba(79, 172, 254, 0.12) 0%, rgba(0, 242, 254, 0.02) 70%);
}
html.light-theme .bg-glow-2 {
  background: radial-gradient(circle, rgba(248, 87, 166, 0.08) 0%, rgba(255, 88, 88, 0.02) 70%);
}
html.light-theme .bg-glow-3 {
  background: radial-gradient(circle, rgba(161, 140, 209, 0.08) 0%, rgba(251, 194, 235, 0.02) 70%);
}

html.light-theme .app-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

html.light-theme .logo-text h1 {
  background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}



html.light-theme .theme-switcher-global {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

html.light-theme .theme-toggle-btn {
  color: var(--text-muted);
}
html.light-theme .theme-toggle-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.05);
}
html.light-theme .theme-toggle-btn.active {
  background: rgba(79, 70, 229, 0.12);
  color: #4f46e5;
}

html.light-theme .stats-value,
html.light-theme .section-title-wrap h2,
html.light-theme .target-title-wrap h3,
html.light-theme .card-stat-value,
html.light-theme .modal-header h2,
html.light-theme .empty-state-container h3 {
  color: hsl(220, 25%, 15%);
}

html.light-theme .filter-actions {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}

html.light-theme .filter-btn { color: var(--text-muted); }
html.light-theme .filter-btn:hover { color: var(--text-main); }
html.light-theme .filter-btn.active {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

html.light-theme .icon-btn-refresh { color: var(--text-muted); }
html.light-theme .icon-btn-refresh:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

html.light-theme .card-stats-grid {
  border-top-color: rgba(0, 0, 0, 0.05);
}

html.light-theme .card-actions-footer {
  border-top-color: rgba(0, 0, 0, 0.05);
}

html.light-theme .action-icon-btn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
}
html.light-theme .action-icon-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.1);
}

html.light-theme .sparkline-container {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.04);
}

html.light-theme .empty-state-container {
  border-color: rgba(0, 0, 0, 0.08);
}

html.light-theme .modal-overlay {
  background: rgba(0, 0, 0, 0.4);
}
html.light-theme .modal-content {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  backdrop-filter: none;
}
html.light-theme .modal-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
html.light-theme .modal-header h2 {
  color: #0f172a;
}
html.light-theme .close-btn { color: #94a3b8; }
html.light-theme .close-btn:hover { color: #0f172a; }
html.light-theme .form-group label {
  color: #334155;
}
html.light-theme .form-hint {
  color: #94a3b8;
}

html.light-theme .input-wrapper input {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-main);
}
html.light-theme .input-wrapper input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(0, 122, 255, 0.1);
}
html.light-theme .input-wrapper input::placeholder { color: var(--text-muted); }

html.light-theme .interval-selector {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}
html.light-theme .range-wrap input[type=range] {
  background: rgba(0, 0, 0, 0.08);
}

html.light-theme .interval-suggestions span {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
}
html.light-theme .interval-suggestions span:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.06);
}

html.light-theme .btn-secondary {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-main);
}
html.light-theme .btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

html.light-theme .modal-actions {
  border-top-color: rgba(0, 0, 0, 0.06);
}

html.light-theme .slider {
  background-color: rgba(0, 0, 0, 0.18);
  border-color: rgba(0, 0, 0, 0.1);
}
html.light-theme .slider:before {
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
html.light-theme input:checked + .slider {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(0, 122, 255, 0.3);
}
html.light-theme input:checked + .slider:before {
  background-color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

html.light-theme .switch-control { color: var(--text-muted); }

html.light-theme .toast {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
  border-top-color: rgba(0, 0, 0, 0.06);
  border-right-color: rgba(0, 0, 0, 0.06);
  border-bottom-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}
html.light-theme .toast-close { color: var(--text-muted); }
html.light-theme .toast-close:hover { color: var(--text-main); }

html.light-theme .app-footer-bar {
  border-top-color: rgba(0, 0, 0, 0.04);
}

html.light-theme ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
}
html.light-theme ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* System Default: respect prefers-color-scheme */
@media (prefers-color-scheme: light) {
  html:not(.dark-theme):not(.light-theme) {
    --bg-dark: hsl(220, 20%, 96%);
    --bg-dark-rgb: 241, 243, 248;
    --text-main: hsl(220, 25%, 18%);
    --text-muted: hsl(220, 12%, 50%);
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.06);
    --glass-glow-hover: rgba(0, 0, 0, 0.04);
  }

  html:not(.dark-theme):not(.light-theme) body {
    background-color: var(--bg-dark);
    color: var(--text-main);
  }

  html:not(.dark-theme):not(.light-theme) .mesh-glow { opacity: 0.4; }
  html:not(.dark-theme):not(.light-theme) .logo-text h1 {
    background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  html:not(.dark-theme):not(.light-theme) .stats-value,
  html:not(.dark-theme):not(.light-theme) .section-title-wrap h2,
  html:not(.dark-theme):not(.light-theme) .target-title-wrap h3,
  html:not(.dark-theme):not(.light-theme) .card-stat-value,
  html:not(.dark-theme):not(.light-theme) .modal-header h2,
  html:not(.dark-theme):not(.light-theme) .empty-state-container h3 {
    color: hsl(220, 25%, 15%);
  }

  html:not(.dark-theme):not(.light-theme) .theme-switcher-global {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
  }
  html:not(.dark-theme):not(.light-theme) .theme-toggle-btn { color: hsl(220, 12%, 50%); }
  html:not(.dark-theme):not(.light-theme) .theme-toggle-btn:hover { color: hsl(220, 25%, 18%); background: rgba(0,0,0,0.05); }
  html:not(.dark-theme):not(.light-theme) .theme-toggle-btn.active { background: rgba(79,70,229,0.12); color: #4f46e5; }
  html:not(.dark-theme):not(.light-theme) .filter-actions { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.06); }
  html:not(.dark-theme):not(.light-theme) .filter-btn.active { background: rgba(0,0,0,0.06); color: hsl(220,25%,15%); }
  html:not(.dark-theme):not(.light-theme) .glass-panel { background: rgba(255,255,255,0.55); border-color: rgba(0,0,0,0.08); }
  html:not(.dark-theme):not(.light-theme) .toast { background: rgba(255,255,255,0.92); color: hsl(220,25%,18%); }
  html:not(.dark-theme):not(.light-theme) .input-wrapper input { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1); color: hsl(220,25%,18%); }
  html:not(.dark-theme):not(.light-theme) .slider { background-color: rgba(0,0,0,0.12); }
  html:not(.dark-theme):not(.light-theme) .btn-secondary { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); color: hsl(220,25%,18%); }
  html:not(.dark-theme):not(.light-theme) .app-header { border-bottom-color: rgba(0,0,0,0.06); }
  html:not(.dark-theme):not(.light-theme) .card-stats-grid,
  html:not(.dark-theme):not(.light-theme) .card-actions-footer { border-top-color: rgba(0,0,0,0.05); }
  html:not(.dark-theme):not(.light-theme) .action-icon-btn { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.06); }
  html:not(.dark-theme):not(.light-theme) .sparkline-container { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.04); }
  html:not(.dark-theme):not(.light-theme) .modal-overlay { background: rgba(0,0,0,0.35); }
  html:not(.dark-theme):not(.light-theme) .modal-content { border-color: rgba(0,0,0,0.1); box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
  html:not(.dark-theme):not(.light-theme) ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); }
}

/* Responsiveness adjustments */
@media (max-width: 768px) {
  .app-container {
    padding: 1.25rem 1rem;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
  }

  .header-actions {
    justify-content: space-between;
  }

  .stats-overview {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.75rem;
  }

  .stats-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 1rem;
  }

  .stats-icon {
    width: 38px;
    height: 38px;
    font-size: 1.05rem;
    border-radius: 8px;
  }

  .stats-info h3 {
    font-size: 0.72rem;
    letter-spacing: 0.2px;
  }

  .stats-value {
    font-size: 1.35rem;
  }

  .stats-value .unit {
    font-size: 0.85rem;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-actions {
    align-self: flex-start;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   NAVIGATION TABS STYLING
   ========================================================================== */
.app-tabs-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.app-tabs-nav .tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.app-tabs-nav .tab-btn i {
  font-size: 13px;
}

.app-tabs-nav .tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.app-tabs-nav .tab-btn.active {
  color: var(--primary);
  background: rgba(0, 122, 255, 0.08);
  border: 1px solid rgba(0, 122, 255, 0.2);
  box-shadow: 0 0 12px rgba(0, 122, 255, 0.1);
}

/* Ensure tab contents transition smoothly or hide correctly */
.tab-content {
  width: 100%;
}


/* ==========================================================================
   NESTED SCOPE FOR MONGODB EXPLORER (PREVENTS GLOBAL CLASS/TAG COLLISION)
   ========================================================================== */
#db-app-content,
#db-modals-container {
  /* Modern CSS Architecture - Premium Design System */

  & {
    --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* default Theme Variables (Dark Mode by default) */
    --bg-app: #080c14;
    --bg-sidebar: #0d121f;
    --bg-surface: rgba(18, 25, 41, 0.7);
    --bg-surface-solid: #121929;
    --bg-input: rgba(30, 41, 59, 0.4);
    --bg-input-focus: rgba(30, 41, 59, 0.75);

    --border-color: rgba(51, 65, 85, 0.4);
    --border-focus: #6366f1;
    --border-glow: rgba(99, 102, 241, 0.25);

    --text-main: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;

    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-rgb: 99, 102, 241;

    --success: #10b981;
    --success-hover: #059669;
    --success-rgb: 16, 185, 129;

    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-rgb: 239, 68, 68;

    --warning: #f59e0b;

    /* Layout tokens */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 24px;
    --glass-blur: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows & Glows */
    --glow-shadow: 0 0 24px rgba(99, 102, 241, 0.2);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);

    /* JSON Highlight Colors (Dark) */
    --json-key: #818cf8;
    --json-string: #34d399;
    --json-number: #fbbf24;
    --json-boolean: #f87171;
    --json-null: #a78bfa;
    --json-special: #f472b6;
    --json-bracket: #94a3b8;
  }

  /* Explicit Light Theme */
  .light-theme & {
    --bg-app: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-solid: #ffffff;
    --bg-input: #f8fafc;
    --bg-input-focus: #ffffff;

    --border-color: #e2e8f0;
    --border-focus: #4f46e5;
    --border-glow: rgba(79, 70, 229, 0.15);

    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #94a3b8;

    --primary: #4f46e5;
    --primary-hover: #3730a3;
    --primary-rgb: 79, 70, 229;

    --success: #10b981;
    --success-hover: #047857;

    --danger: #ef4444;
    --danger-hover: #b91c1c;

    --glow-shadow: 0 0 24px rgba(79, 70, 229, 0.1);
    --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.12);

    /* JSON Highlight Colors (Light) */
    --json-key: #4f46e5;
    --json-string: #047857;
    --json-number: #d97706;
    --json-boolean: #dc2626;
    --json-null: #6d28d9;
    --json-special: #db2777;
    --json-bracket: #475569;
  }

  /* Explicit Dark Theme */
  .dark-theme & {
    --bg-app: #080c14;
    --bg-sidebar: #0d121f;
    --bg-surface: rgba(18, 25, 41, 0.7);
    --bg-surface-solid: #121929;
    --bg-input: rgba(30, 41, 59, 0.4);
    --bg-input-focus: rgba(30, 41, 59, 0.75);

    --border-color: rgba(51, 65, 85, 0.4);
    --border-focus: #6366f1;
    --border-glow: rgba(99, 102, 241, 0.25);

    --text-main: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;

    --primary: #6366f1;
    --primary-hover: #4f46e5;

    --success: #10b981;
    --success-hover: #059669;

    --danger: #ef4444;
    --danger-hover: #dc2626;

    --glow-shadow: 0 0 24px rgba(99, 102, 241, 0.2);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);

    /* JSON Highlight Colors (Dark) */
    --json-key: #818cf8;
    --json-string: #34d399;
    --json-number: #fbbf24;
    --json-boolean: #f87171;
    --json-null: #a78bfa;
    --json-special: #f472b6;
    --json-bracket: #94a3b8;
  }

  /* System Preference Sync (Overrides for light mode users) */
  @media (prefers-color-scheme: light) {
    :root:not(.dark-theme):not(.light-theme) & {
      --bg-app: #f1f5f9;
      --bg-sidebar: #ffffff;
      --bg-surface: rgba(255, 255, 255, 0.7);
      --bg-surface-solid: #ffffff;
      --bg-input: #f8fafc;
      --bg-input-focus: #ffffff;

      --border-color: #e2e8f0;
      --border-focus: #4f46e5;
      --border-glow: rgba(79, 70, 229, 0.15);

      --text-main: #0f172a;
      --text-secondary: #334155;
      --text-muted: #94a3b8;

      --primary: #4f46e5;
      --primary-hover: #3730a3;

      --success: #10b981;
      --success-hover: #047857;

      --danger: #ef4444;
      --danger-hover: #b91c1c;

      --glow-shadow: 0 0 24px rgba(79, 70, 229, 0.1);
      --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
      --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
      --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.12);

      --json-key: #4f46e5;
      --json-string: #047857;
      --json-number: #d97706;
      --json-boolean: #dc2626;
      --json-null: #6d28d9;
      --json-special: #db2777;
      --json-bracket: #475569;
    }
  }

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

  &#db-app-content {
    font-family: var(--font-sans);
    background: var(--bg-app);
    color: var(--text-main);
    overflow: hidden;
    height: calc(100vh - 180px);
    min-height: 600px;
    width: 100%;
    position: relative;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  }

  /* Screen Management */
  .screen {
    display: none;
    opacity: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    transition: opacity 0.4s ease;
  }

  .screen.active {
    display: flex;
    opacity: 1;
    z-index: 10;
  }

  /* Scrollbar Styling */
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
  }

  /* Typography & Links */
  h1,
  h2,
  h3,
  h4 {
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  /* Buttons */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
  }

  .btn-block {
    width: 100%;
  }

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

  .btn-primary {
    background: var(--primary);
    color: #ffffff;
  }

  .btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
  }

  .btn-success {
    background: var(--success);
    color: #ffffff;
  }

  .btn-success:hover {
    background: var(--success-hover);
    box-shadow: 0 4px 12px rgba(var(--success-rgb), 0.3);
  }

  .btn-success:disabled {
    background: var(--text-muted);
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
  }

  .btn-danger {
    background: var(--danger);
    color: #ffffff;
  }

  .btn-danger:hover {
    background: var(--danger-hover);
    box-shadow: 0 4px 12px rgba(var(--danger-rgb), 0.3);
  }

  .btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
  }

  .btn-outline:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
  }

  .btn-outline-danger {
    background: transparent;
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
  }

  .btn-outline-danger:hover:not(:disabled) {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
  }

  .btn-outline-danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  .btn-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
  }

  .btn-circle:hover {
    border-color: var(--text-main);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
  }

  .btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
  }

  .btn-icon:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
  }

  .btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
  }

  .btn-close:hover {
    color: var(--text-main);
  }

  /* Forms */
  .form-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .form-group label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
  }

  .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
  }

  .input-wrapper input {
    width: 100%;
  }

  input[type="text"],
  input[type="password"],
  select,
  textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 12px 14px;
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: var(--transition-fast);
  }

  input[type="text"]:focus,
  input[type="password"]:focus,
  select:focus,
  textarea:focus {
    background: var(--bg-input-focus);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--border-glow);
  }

  input.locked {
    opacity: 0.65;
    cursor: not-allowed;
    background: rgba(30, 41, 59, 0.15);
    border-color: var(--border-color) !important;
    box-shadow: none !important;
  }

  .btn-icon-input {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .btn-icon-input:hover {
    color: var(--text-main);
  }

  .help-text {
    font-size: 11px;
    color: var(--text-muted);
  }

  /* 1. CONNECTION SCREEN */
  #connection-screen {
    background: radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
      radial-gradient(circle at 10% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
      var(--bg-app);
    justify-content: center;
    align-items: center;
  }

  .connection-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
  }

  .connection-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 460px;
    background: var(--bg-surface);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: cardEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  @keyframes cardEntrance {
    from {
      opacity: 0;
      transform: translateY(20px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .brand {
    text-align: center;
    margin-bottom: 30px;
  }

  .logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    filter: drop-shadow(0 4px 8px rgba(16, 185, 129, 0.25));
    transition: transform 0.4s ease;
  }

  .connection-card:hover .logo {
    transform: scale(1.08) rotate(5deg);
  }

  .brand h1 {
    font-size: 26px;
    color: var(--text-main);
    margin-bottom: 6px;
  }

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

  .connection-footer {
    text-align: center;
    margin-top: 30px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }

  /* 2. DASHBOARD SCREEN & SIDEBAR */
  #dashboard-screen {
    background: var(--bg-app);
  }

  .sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    z-index: 5;
  }

  .sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
  }

  .logo-sm {
    width: 24px;
    height: 24px;
  }

  .sidebar-brand h2 {
    font-size: 18px;
    color: var(--text-main);
  }

  .connection-status-card {
    padding: 16px;
    margin: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
  }

  .status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
  }

  .pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 1.5s infinite;
  }

  @keyframes pulse {
    0% {
      transform: scale(0.9);
      opacity: 0.8;
    }

    50% {
      transform: scale(1.15);
      opacity: 1;
      box-shadow: 0 0 12px var(--success);
    }

    100% {
      transform: scale(0.9);
      opacity: 0.8;
    }
  }

  .status-text {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--success);
  }

  .active-host-text {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: 14px;
    font-family: var(--font-mono);
  }

  .sidebar-section {
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
  }

  .sidebar-section.fill-remaining {
    flex-grow: 1;
    overflow: hidden;
  }

  .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }

  .section-header span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
  }

  /* Custom DB Dropdown */
  .custom-select-wrapper {
    position: relative;
  }

  .custom-select-wrapper select {
    width: 100%;
    padding-right: 36px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
  }

  .custom-select-wrapper::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 5px solid var(--text-muted);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    pointer-events: none;
  }

  /* Search Box */
  .search-box {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
  }

  .search-box svg {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
  }

  .search-box input {
    width: 100%;
    padding-left: 34px !important;
    font-size: 13px !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  /* Collections Scroll List */
  .collections-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
  }

  .collection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-secondary);
    font-size: 13px;
  }

  .collection-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
  }

  .collection-item.active {
    background: var(--primary-glow, rgba(99, 102, 241, 0.08));
    color: var(--primary);
    font-weight: 600;
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  }

  .collection-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .collection-text-group {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .collection-title {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .collection-meta {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 1px;
  }

  .collection-name-wrapper svg {
    flex-shrink: 0;
    opacity: 0.6;
  }

  .collection-item.active svg {
    opacity: 1;
  }

  .collection-item-actions {
    opacity: 0;
    transition: var(--transition-fast);
  }

  .collection-item:hover .collection-item-actions {
    opacity: 1;
  }

  .empty-state-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 24px 10px;
  }

  /* Sidebar Footer & Theme Toggle */
  .sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
  }

  .theme-switcher {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: 10px;
    gap: 2px;
  }

  .theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 8px 4px;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
  }

  .theme-btn:hover {
    color: var(--text-main);
  }

  .theme-btn.active {
    background: var(--bg-surface-solid);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
  }

  /* MAIN CONTENT AREA */
  .main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }

  /* Explorer Topbar Header */
  .explorer-header {
    height: 72px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
  }

  .breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
  }

  .bc-home {
    color: var(--text-muted);
  }

  .bc-sep {
    color: var(--text-muted);
    opacity: 0.5;
  }

  .bc-active {
    color: var(--text-main);
    font-weight: 700;
  }

  .header-actions {
    display: flex;
    gap: 12px;
  }

  /* Advanced Query Section */
  .query-section {
    padding: 20px 30px 10px;
    flex-shrink: 0;
  }

  .query-panel-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .query-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
  }

  .header-title svg {
    color: var(--primary);
  }

  .query-help-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
  }

  .query-help-btn:hover {
    text-decoration: underline;
  }

  .query-help-content {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 12px;
  }

  .query-help-content p {
    color: var(--text-secondary);
    margin-bottom: 8px;
  }

  .examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    font-family: var(--font-mono);
  }

  .examples-grid code {
    background: rgba(0, 0, 0, 0.15);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-main);
    border-left: 2px solid var(--primary);
  }

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

  .query-& {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .query-body textarea {
    width: 100%;
    height: 64px;
    font-family: var(--font-mono);
    font-size: 13px;
    resize: none;
    padding: 10px 14px;
  }

  .query-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .sort-inputs {
    display: flex;
    gap: 10px;
    flex-grow: 1;
  }

  .sort-inputs input {
    flex-grow: 2;
    padding: 8px 12px !important;
    font-size: 13px !important;
  }

  .sort-inputs select {
    flex-grow: 1;
    padding: 8px 12px !important;
    font-size: 13px !important;
  }

  .action-buttons {
    display: flex;
    gap: 10px;
  }

  .action-buttons button {
    padding: 8px 16px;
    font-size: 13px;
  }

  /* Document List Area */
  .document-section {
    padding: 10px 30px 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
  }

  .document-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-shrink: 0;
  }

  .count-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .view-options {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .refresh-indicator {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    transition: var(--transition-fast);
  }

  .refresh-indicator.active {
    opacity: 1;
    animation: blink 1s infinite alternate;
  }

  @keyframes blink {
    from {
      opacity: 0.3;
    }

    to {
      opacity: 1;
    }
  }

  .documents-grid {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 4px;
  }

  .dashboard-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    min-height: 250px;
    color: var(--text-muted);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
  }

  .empty-art {
    margin-bottom: 16px;
    color: var(--text-muted);
    opacity: 0.5;
  }

  .dashboard-empty-state h3 {
    color: var(--text-main);
    font-size: 18px;
    margin-bottom: 8px;
  }

  .dashboard-empty-state p {
    font-size: 13px;
    max-width: 320px;
  }

  /* Document Item Card */
  .document-card {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    position: relative;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .document-card:hover {
    border-color: var(--text-muted);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
  }

  .document-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 10px;
  }

  .doc-id-badge {
    font-family: var(--font-mono);
    font-size: 12px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
  }

  .doc-card-actions {
    display: flex;
    gap: 6px;
  }

  .doc-card-actions button {
    width: 30px;
    height: 30px;
  }

  /* Pretty JSON Formatting */
  .pretty-json-wrapper {
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
  }

  .pretty-json-wrapper code {
    color: var(--text-main);
  }

  .json-key {
    color: var(--json-key);
    font-weight: 600;
  }

  .json-string {
    color: var(--json-string);
  }

  .json-number {
    color: var(--json-number);
  }

  .json-boolean {
    color: var(--json-boolean);
    font-weight: 600;
  }

  .json-null {
    color: var(--json-null);
    font-weight: 600;
  }

  .json-bracket {
    color: var(--json-bracket);
  }

  /* BSON UI Pill representations (extremely clean) */
  .bson-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(244, 114, 182, 0.08);
    border: 1px solid rgba(244, 114, 182, 0.2);
    color: var(--json-special);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
  }

  .bson-pill.date {
    background: rgba(167, 139, 250, 0.08);
    border-color: rgba(167, 139, 250, 0.2);
    color: var(--json-null);
  }

  /* Pagination Row */
  .pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 0;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    margin-top: 12px;
  }

  .page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
  }

  .page-size-selector select {
    padding: 4px 8px !important;
    font-size: 12px !important;
  }

  .pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .pagination-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
  }

  .btn-nav {
    width: 32px;
    height: 32px;
  }

  .btn-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: var(--border-color);
    background: transparent;
    color: var(--text-muted);
  }

  /* MODALS AND DIALOGS */
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 8, 15, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .modal-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateY(30px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
  }

  .modal-lg {
    max-width: 720px;
  }

  .modal-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
  }

  .modal-header h3 {
    font-size: 18px;
    color: var(--text-main);
  }

  .modal-& {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
  }

  .modal-footer {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.05);
  }

  /* Custom JSON Text Editor inside Modal */
  .editor-& {
    padding: 16px !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .editor-syntax-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
  }

  .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
  }

  .editor-syntax-status.valid .status-dot {
    background: var(--success);
  }

  .editor-syntax-status.valid {
    color: var(--success);
  }

  .editor-syntax-status.invalid .status-dot {
    background: var(--danger);
  }

  .editor-syntax-status.invalid {
    color: var(--danger);
  }

  .editor-wrapper {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  .document-editor {
    width: 100%;
    height: 320px;
    background: #090d16 !important;
    color: #c9d1d9 !important;
    font-family: var(--font-mono);
    font-size: 13px;
    border: none !important;
    border-radius: 0 !important;
    padding: 16px !important;
    resize: vertical;
    line-height: 1.5;
  }

  .editor-error-msg {
    background: rgba(239, 68, 68, 0.07);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--danger);
    padding: 10px 14px;
    font-size: 12px;
    font-family: var(--font-mono);
    animation: shake 0.4s ease;
  }

  @keyframes shake {

    0%,
    100% {
      transform: translateX(0);
    }

    25% {
      transform: translateX(-6px);
    }

    75% {
      transform: translateX(6px);
    }
  }

  .editor-helper-bar {
    font-size: 11px;
    color: var(--text-muted);
  }

  .editor-helper-bar code {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--text-secondary);
  }

  /* Danger Modal customization */
  .danger-card .modal-header h3 {
    color: var(--danger);
  }

  .danger-icon-container {
    display: flex;
    justify-content: center;
    color: var(--danger);
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 10px rgba(239, 68, 68, 0.2));
  }

  .danger-card p {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
  }

  .danger-card .form-group label {
    text-align: center;
    align-self: center;
  }

  .danger-card input {
    text-align: center;
  }

  /* FLOATING TOAST NOTIFICATION CONTAINER */
  .toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
    width: 100%;
    pointer-events: none;
  }

  .toast {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: var(--transition);
    pointer-events: auto;
  }

  @keyframes toastSlideIn {
    from {
      opacity: 0;
      transform: translateX(40px);
    }

    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .toast.removing {
    animation: toastSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  @keyframes toastSlideOut {
    to {
      opacity: 0;
      transform: translateX(60px);
    }
  }

  .toast-icon {
    flex-shrink: 0;
  }

  .toast-success .toast-icon {
    color: var(--success);
  }

  .toast-error .toast-icon {
    color: var(--danger);
  }

  .toast-info .toast-icon {
    color: var(--primary);
  }

  .toast-& {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
  }

  .toast-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
  }

  .toast-message {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
  }

  .toast-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: inline-flex;
  }

  .toast-close-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
  }

  .toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    width: 100%;
  }

  .toast-success .toast-progress {
    background: var(--success);
  }

  .toast-error .toast-progress {
    background: var(--danger);
  }

  .toast-info .toast-progress {
    background: var(--primary);
  }

  /* HELPER UTILITIES */
  .hidden {
    display: none !important;
  }

  /* SIDEBAR TOGGLE AND MOBILE RESPONSIVENESS OVERRIDES */
  .btn-sidebar-toggle {
    display: none;
    margin-right: 12px;
  }

  @media (max-width: 768px) {
    .btn-sidebar-toggle {
      display: inline-flex;
    }

    #dashboard-screen {
      position: relative;
      overflow: hidden;
    }

    .sidebar-backdrop {
      display: block;
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.45);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      z-index: 90;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }

    .sidebar-backdrop.active {
      opacity: 1;
      pointer-events: auto;
    }

    .sidebar {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      width: 280px;
      max-width: 85%;
      z-index: 100;
      transform: translateX(-100%);
      transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: none;
    }

    .sidebar.open {
      transform: translateX(0);
      box-shadow: var(--shadow-lg);
    }

    .explorer-header {
      height: auto;
      padding: 16px 20px;
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;
    }

    .explorer-header .header-actions {
      width: 100%;
      justify-content: space-between;
      gap: 10px;
    }

    .explorer-header .header-actions .btn {
      flex: 1;
      padding: 8px 12px;
      font-size: 13px;
    }

    .query-section {
      padding: 12px 20px 8px;
    }

    .query-actions {
      flex-direction: column;
      align-items: stretch;
      gap: 12px;
    }

    .sort-inputs {
      width: 100%;
      flex-direction: row;
    }

    .action-buttons {
      justify-content: flex-end;
      width: 100%;
      gap: 10px;
    }

    .action-buttons button {
      flex: 1;
    }

    .document-section {
      padding: 8px 20px 16px;
    }

    .pretty-json-wrapper {
      font-size: 12px;
    }

    .pagination-bar {
      flex-direction: column;
      gap: 12px;
      align-items: center;
      padding: 12px 0 0;
    }

    .connection-card {
      padding: 24px 20px;
      margin: 16px;
      width: calc(100% - 32px);
    }

    .modal-card {
      width: calc(100% - 24px);
      margin: 12px;
    }

    .document-editor {
      height: 220px;
    }
  }

}