/* ============================================================
   BW NetOps Platform — Barry-Wehmiller
   Pixel-perfect recreation of client design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ---- CSS Variables (exact match to client's index.css) ---- */
:root {
  --background:        hsl(214, 25%, 95%);
  --foreground:        hsl(213, 53%, 12%);
  --card:              hsl(0, 0%, 100%);
  --card-foreground:   hsl(213, 53%, 12%);
  --muted:             hsl(214, 25%, 92%);
  --muted-fg:          hsl(213, 20%, 45%);
  --border:            hsl(214, 20%, 88%);
  --sidebar-bg:        hsl(213, 53%, 12%);
  --sidebar-fg:        hsl(214, 25%, 75%);
  --sidebar-hover:     hsl(213, 50%, 16%);
  --amber:             hsl(37, 90%, 55%);
  --bw-blue:           hsl(202, 87%, 40%);
  --bw-green:          hsl(153, 68%, 42%);
  --bw-red:            hsl(0, 76%, 57%);
  --bw-purple:         hsl(262, 60%, 55%);
  --radius:            0.625rem;
  --shadow-card:       0 1px 3px 0 rgba(0,0,0,0.06), 0 1px 2px -1px rgba(0,0,0,0.06);
  --shadow-card-hover: 0 4px 12px 0 rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.06);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
svg { display: block; flex-shrink: 0; }

/* ============================================================
   LAYOUT
   ============================================================ */
body { display: flex; height: 100vh; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 260px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 16px;
  flex-shrink: 0;
}

.bw-logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: hsl(213, 53%, 12%);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.bw-logo-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--amber);
  line-height: 1.3;
}

.bw-logo-sub {
  font-size: 11px;
  color: var(--sidebar-fg);
  opacity: 0.7;
}

/* Status */
.sidebar-status {
  padding: 0 20px 16px;
  flex-shrink: 0;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--sidebar-hover);
  border-radius: 6px;
  padding: 8px 12px;
}

.status-pulse-wrap {
  position: relative;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.status-pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--bw-green);
  opacity: 0.75;
  animation: pulseDot 2s ease-in-out infinite;
}

.status-pulse-dot {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--bw-green);
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 0.75; }
  50%       { transform: scale(1.4); opacity: 0; }
}

.status-text {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--bw-green);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-hover) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-hover); border-radius: 2px; }

.nav-section { margin-bottom: 2px; }

.nav-section-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 8px;
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-fg);
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.15s;
}

.nav-section-btn:hover { opacity: 0.8; }

.nav-section-btn .chevron {
  color: var(--sidebar-fg);
  transition: transform 0.2s ease;
}

.nav-section-btn.open .chevron {
  transform: rotate(0deg);
}

.nav-section-btn:not(.open) .chevron {
  transform: rotate(-90deg);
}

.nav-section-items { margin-bottom: 8px; }
.nav-section-items.hidden { display: none; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--sidebar-fg);
  transition: all 0.15s;
  cursor: pointer;
  margin-bottom: 1px;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(244, 162, 35, 0.8);
}

.nav-item.active {
  background: var(--sidebar-hover);
  color: var(--amber);
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--amber);
}

.nav-icon { color: currentColor; opacity: 0.85; }

.nav-badge {
  background: rgba(13, 125, 191, 0.2);
  color: var(--bw-blue);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 20px;
  margin-left: auto;
}

/* Sidebar User */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--sidebar-hover);
  flex-shrink: 0;
}

.user-avatar-wrap {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(244, 162, 35, 0.2);
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: rgba(244, 162, 35, 0.9);
}

.user-role {
  font-size: 11px;
  color: var(--sidebar-fg);
  opacity: 0.6;
}

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: 64px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 60; /* must be above overlay (49) and sidebar (50) */
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;       /* allow children to shrink below natural width */
  overflow: hidden;
}

/* BW logo mark in topbar — shown on mobile only */
.topbar-logo {
  display: none;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
}
.topbar-logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 12px;
  color: hsl(213, 53%, 12%);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.topbar-logo-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--foreground);
  white-space: nowrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--muted-fg);
  min-width: 0;
  overflow: hidden;
}

.bc-root { color: var(--muted-fg); white-space: nowrap; flex-shrink: 0; }
.bc-current {
  color: var(--foreground);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header-tabs {
  display: flex;
  align-items: center;
  background: var(--muted);
  border-radius: 8px;
  padding: 3px;
  gap: 1px;
}

.tab-btn {
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted-fg);
  transition: all 0.15s;
}

