/* =========================================================================
   TNS Module Simulation Framework — reproduces the real TNS Django UI
   (dashboard/templates/dashboard/base.html + netdb/templates/netdb/*).

   Every selector below is scoped under .module-sim so styles never leak into
   the marketing page. Internal class names mirror the real app where
   practical (.dashboard-hero, .hero-icon, .hero-title, .sidebar-header,
   .accordion-button, .nav-link, .modern-table, etc.) so the markup read
   like a copy-paste of the source template.

   Per-module JS files (./sims/<slug>.js) render into .module-sim containers
   and play a guided-tour loop. Clicking the card opens an expanded modal
   version (re-using the video modal chrome from landing.html).
   ========================================================================= */

:root {
  --sim-bg:          #0c0e15;   /* --dark-bg */
  --sim-bg-deep:     #080a10;   /* --darker-bg */
  --sim-card:        #151820;   /* --card-bg / --dark-card / --bg-sidebar */
  --sim-card-2:      #1a1e26;   /* --darker-card */
  --sim-border:      #2e3549;   /* --border-color */
  --sim-border-2:    #3f4659;
  --sim-text:        #e0e6f1;   /* --text-color */
  --sim-text-muted:  #8e96a7;   /* --text-muted */
  --sim-primary:     #007bff;   /* --primary-color */
  --sim-primary-2:   #0056d2;
  --sim-success:     #28a745;
  --sim-warning:     #ffc107;
  --sim-danger:      #dc3545;
  --sim-info:        #17a2b8;
}

/* ============ Outer container (in the landing-page card) ============ */

.module-sim {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--sim-bg);
  color: var(--sim-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.8125rem;           /* matches base.html body { font-size: 0.8125rem; } */
  line-height: 1.4;
  cursor: pointer;                /* click-to-expand */
  -webkit-font-smoothing: antialiased;
  isolation: isolate;
}
.module-row .module-sim { aspect-ratio: 16 / 9; }

.module-sim *,
.module-sim *::before,
.module-sim *::after { box-sizing: border-box; }

/* "Click to expand" hint */
.module-sim .sim-hint {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 15;
  font-size: 10px;
  font-weight: 600;
  color: var(--sim-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.2s, transform 0.2s;
}
.module-sim:hover .sim-hint { opacity: 1; transform: translateY(0); }

/* Subtle grid overlay */
.module-sim::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0, 123, 255, 0.05) 1px, transparent 1px) 0 0 / 50px 50px,
    linear-gradient(90deg, rgba(0, 123, 255, 0.05) 1px, transparent 1px) 0 0 / 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* ============ Browser frame ============ */

.sim-frame {
  position: absolute;
  inset: 12px;
  background: var(--sim-bg);
  border: 1px solid var(--sim-border);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

/* macOS titlebar */
.sim-titlebar {
  height: 24px;
  background: linear-gradient(180deg, var(--sim-card), var(--sim-bg));
  border-bottom: 1px solid var(--sim-border);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 6px;
  flex: none;
}
.sim-titlebar .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--sim-border-2);
}
.sim-titlebar .dot.red   { background: #ff5f57; }
.sim-titlebar .dot.amber { background: #febc2e; }
.sim-titlebar .dot.green { background: #28c940; }

.sim-url {
  margin-left: 12px;
  font-size: 10.5px;
  color: var(--sim-text-muted);
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sim-url .lock { opacity: 0.5; font-size: 9px; }

/* ============ Top navbar (mirrors #main-navbar) ============ */

.sim-navbar {
  height: 34px;
  background: var(--sim-card);
  border-bottom: 1px solid var(--sim-border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  flex: none;
}

.sim-navbar .navbar-brand {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sim-text);
  text-decoration: none;
}
.sim-navbar .navbar-brand i {
  font-size: 13px;
  color: var(--sim-primary);
}

.sim-navbar .tenant-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--sim-bg-deep);
  border: 1.5px solid var(--sim-border);
  border-radius: 8px;
  color: var(--sim-text);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  margin-left: auto;
}
.sim-navbar .tenant-dropdown-toggle i {
  color: var(--sim-primary);
  font-size: 10px;
}

.sim-navbar .navbar-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sim-primary), var(--sim-primary-2));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border: 1.5px solid var(--sim-primary);
}

/* ============ Body: sidebar + main ============ */

.sim-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--sim-bg);
  min-height: 0;
}

