@import url("/static/css/design-system.css");
/* ==========================================================================
   NEXGUARD AI — Premium SaaS Enterprise Horizontal Header & Global Layout
   ========================================================================== */

:root {
  --nav-height: 64px;
  --bg-body: #0a0d12;
  --bg-nav: #11151c;
  --bg-card: #161b22;
  --bg-card-hover: #1c222b;
  --border-subtle: #21262d;
  --border-card: #30363d;
  --border-focus: #58a6ff;
  --primary-blue: #58a6ff;
  --primary-blue-hover: #388bfd;
  --primary-blue-glow: rgba(88, 166, 255, 0.12);
  --success-green: #3fb950;
  --success-bg: rgba(63, 185, 80, 0.12);
  --warning-amber: #d29922;
  --warning-bg: rgba(210, 153, 34, 0.12);
  --danger-red: #f85149;
  --danger-bg: rgba(248, 81, 73, 0.12);
  --text-primary: #f0f6fc;
  --text-secondary: #c9d1d9;
  --text-muted: #8b949e;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}


/* ==========================================================================
   APP SHELL (SIDEBAR + TOPBAR + CONTENT)
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-body, #080c14);
}

.app-main-layout {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* ==========================================================================
   NEXGUARD OPERATIONAL SIDEBAR (v0.1.8)
   ========================================================================== */
.nexguard-sidebar {
  width: 250px;
  min-width: 250px;
  background-color: var(--bg-sidebar, #0a0f1a);
  border-right: 1px solid var(--border-subtle, #1a263d);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 1010;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.35);
}

.sidebar-brand-block {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle, #1a263d);
  background: rgba(14, 21, 36, 0.4);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary, #f8fafc);
}

.sidebar-brand-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(2, 132, 199, 0.15);
  border: 1px solid rgba(2, 132, 199, 0.35);
  color: #38bdf8;
  flex-shrink: 0;
}

.sidebar-brand-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-brand-name {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #f8fafc;
}

.sidebar-brand-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background-color: #1e293b;
  color: #38bdf8;
  border: 1px solid #334155;
}

.sidebar-nav-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 10px;
  scrollbar-width: thin;
  scrollbar-color: #1e293b transparent;
}

.sidebar-nav-scroll::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}

.sidebar-group {
  margin-bottom: 14px;
}

.sidebar-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #64748b);
  padding: 4px 10px 6px;
}

.sidebar-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-secondary, #94a3b8);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.sidebar-link:hover {
  background-color: var(--bg-hover, #1c2a45);
  color: var(--text-primary, #f8fafc);
}

.sidebar-link.active {
  background-color: rgba(2, 132, 199, 0.12);
  color: #38bdf8;
  border-left-color: #0284c7;
  font-weight: 600;
}

.sidebar-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke: currentColor;
  opacity: 0.85;
}

.sidebar-link-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer-block {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle, #1a263d);
  background: rgba(10, 15, 26, 0.7);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-footer-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.sidebar-status-text {
  font-size: 0.75rem;
  font-weight: 500;
  color: #94a3b8;
}

.sidebar-footer-brand {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sidebar-footer-app-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
}

.sidebar-footer-version {
  font-size: 0.68rem;
  color: #64748b;
}

body:not(.login-body-wrapper) {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TOP HORIZONTAL NAVBAR (HEADER)
   ========================================================================== */
.nexguard-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-height);
  background-color: var(--bg-nav);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Region Left: Brand, Logo & Version */
.nav-brand-section {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-name {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  line-height: 1.1;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background-color: #21262d;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.brand-subtitle {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.2px;
  white-space: nowrap;
  line-height: 1;
}

/* Region Center: Horizontal Navigation Menu */
.nav-center-menu {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-center-menu::-webkit-scrollbar {
  display: none;
}

.nav-items-list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 3px;
  margin: 0 auto;
  padding: 0;
  flex-shrink: 0;
}

.nav-item-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease-in-out;
  position: relative;
  border-bottom: 2px solid transparent;
}

.nav-item-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-card-hover);
}

.nav-item-link.active {
  color: var(--primary-blue);
  background-color: var(--primary-blue-glow);
  font-weight: 600;
  border-bottom: 2px solid var(--primary-blue);
}

.nav-item-link:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.nav-item-icon {
  font-size: 0.95rem;
  display: inline-flex;
}

/* Region Right: Telemetry, User Badge & Logout */
.nav-right-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
}

/* SSE Telemetry Live Indicator */
.telemetry-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 20px;
  background-color: rgba(22, 27, 34, 0.8);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.telemetry-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success-green);
  box-shadow: 0 0 6px var(--success-green);
  transition: all 0.2s ease;
}

.telemetry-dot.dot-reconnecting {
  background-color: var(--warning-amber);
  box-shadow: 0 0 6px var(--warning-amber);
}

.telemetry-dot.dot-disconnected {
  background-color: var(--danger-red);
  box-shadow: 0 0 6px var(--danger-red);
}

/* Nav Notification Button & Real Count Badge */
.nav-notification-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  color: var(--text-muted);
  background-color: rgba(22, 27, 34, 0.5);
  border: 1px solid var(--border-subtle);
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

.nav-notification-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-card-hover);
  border-color: var(--border-card);
}

.notification-icon {
  width: 17px;
  height: 17px;
}

.notification-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 10px;
  background-color: var(--danger-red);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(248, 81, 73, 0.7);
  border: 1.5px solid var(--bg-nav);
  line-height: 1;
}

/* User Profile Badge */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  border-radius: 8px;
  background-color: rgba(22, 27, 34, 0.5);
  border: 1px solid var(--border-subtle);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f6feb 0%, #1158c7 100%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-display-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Logout Button (POST + CSRF) */
.logout-form {
  display: inline-flex;
  margin: 0;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-card);
  background-color: rgba(22, 27, 34, 0.6);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.btn-logout:hover {
  background-color: rgba(248, 81, 73, 0.15);
  border-color: var(--danger-red);
  color: var(--danger-red);
}

.btn-logout:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.logout-icon {
  display: inline-block;
  flex-shrink: 0;
}

/* Main Content Container */
main.content-container {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 16px 24px;
  flex: 1;
  box-sizing: border-box;
}

/* Responsive Media Queries */
@media (max-width: 1600px) {
  .brand-subtitle {
    display: none;
  }
}

@media (max-width: 1440px) {
  .nexguard-navbar {
    padding: 0 16px;
    gap: 10px;
  }
  .telemetry-badge {
    padding: 4px 8px;
    font-size: 0.74rem;
  }
}

@media (max-width: 1280px) {
  .nexguard-navbar {
    padding: 0 14px;
    gap: 8px;
  }
}

@media (max-width: 1024px) {
  .nexguard-navbar {
    padding: 0 12px;
    gap: 8px;
  }
}

@media (max-width: 768px) {
  .nexguard-navbar {
    padding: 8px 12px;
    gap: 8px;
  }
  main.content-container {
    padding: 14px 12px;
  }
}