.tab-btn:hover { color: var(--foreground); }

.tab-btn.active {
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;   /* never shrink — always visible */
}

.sync-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--foreground);
  transition: background 0.15s;
}

.sync-btn:hover { background: var(--muted); }

.notif-btn {
  position: relative;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--muted-fg);
  transition: color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-btn:hover { color: var(--foreground); }

.notif-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bw-red);
}

/* ============================================================
   DASHBOARD VIEW
   ============================================================ */
.dashboard-view {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dashboard-view.hidden { display: none; }

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.content-scroll::-webkit-scrollbar { width: 6px; }
.content-scroll::-webkit-scrollbar-track { background: transparent; }
.content-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Hero Banner */
.hero-banner {
  border-radius: var(--radius);
  padding: 32px;
  background: linear-gradient(135deg, hsl(213, 53%, 12%) 0%, hsl(213, 50%, 18%) 50%, hsl(202, 87%, 25%) 100%);
}

.hero-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.hero-brand { color: var(--amber); }

.hero-sub {
  font-size: 13px;
  color: var(--sidebar-fg);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  border-bottom: 3px solid transparent;
}

.kpi-green { border-bottom-color: var(--bw-green); }
.kpi-blue  { border-bottom-color: var(--bw-blue); }
.kpi-amber { border-bottom-color: var(--amber); }
.kpi-red   { border-bottom-color: var(--bw-red); }

.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon-green { background: rgba(34, 181, 115, 0.1); color: var(--bw-green); }
.kpi-icon-blue  { background: rgba(13, 125, 191, 0.1); color: var(--bw-blue); }
.kpi-icon-amber { background: rgba(244, 162, 35, 0.1); color: var(--amber); }
.kpi-icon-red   { background: rgba(229, 62, 62, 0.1);  color: var(--bw-red); }

.kpi-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
}

.trend-up   { background: rgba(34, 181, 115, 0.1); color: var(--bw-green); }
.trend-down { background: rgba(244, 162, 35, 0.1); color: var(--amber); }

.kpi-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-fg);
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--muted-fg);
  opacity: 0.6;
  margin-top: 4px;
}

/* Quick Actions */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.quick-action-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  border: none;
  width: 100%;
  transition: box-shadow 0.15s;
  cursor: pointer;
}

.quick-action-card:hover { box-shadow: var(--shadow-card-hover); }

.qa-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qa-amber  { background: rgba(244, 162, 35, 0.1); color: var(--amber); }
.qa-blue   { background: rgba(13, 125, 191, 0.1); color: var(--bw-blue); }
.qa-green  { background: rgba(34, 181, 115, 0.1); color: var(--bw-green); }
.qa-purple { background: rgba(124, 77, 202, 0.1); color: var(--bw-purple); }

.qa-text { flex: 1; min-width: 0; }

.qa-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qa-sub {
  font-size: 11.5px;
  color: var(--muted-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qa-arrow { color: var(--muted-fg); flex-shrink: 0; transition: color 0.15s; }
.quick-action-card:hover .qa-arrow { color: var(--foreground); }

/* Middle Row */
.middle-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

/* Card base */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 16px;
  padding: 20px 20px 0;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title-inline {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--foreground);
}

/* Health Rings */
.health-card { padding-bottom: 20px; }

.rings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 20px 0;
}

.ring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ring-svg { overflow: visible; }

.ring-circle {
  transition: stroke-dashoffset 0.6s ease;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.ring-label {
  font-size: 11.5px;
  color: var(--muted-fg);
  font-weight: 500;
  text-align: center;
}

/* Activity Feed */
.activity-card { padding: 0 0 4px; }

.activity-list { padding: 0 20px; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.act-icon { flex-shrink: 0; margin-top: 2px; }
.act-green { color: var(--bw-green); }
.act-amber { color: var(--amber); }
.act-blue  { color: var(--bw-blue); }

.act-body { flex: 1; min-width: 0; }

.act-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
}

.act-desc {
  font-size: 11.5px;
  color: var(--muted-fg);
  margin-top: 1px;
}

.act-time {
  font-size: 11px;
  color: var(--muted-fg);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Tables */
.table-card { overflow: hidden; }

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  border-bottom: 1px solid var(--border);
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-fg);
  white-space: nowrap;
}

.data-table th:first-child { padding-left: 20px; }
.data-table th:last-child  { padding-right: 20px; }

.data-table tbody tr {
  border-bottom: 1px solid rgba(214, 218, 230, 0.5);
  transition: background 0.1s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(214, 218, 230, 0.3); }