/* ---- Sidebar (mirrors #sidebar) ---- */

.sim-sidebar {
  flex: none;
  width: 158px;
  background: var(--sim-card);
  border-right: 1px solid var(--sim-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.sim-sidebar .sidebar-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--sim-border);
  background: var(--sim-bg-deep);
}
.sim-sidebar .sidebar-header h3 {
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--sim-text);
}
.sim-sidebar .sidebar-header h3 i { color: var(--sim-primary); }
.sim-sidebar .sidebar-header p {
  margin: 2px 0 0;
  font-size: 8.5px;
  color: var(--sim-text-muted);
  opacity: 0.75;
}

.sim-sidebar .sidebar-nav,
.sim-sidebar .accordion {
  flex: 1;
  padding: 6px 0;
  overflow: hidden;
}

.sim-sidebar .nav-section-header {
  padding: 8px 12px 3px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--sim-text-muted);
  opacity: 0.6;
}

/* Accordion section buttons (mirrors .accordion-button) */
.sim-sidebar .accordion-button {
  background: transparent;
  color: var(--sim-text);
  border: none;
  font-weight: 600;
  font-size: 10px;
  padding: 5px 8px;
  border-radius: 5px;
  margin: 1px 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 10px);
  text-align: left;
  cursor: pointer;
}
.sim-sidebar .accordion-button i {
  font-size: 11px;
  width: 16px;
  text-align: center;
}
.sim-sidebar .accordion-button::after {
  content: "\f078"; /* fa-chevron-down */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: auto;
  font-size: 7px;
  color: var(--sim-text-muted);
  transition: transform 0.2s ease;
}
.sim-sidebar .accordion-button.open {
  background: linear-gradient(135deg, var(--sim-primary) 0%, var(--sim-primary-2) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}
.sim-sidebar .accordion-button.open::after { transform: rotate(180deg); color: #fff; }

/* Child nav-links under an accordion (mirrors .accordion-body .nav-link) */
.sim-sidebar .accordion-body {
  padding: 1px 0 4px;
}
.sim-sidebar .accordion-body .nav-link {
  padding: 3px 8px 3px 30px;
  color: var(--sim-text);
  border-radius: 5px;
  margin: 1px 5px;
  font-size: 9.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  text-decoration: none;
  position: relative;
  line-height: 1.3;
}
.sim-sidebar .accordion-body .nav-link i {
  width: 14px;
  font-size: 9.5px;
  margin-right: 6px;
  color: var(--sim-text-muted);
}
.sim-sidebar .accordion-body .nav-link.active {
  background: linear-gradient(90deg, rgba(0, 123, 255, 0.14) 0%, transparent 100%);
  color: var(--sim-primary);
  font-weight: 600;
  border-left: 3px solid var(--sim-primary);
  padding-left: calc(30px - 3px);
}
.sim-sidebar .accordion-body .nav-link.active i { color: var(--sim-primary); }

/* ---- Main content (mirrors #mainContent / .dashboard-wrapper) ---- */

.sim-main {
  flex: 1;
  padding: 10px 12px;
  overflow: hidden;
  position: relative;
  background: var(--sim-bg);
}

/* ============ Dashboard hero (.dashboard-hero) ============ */

.sim-main .dashboard-hero {
  background: linear-gradient(135deg, var(--sim-bg-deep) 0%, var(--sim-card) 100%);
  border: 1px solid var(--sim-border);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.sim-main .dashboard-hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(0, 123, 255, 0.10) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(30%, -30%);
  pointer-events: none;
}
.sim-main .hero-content {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.sim-main .back-btn {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: var(--sim-bg-deep);
  border: 1px solid var(--sim-border);
  border-radius: 6px;
  color: var(--sim-text);
  font-size: 9px;
  flex: none;
}
.sim-main .hero-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  font-size: 13px;
  color: #fff;
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.35);
  flex: none;
}
.sim-main .hero-title {
  font-size: 13px;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, var(--sim-text) 0%, var(--sim-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.sim-main .hero-subtitle {
  margin: 1px 0 0;
  color: var(--sim-text-muted);
  font-size: 9.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sim-main .hero-actions,
.sim-main .hero-actions-group {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.sim-main .status-badge-group { display: flex; gap: 4px; flex-wrap: wrap; }

/* ============ Status badges (hero) — .status-badge + variants ============ */

.sim-main .status-badge {
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 8.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.sim-main .status-badge i { font-size: 9px; }
.sim-main .status-badge-success { background: rgba(40, 167, 69, 0.15);  color: #4dd07a; border: 1px solid rgba(40, 167, 69, 0.3); }
.sim-main .status-badge-danger  { background: rgba(220, 53, 69, 0.15);  color: #ff7a70; border: 1px solid rgba(220, 53, 69, 0.3); }
.sim-main .status-badge-warning { background: rgba(255, 152, 0, 0.15);  color: #ff9800; border: 1px solid rgba(255, 152, 0, 0.3); }
.sim-main .status-badge-info    { background: rgba(23, 162, 184, 0.15); color: #28b4ce; border: 1px solid rgba(23, 162, 184, 0.3); }

.sim-main .status-badge.pulse {
  animation: sim-pulse 1.4s ease-in-out;
}
@keyframes sim-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(77, 208, 122, 0); }
  40%      { box-shadow: 0 0 0 6px rgba(77, 208, 122, 0.35); }
}

/* ============ Search form (from netdb/main.html) ============ */

.sim-main .search-form-inline { min-width: 180px; }
.sim-main .search-input-wrapper-inline {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--sim-bg-deep);
  border: 1px solid var(--sim-border);
  border-radius: 6px;
  overflow: hidden;
  height: 26px;
  width: 220px;
  max-width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.sim-main .search-input-wrapper-inline.focused {
  border-color: var(--sim-primary);
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.16);
}
.sim-main .search-input-wrapper-inline .search-icon {
  position: absolute;
  left: 8px;
  color: var(--sim-text-muted);
  font-size: 9px;
  pointer-events: none;
}
.sim-main .search-input-wrapper-inline .search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0 6px 0 22px;
  color: var(--sim-text);
  font-size: 10px;
  height: 100%;
  line-height: 26px;
  display: flex;
  align-items: center;
}
.sim-main .search-input-wrapper-inline .search-input .placeholder { color: #5a6678; }
.sim-main .search-input-wrapper-inline .search-input .query::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 10px;
  background: var(--sim-primary);
  margin-left: 1px;
  vertical-align: middle;
  animation: sim-caret 0.9s steps(2) infinite;
}
.sim-main .search-input-wrapper-inline:not(.focused) .search-input .query::after { display: none; }
@keyframes sim-caret {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
.sim-main .search-input-wrapper-inline .btn {
  border: none;
  border-radius: 0;
  padding: 0 10px;
  height: 100%;
  background: var(--sim-primary);
  color: #fff;
  font-size: 9px;
  display: inline-flex;
  align-items: center;
}

/* Inline action buttons (.btn-action) */
.sim-main .btn-action {
  padding: 4px 9px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 9.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.2;
}
.sim-main .btn-action.btn-success { background: var(--sim-success); color: #fff; border-color: var(--sim-success); }
.sim-main .btn-action.btn-warning { background: var(--sim-warning); color: #1a1a1a; border-color: var(--sim-warning); }
.sim-main .btn-action.btn-primary { background: var(--sim-primary); color: #fff; border-color: var(--sim-primary); }

/* Autocomplete (sim-specific — not in real template) */
.sim-main .sim-autocomplete {
  position: absolute;
  top: 28px;
  left: 0;
  width: 100%;
  background: var(--sim-card);
  border: 1px solid var(--sim-border);
  border-radius: 6px;
  padding: 4px 0;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
  z-index: 5;
}
.sim-main .sim-autocomplete.show { opacity: 1; transform: translateY(0); }
.sim-main .sim-autocomplete .ac-item {
  padding: 5px 10px;
  font-size: 9.5px;
  color: var(--sim-text);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.sim-main .sim-autocomplete .ac-item i { color: var(--sim-primary); margin-right: 5px; font-size: 8.5px; }
.sim-main .sim-autocomplete .ac-item .kind { color: var(--sim-text-muted); font-size: 8.5px; font-family: "JetBrains Mono", monospace; }
.sim-main .sim-autocomplete .ac-item.hover { background: rgba(0, 123, 255, 0.12); }

/* ============ Tables (.modern-table / .table) ============ */

.sim-main .table-container {
  background: var(--sim-card);
  border: 1px solid var(--sim-border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 9px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.sim-main .table-header {
  padding: 7px 12px;
  border-bottom: 1px solid var(--sim-border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sim-main .table-title {
  display: flex;
  align-items: center;
  gap: 7px;
}
.sim-main .table-title i {
  color: var(--sim-primary);
  font-size: 11px;
}
.sim-main .table-title h5 {
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--sim-text);
}
.sim-main .table-title p {
  margin: 1px 0 0;
  font-size: 8.5px;
  color: var(--sim-text-muted);
}
.sim-main .table-title .count {
  margin-left: auto;
  font-size: 8.5px;
  color: var(--sim-text-muted);
}
.sim-main .table-wrapper {
  overflow: hidden;
  max-height: 100%;
}
.sim-main .modern-table,
.sim-main table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
  margin: 0;
  color: var(--sim-text);
}
.sim-main .modern-table thead th,
.sim-main table.table thead th {
  text-align: left;
  padding: 6px 8px;
  background: var(--sim-card-2);
  border-bottom: 1px solid var(--sim-border);
  color: var(--sim-text-muted);
  font-weight: 700;
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.sim-main .modern-table tbody td,
.sim-main table.table tbody td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(46, 53, 73, 0.5);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.sim-main table.table tbody tr {
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.25s, transform 0.25s, background 0.15s;
}
.sim-main table.table tbody tr.in { opacity: 1; transform: translateY(0); }
.sim-main table.table tbody tr.hover { background: rgba(0, 123, 255, 0.10); }

.sim-main .mono,
.sim-main .ip-badge {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 9px;
}
.sim-main .ip-badge {
  display: inline-block;
  padding: 2px 6px;
  background: rgba(0, 123, 255, 0.10);
  border: 1px solid rgba(0, 123, 255, 0.25);
  border-radius: 4px;
  color: #4a9fff;
}
.sim-main .ip-badge.ip-badge-v6 {
  background: rgba(23, 162, 184, 0.10);
  border-color: rgba(23, 162, 184, 0.25);
  color: #28b4ce;
}
.sim-main .interface-link {
  color: var(--sim-text);
  text-decoration: none;
  font-weight: 500;
}
.sim-main .interface-link i { color: var(--sim-primary); }
.sim-main .neighbor-text { color: var(--sim-text-muted); font-size: 9px; }

/* Inline status badges in rows (.status-badge-mini) */
.sim-main .status-badge-mini {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.sim-main .status-badge-mini.status-up      { background: rgba(40, 167, 69, 0.18);  color: #4dd07a; }
.sim-main .status-badge-mini.status-down    { background: rgba(220, 53, 69, 0.18);  color: #ff7a70; }
.sim-main .status-badge-mini.status-unknown { background: rgba(142, 150, 167, 0.2); color: var(--sim-text-muted); }
.sim-main .status-badge-mini.status-warn    { background: rgba(255, 193, 7, 0.22); color: #ffc107; }

/* Generic bootstrap-like badge */
.sim-main .badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1.2;
}
.sim-main .badge.bg-success { background: rgba(40, 167, 69, 0.2);  color: #4dd07a; }
.sim-main .badge.bg-danger  { background: rgba(220, 53, 69, 0.2);  color: #ff7a70; }
.sim-main .badge.bg-warning { background: rgba(255, 193, 7, 0.22); color: #ffc107; }
.sim-main .badge.bg-info    { background: rgba(23, 162, 184, 0.22); color: #28b4ce; }
.sim-main .badge.bg-primary { background: rgba(0, 123, 255, 0.2);  color: #4a9fff; }

/* Vendor chip */
.sim-main .vendor-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 8.5px;
  font-weight: 700;
  background: rgba(118, 75, 162, 0.18);
  color: #b48cd8;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ============ Stats tiles (.sim-stats for device detail) ============ */

.sim-main .sim-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 9px;
}
.sim-main .sim-stat {
  background: var(--sim-card);
  border: 1px solid var(--sim-border);
  border-radius: 7px;
  padding: 7px 9px;
  min-width: 0;
}
.sim-main .sim-stat-label {
  font-size: 8px;
  color: var(--sim-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 3px;
  font-weight: 700;
}
.sim-main .sim-stat-value {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sim-main .sim-stat-value .unit {
  font-size: 9px;
  color: var(--sim-text-muted);
  font-weight: 500;
}
.sim-main .sim-stat-value.mono {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
}

/* ============ Interface utilization chart (scene 3) ============ */

.sim-main .controls-card {
  background: var(--sim-card);
  border: 1px solid var(--sim-border);
  border-radius: 10px;
  margin-bottom: 9px;
  padding: 6px 9px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.sim-main .control-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
  flex: 1;
}
.sim-main .control-label {
  font-size: 7.5px;
  font-weight: 700;
  color: var(--sim-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}
.sim-main .control-select {
  padding: 3px 8px;
  background: var(--sim-bg-deep);
  border: 1px solid var(--sim-border);
  border-radius: 5px;
  color: var(--sim-text);
  font-size: 9.5px;
  line-height: 1.3;
  height: 22px;
  display: flex;
  align-items: center;
}
.sim-main .btn-add-chart {
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 600;
  background: var(--sim-primary);
  color: #fff;
  border: 1px solid var(--sim-primary);
  white-space: nowrap;
  height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Chart card — mirrors markup built in netdb/js/new_js.js::run_ajax_graph */
.sim-main .chart-card {
  background: var(--sim-card);
  border: 1px solid var(--sim-border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 9px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sim-main .chart-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--sim-border);
  margin-bottom: 7px;
}
.sim-main .chart-card-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.sim-main .chart-card-title i { color: var(--sim-primary); font-size: 11px; }
.sim-main .chart-card-title h5 {
  margin: 0;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--sim-text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sim-main .chart-card-title p {
  margin: 1px 0 0;
  font-size: 8.5px;
  color: var(--sim-text-muted);
}
.sim-main .chart-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* In/Out/Avg legend toggles (checkbox + dot + label) */
.sim-main .chart-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
}
.sim-main .legend-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 8.5px;
  color: var(--sim-text);
  font-weight: 600;
}
.sim-main .legend-toggle input[type="checkbox"] {
  width: 10px; height: 10px;
  margin: 0;
  accent-color: var(--sim-primary);
  cursor: default;
}
.sim-main .legend-label { display: inline-flex; align-items: center; gap: 4px; cursor: default; margin: 0; }
.sim-main .legend-dot {
  display: inline-block;
  width: 8px; height: 3px;
  border-radius: 2px;
}
/* Series colors match new_js.js: info / danger / warning */
.sim-main .legend-in  .legend-dot { background: #17a2b8; }  /* --info-color */
.sim-main .legend-out .legend-dot { background: #dc3545; }  /* --danger-color */
.sim-main .legend-avg .legend-dot {
  background: repeating-linear-gradient(90deg, #ffc107 0 3px, transparent 3px 5px);
}

.sim-main .chart-time-select {
  height: 22px;
  padding: 0 6px;
  background: var(--sim-bg-deep);
  border: 1px solid var(--sim-border);
  border-radius: 4px;
  color: var(--sim-text);
  font-size: 9px;
  font-weight: 500;
  cursor: default;
  appearance: none;
}

.sim-main .btn-icon {
  width: 22px; height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--sim-border);
  background: var(--sim-bg-deep);
  color: var(--sim-text-muted);
  border-radius: 4px;
  font-size: 9px;
  cursor: default;
}

/* Stats bar (Peak In / Peak Out / Now pills) */
.sim-main .chart-stats-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 0 8px;
  font-size: 9px;
}
.sim-main .stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--sim-bg-deep);
  border: 1px solid var(--sim-border);
  border-radius: 14px;
  color: var(--sim-text-muted);
  font-weight: 600;
}
.sim-main .stat-pill i { font-size: 8px; }
.sim-main .stat-peak-in  i { color: #17a2b8; }
.sim-main .stat-peak-out i { color: #dc3545; }
.sim-main .stat-now      i { color: #ffc107; animation: sim-live-dot 1.4s ease-in-out infinite; }

@keyframes sim-live-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

.sim-main .chart-card-body {
  flex: 1;
  min-height: 130px;
}
.sim-main #sim-chart-apex {
  width: 100%;
  height: 130px;
}

/* ============ Animated cursor ============ */

.sim-cursor {
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  z-index: 10;
  transition: transform 0.85s cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}
.sim-cursor.clicking::after {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--sim-primary);
  opacity: 0;
  animation: sim-click 0.5s ease-out;
}
@keyframes sim-click {
  0%   { transform: scale(0.3); opacity: 0.55; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ============ Guided-tour tooltip ============ */

.sim-tooltip {
  position: absolute;
  background: var(--sim-card);
  border: 1px solid var(--sim-primary);
  border-radius: 6px;
  padding: 8px 11px;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--sim-text);
  max-width: 210px;
  z-index: 20;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 0 3px rgba(0, 123, 255, 0.12);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.22s, transform 0.22s, left 0.55s cubic-bezier(0.65, 0, 0.35, 1), top 0.55s cubic-bezier(0.65, 0, 0.35, 1);
  pointer-events: none;
}
.sim-tooltip.show { opacity: 1; transform: translateY(0); }
.sim-tooltip .tt-title {
  font-weight: 700;
  color: var(--sim-primary);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sim-tooltip .tt-title .tt-num {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--sim-primary);
  color: #fff;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1;
}

/* Arrow */
.sim-tooltip::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--sim-card);
  border: 1px solid var(--sim-primary);
  transform: rotate(45deg);
}
.sim-tooltip[data-arrow="top"]::before    { top: -6px; left: 14px; border-right: none; border-bottom: none; }
.sim-tooltip[data-arrow="left"]::before   { top: 14px; left: -6px; border-top: none;   border-right: none; }
.sim-tooltip[data-arrow="right"]::before  { top: 14px; right: -6px; border-bottom: none; border-left: none; }
.sim-tooltip[data-arrow="bottom"]::before { bottom: -6px; left: 14px; border-top: none; border-left: none; }

/* ============ Expanded modal mode ============ */

.video-modal-body .module-sim {
  min-height: 0;
  height: 100%;
  cursor: default;
}
.video-modal-body .module-sim .sim-hint { display: none; }
.video-modal-body .module-sim .sim-frame { inset: 0; border-radius: 0; border: none; }

/* Scale up navbar + sidebar at modal size */
.video-modal-body .module-sim .sim-titlebar { height: 30px; }
.video-modal-body .module-sim .sim-url { font-size: 12px; }
.video-modal-body .module-sim .sim-navbar { height: 44px; padding: 0 18px; }
.video-modal-body .module-sim .sim-navbar .navbar-brand { font-size: 14px; }
.video-modal-body .module-sim .sim-navbar .navbar-brand i { font-size: 17px; }
.video-modal-body .module-sim .sim-navbar .tenant-dropdown-toggle { font-size: 12px; padding: 6px 14px; }
.video-modal-body .module-sim .sim-navbar .navbar-avatar { width: 28px; height: 28px; font-size: 11px; }

.video-modal-body .module-sim .sim-sidebar { width: 210px; }
.video-modal-body .module-sim .sim-sidebar .sidebar-header { padding: 12px 14px; }
.video-modal-body .module-sim .sim-sidebar .sidebar-header h3 { font-size: 13px; }
.video-modal-body .module-sim .sim-sidebar .sidebar-header p { font-size: 10.5px; }
.video-modal-body .module-sim .sim-sidebar .nav-section-header { font-size: 10px; padding: 10px 14px 4px; }
.video-modal-body .module-sim .sim-sidebar .accordion-button { font-size: 12px; padding: 7px 10px; margin: 2px 6px; gap: 9px; }
.video-modal-body .module-sim .sim-sidebar .accordion-button i { font-size: 13px; width: 18px; }
.video-modal-body .module-sim .sim-sidebar .accordion-button::after { font-size: 9px; }
.video-modal-body .module-sim .sim-sidebar .accordion-body .nav-link { font-size: 11.5px; padding: 5px 10px 5px 38px; }
.video-modal-body .module-sim .sim-sidebar .accordion-body .nav-link.active { padding-left: calc(38px - 3px); }
.video-modal-body .module-sim .sim-sidebar .accordion-body .nav-link i { font-size: 11.5px; width: 16px; margin-right: 8px; }

.video-modal-body .module-sim .sim-main { padding: 16px 18px; }

.video-modal-body .module-sim .dashboard-hero { padding: 14px 18px; margin-bottom: 14px; }
.video-modal-body .module-sim .hero-icon { width: 44px; height: 44px; font-size: 18px; border-radius: 10px; }
.video-modal-body .module-sim .back-btn { width: 32px; height: 32px; font-size: 12px; }
.video-modal-body .module-sim .hero-title { font-size: 20px; }
.video-modal-body .module-sim .hero-subtitle { font-size: 12px; }
.video-modal-body .module-sim .status-badge { font-size: 11px; padding: 4px 10px; }
.video-modal-body .module-sim .status-badge i { font-size: 11px; }

.video-modal-body .module-sim .search-input-wrapper-inline { width: 340px; height: 32px; }
.video-modal-body .module-sim .search-input-wrapper-inline .search-input { font-size: 12.5px; padding-left: 30px; line-height: 32px; }
.video-modal-body .module-sim .search-input-wrapper-inline .search-icon { font-size: 12px; left: 11px; }
.video-modal-body .module-sim .search-input-wrapper-inline .btn { font-size: 12px; padding: 0 14px; }
.video-modal-body .module-sim .sim-autocomplete { top: 36px; }
.video-modal-body .module-sim .sim-autocomplete .ac-item { font-size: 12px; padding: 7px 12px; }
.video-modal-body .module-sim .sim-autocomplete .ac-item .kind { font-size: 10.5px; }
.video-modal-body .module-sim .btn-action { font-size: 11.5px; padding: 6px 12px; }

.video-modal-body .module-sim .table-title h5 { font-size: 13px; }
.video-modal-body .module-sim .table-title p { font-size: 10.5px; }
.video-modal-body .module-sim .table-title .count { font-size: 10.5px; }
.video-modal-body .module-sim .modern-table,
.video-modal-body .module-sim table.table { font-size: 11.5px; }
.video-modal-body .module-sim .modern-table thead th,
.video-modal-body .module-sim table.table thead th { font-size: 10px; padding: 8px 10px; }
.video-modal-body .module-sim .modern-table tbody td,
.video-modal-body .module-sim table.table tbody td { padding: 7px 10px; font-size: 11.5px; max-width: 180px; }
.video-modal-body .module-sim .status-badge-mini { font-size: 10px; padding: 3px 8px; }
.video-modal-body .module-sim .mono,
.video-modal-body .module-sim .ip-badge { font-size: 11px; }
.video-modal-body .module-sim .neighbor-text { font-size: 11px; }

.video-modal-body .module-sim .sim-stats { gap: 12px; margin-bottom: 14px; }
.video-modal-body .module-sim .sim-stat { padding: 12px 14px; border-radius: 9px; }
.video-modal-body .module-sim .sim-stat-label { font-size: 10px; }
.video-modal-body .module-sim .sim-stat-value { font-size: 18px; }
.video-modal-body .module-sim .sim-stat-value .unit { font-size: 11px; }
.video-modal-body .module-sim .sim-stat-value.mono { font-size: 13.5px; }

.video-modal-body .module-sim .controls-card { padding: 10px 14px; gap: 12px; }
.video-modal-body .module-sim .control-label { font-size: 10px; }
.video-modal-body .module-sim .control-select { font-size: 12px; height: 30px; padding: 4px 10px; }
.video-modal-body .module-sim .btn-add-chart { font-size: 12px; height: 30px; padding: 4px 14px; }
.video-modal-body .module-sim .chart-card { padding: 14px 18px; }
.video-modal-body .module-sim .chart-card-title h5 { font-size: 13px; }
.video-modal-body .module-sim .chart-card-title p { font-size: 10.5px; }
.video-modal-body .module-sim .legend-toggle { font-size: 11px; }
.video-modal-body .module-sim .legend-toggle input[type="checkbox"] { width: 12px; height: 12px; }
.video-modal-body .module-sim .legend-dot { width: 10px; height: 4px; }
.video-modal-body .module-sim .chart-time-select { height: 26px; font-size: 10.5px; padding: 0 8px; }
.video-modal-body .module-sim .btn-icon { width: 26px; height: 26px; font-size: 10.5px; }
.video-modal-body .module-sim .stat-pill { font-size: 10.5px; padding: 4px 10px; }
.video-modal-body .module-sim .chart-stats-bar { gap: 8px; padding: 8px 0 10px; }
.video-modal-body .module-sim #sim-chart-apex,
.video-modal-body .module-sim .chart-card-body { height: 240px; min-height: 240px; }

.video-modal-body .module-sim .sim-tooltip { font-size: 12.5px; max-width: 300px; padding: 11px 14px; }
.video-modal-body .module-sim .sim-tooltip .tt-title { font-size: 11px; }
.video-modal-body .module-sim .sim-cursor { width: 22px; height: 22px; }

/* ============ Responsive scaling for inline sim cards ============ */
/* The modal-mode sim lives under .video-modal-body, not .module-row, so
   prefixing rules with `.module-row` excludes the modal cleanly. */

/* iPad portrait (single-column module rows) — cards become full-width.
   Module rows already stack at 1024px via landing.html, so the sim is roomy. */

/* Phone (≤768px): card narrows. Shrink the sidebar so main content has room. */
@media (max-width: 768px) {
  .module-row .module-sim .sim-frame { inset: 8px; }
  .module-row .module-sim .sim-titlebar { height: 20px; padding: 0 8px; gap: 5px; }
  .module-row .module-sim .sim-titlebar .dot { width: 7px; height: 7px; }
  .module-row .module-sim .sim-url { margin-left: 8px; font-size: 9px; }
  .module-row .module-sim .sim-navbar { height: 28px; padding: 0 9px; gap: 8px; }
  .module-row .module-sim .sim-sidebar { width: 120px; }
  .module-row .module-sim .sim-sidebar .sidebar-header { padding: 6px 9px; }
  .module-row .module-sim .sim-sidebar .sidebar-header h3 { font-size: 9.5px; }
  .module-row .module-sim .sim-sidebar .sidebar-header p { font-size: 8px; }
  .module-row .module-sim .sim-sidebar .accordion-button { font-size: 9px; padding: 4px 6px; }
  .module-row .module-sim .sim-sidebar .accordion-button i { font-size: 9.5px; width: 13px; }
  .module-row .module-sim .sim-sidebar .accordion-body .nav-link { font-size: 8.5px; padding: 2px 6px 2px 24px; }
  .module-row .module-sim .sim-main { padding: 8px 9px; }
}

/* Small phone (≤480px): collapse sidebar and shrink fonts so the sim reads as
   a screenshot rather than a useless sliver. */
@media (max-width: 480px) {
  .module-row .module-sim .sim-frame { inset: 6px; border-radius: 6px; }
  .module-row .module-sim .sim-titlebar { height: 16px; padding: 0 6px; gap: 4px; }
  .module-row .module-sim .sim-titlebar .dot { width: 6px; height: 6px; }
  .module-row .module-sim .sim-url { font-size: 8px; margin-left: 6px; }
  .module-row .module-sim .sim-url .lock { display: none; }
  .module-row .module-sim .sim-navbar { height: 24px; padding: 0 7px; gap: 6px; }
  .module-row .module-sim .sim-navbar .navbar-brand { font-size: 9px; }
  .module-row .module-sim .sim-navbar .tenant-dropdown-toggle { font-size: 8px; padding: 2px 6px; }
  .module-row .module-sim .sim-navbar .navbar-avatar { width: 18px; height: 18px; font-size: 8px; }
  .module-row .module-sim .sim-sidebar { width: 88px; }
  .module-row .module-sim .sim-sidebar .sidebar-header { padding: 5px 7px; }
  .module-row .module-sim .sim-sidebar .sidebar-header h3 { font-size: 8.5px; gap: 4px; }
  .module-row .module-sim .sim-sidebar .sidebar-header p { display: none; }
  .module-row .module-sim .sim-sidebar .nav-section-header { font-size: 7px; padding: 5px 7px 2px; }
  .module-row .module-sim .sim-sidebar .accordion-button { font-size: 8px; padding: 3px 5px; gap: 4px; }
  .module-row .module-sim .sim-sidebar .accordion-button i { font-size: 8.5px; width: 11px; }
  .module-row .module-sim .sim-sidebar .accordion-button::after { font-size: 6px; }
  .module-row .module-sim .sim-sidebar .accordion-body .nav-link { font-size: 7.5px; padding: 2px 4px 2px 20px; }
  .module-row .module-sim .sim-sidebar .accordion-body .nav-link i { width: 11px; font-size: 8px; margin-right: 4px; }
  .module-row .module-sim .sim-main { padding: 6px 7px; }
  /* Tooltips and cursor overflow tiny cards — hide them inline; they still
     appear in the expanded modal where there's room. */
  .module-row .module-sim .sim-tooltip,
  .module-row .module-sim .sim-cursor { display: none; }
  /* The "click to expand" hint should always be visible on phones (hover doesn't fire on touch). */
  .module-row .module-sim .sim-hint { opacity: .9; transform: translateY(0); font-size: 8px; padding: 3px 6px; top: 6px; right: 8px; }
}