.data-table td {
  padding: 10px 12px;
  vertical-align: middle;
  color: var(--muted-fg);
}

.data-table td:first-child { padding-left: 20px; }
.data-table td:last-child  { padding-right: 20px; }

.device-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-icon { color: var(--muted-fg); }

.device-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground);
}

.device-ip {
  font-size: 11.5px;
  color: var(--muted-fg);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.td-muted  { color: var(--muted-fg); }
.td-mono   { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; }
.td-semibold { font-weight: 500; color: var(--foreground); }

/* Status badges */
.status-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-green { background: rgba(34, 181, 115, 0.1); color: var(--bw-green); }
.badge-amber { background: rgba(244, 162, 35, 0.1); color: var(--amber); }
.badge-blue  { background: rgba(13, 125, 191, 0.1); color: var(--bw-blue); }
.badge-red   { background: rgba(229, 62, 62, 0.1);  color: var(--bw-red); }

/* Compliance bar */
.compliance-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bar-wrap {
  width: 72px;
  height: 6px;
  background: var(--muted);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 3px;
}

.bar-green { background: var(--bw-green); }
.bar-amber { background: var(--amber); }
.bar-red   { background: var(--bw-red); }

.bar-pct {
  font-size: 11.5px;
  color: var(--muted-fg);
}

/* Job status */
.job-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
}

.status-success  { color: var(--bw-green); }
.status-pending  { color: var(--amber); }
.status-scheduled { color: var(--bw-blue); }

/* Integrations */
.integrations-section {}

.section-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 16px;
}

.integrations-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.integration-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.int-emoji {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.int-body { flex: 1; min-width: 0; }

.int-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.int-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
}

.int-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green { background: var(--bw-green); }
.dot-grey  { background: rgba(90, 110, 140, 0.4); }
.dot-amber { background: var(--amber); }

.int-desc {
  font-size: 11.5px;
  color: var(--muted-fg);
}

.int-status {
  font-size: 10.5px;
  color: var(--muted-fg);
  opacity: 0.6;
  margin-top: 4px;
}

/* ============================================================
   NAUTOBOT IFRAME VIEW
   ============================================================ */
.nautobot-view {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.nautobot-view.hidden { display: none; }

.frame-loader-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--amber), var(--bw-blue), var(--amber));
  background-size: 200% 100%;
  animation: loaderBar 1.5s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.2s;
}

.frame-loader-bar.loading {
  opacity: 1;
}

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

.nautobot-iframe {
  flex: 1;
  width: 100%;
  border: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nautobot-iframe.loaded { opacity: 1; }

/* ============================================================
   SCROLLBAR (global)
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 3px; }

/* ============================================================
   HAMBURGER BUTTON — hidden on desktop, shown on mobile
   ============================================================ */
.hamburger-btn {
  display: none;           /* desktop: hidden */
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted-fg);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 1;              /* inside topbar which is z-index:60 */
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.hamburger-btn:hover,
.hamburger-btn:active {
  background: var(--muted);
  color: var(--foreground);
}

/* ============================================================
   MOBILE OVERLAY — dimmer behind the sidebar drawer
   ============================================================ */
.mobile-overlay {
  display: none;            /* desktop: not in layout */
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 49;              /* below sidebar (50) and topbar (60) */
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
}
.mobile-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ---- Tablet (≤ 1200px) ---- */
@media (max-width: 1200px) {
  .kpi-grid          { grid-template-columns: repeat(2, 1fr); }
  .quick-actions-grid { grid-template-columns: repeat(2, 1fr); }
  .integrations-grid  { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Mobile / Tablet (≤ 900px): sidebar becomes a drawer ---- */
@media (max-width: 900px) {
  /* Topbar: fixed so sidebar can anchor below it cleanly */
  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding: 0 14px;
    z-index: 60;
  }

  /* Push main content down to clear the fixed topbar */
  .main-wrapper {
    margin-left: 0;
    width: 100%;
    padding-top: 60px;   /* same as topbar height */
  }

  /* Sidebar drawer: starts BELOW the topbar, no logo overlap */
  .sidebar {
    top: 60px;                        /* below fixed topbar */
    height: calc(100vh - 60px);       /* fill remaining height */
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 6px 0 32px rgba(0, 0, 0, 0.3);
  }

  /* Hide the sidebar's own logo section — topbar carries BW branding */
  .sidebar-logo { display: none; }

  /* Overlay: dims only content area below topbar */
  .mobile-overlay {
    display: block;
    top: 60px;
    height: calc(100vh - 60px);
    inset: auto;              /* reset inset shorthand */
    left: 0;
    right: 0;
    bottom: 0;
  }

  /* Show hamburger + BW topbar logo */
  .hamburger-btn  { display: flex; }
  .topbar-logo    { display: flex; }

  /* Hide desktop-only topbar items */
  .breadcrumb  { display: none; }
  .header-tabs { display: none; }
  .topbar-left { gap: 10px; }

  /* Health / Activity stacked vertically */
  .middle-row { grid-template-columns: 1fr; }
}

/* ---- Small mobile (≤ 640px) ---- */
@media (max-width: 640px) {
  /* All grids become single column */
  .kpi-grid           { grid-template-columns: 1fr 1fr; }
  .quick-actions-grid { grid-template-columns: 1fr 1fr; }
  .integrations-grid  { grid-template-columns: 1fr; }

  /* Hide tabs to save topbar space */
  .header-tabs { display: none; }

  /* Content padding */
  .content-scroll { padding: 12px; gap: 12px; }

  /* Hero banner tighter */
  .hero-banner { padding: 20px 16px; }
  .hero-title  { font-size: 17px; }

  /* KPI cards smaller */
  .kpi-value { font-size: 24px; }
  .kpi-card  { padding: 14px; }

  /* Quick action cards: icon + title only */
  .qa-sub   { display: none; }
  .qa-arrow { display: none; }

  /* Tables: force horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 560px; }

  /* Sync button: icon only on small screens */
  .sync-btn-label { display: none; }
  .sync-btn { padding: 8px 10px; gap: 0; }
}

/* ---- Extra small (≤ 420px) ---- */
@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .quick-actions-grid { grid-template-columns: 1fr; }
  .qa-sub { display: block; }  /* restore subtitle when full width */
  .qa-arrow { display: block; }
  .kpi-card { padding: 12px 14px; }
  .topbar { height: 56px; }
  .main-wrapper { padding-top: 56px; }
  .sidebar { top: 56px; height: calc(100vh - 56px); }
  .mobile-overlay { top: 56px; height: calc(100vh - 56px); }
}

/* ---- Iframe view: always full height on mobile ---- */
@media (max-width: 900px) {
  .nautobot-view { flex: 1; min-height: 0; }
  .nautobot-iframe { height: 100%; }
}

/* ============================================================
   NAUTOBOT IFRAME LOADING OVERLAY
   ============================================================ */
.nb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  z-index: 10;
  transition: opacity 0.35s ease;
}
.nb-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.nb-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  max-width: 340px;
  padding: 40px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
}

/* Spinner: rotating amber arc */
.nb-spinner {
  position: relative;
  width: 56px;
  height: 56px;
}
.nb-spinner svg {
  animation: nb-rotate 1.1s linear infinite;
  transform-origin: 50% 50%;
  display: block;
}
@keyframes nb-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Pulse ring behind spinner */
.nb-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--amber);
  opacity: 0;
  animation: nb-pulse 2s ease-out infinite;
}
.nb-pulse:nth-child(2) { animation-delay: 0.7s; }
@keyframes nb-pulse {
  0%   { transform: scale(0.85); opacity: 0.4; }
  100% { transform: scale(1.4);  opacity: 0; }
}

.nb-overlay-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.01em;
}
.nb-overlay-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

/* Dot-progress indicator */
.nb-dots {
  display: flex;
  gap: 6px;
}
.nb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0.3;
  animation: nb-dot-blink 1.2s ease-in-out infinite;
}
.nb-dot:nth-child(2) { animation-delay: 0.2s; }
.nb-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes nb-dot-blink {
  0%, 80%, 100% { opacity: 0.3; transform: scale(1); }
  40%           { opacity: 1;   transform: scale(1.3); }
}

.nb-retry-btn {
  margin-top: 4px;
  padding: 9px 22px;
  background: var(--amber);
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.nb-retry-btn:hover  { background: hsl(37, 90%, 45%); }
.nb-retry-btn:active { transform: scale(0.97); }
.nb-retry-btn.hidden { display: none; }

/* ---- Touch devices: remove hover flicker ---- */
@media (hover: none) {
  .nav-item:hover      { background: transparent; color: var(--sidebar-fg); }
  .nav-item.active:hover { background: var(--sidebar-hover); color: var(--amber); }
  .data-table tbody tr:hover { background: transparent; }
  .quick-action-card:hover { box-shadow: var(--shadow-card); }
}
