/* Layout: Sidebar, Navbar, Content Container */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: width var(--transition-base), transform var(--transition-base);
  overflow-y: auto;
  overflow-x: hidden;
  backdrop-filter: blur(12px);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

/* Brand Header */
.sidebar-header {
  height: var(--header-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-cyan);
  color: #fff;
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.1;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Sidebar Nav Menu */
.sidebar-nav {
  padding: 1rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0.75rem 0.75rem 0.35rem;
}

.nav-item {
  display: flex;
  flex-direction: column;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.15), rgba(99, 102, 241, 0.08));
  color: var(--accent-sky);
  border-color: rgba(56, 189, 248, 0.25);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent-sky);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.nav-arrow {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
  opacity: 0.6;
}

.nav-item.open > .nav-link .nav-arrow {
  transform: rotate(90deg);
}

/* Submenu */
.submenu {
  display: none;
  flex-direction: column;
  padding-left: 2rem;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  gap: 0.15rem;
  position: relative;
}

.submenu::before {
  content: '';
  position: absolute;
  left: 1.45rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 1px;
  background: var(--border-subtle);
}

.nav-item.open > .submenu {
  display: flex;
}

.submenu-link {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.815rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.submenu-link:hover {
  color: var(--accent-sky);
  background: var(--bg-hover);
}

.submenu-link.active {
  color: var(--accent-sky);
  font-weight: 600;
  background: var(--status-info-bg);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.noc-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--status-online);
}

.sidebar-version-tag {
  font-size: 0.72rem;
  color: var(--accent-sky);
  font-family: var(--font-mono);
  font-weight: 700;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.22);
  transition: all var(--transition-fast);
  user-select: none;
}

.sidebar-version-tag:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
  border-color: var(--accent-sky);
  transform: translateY(-1px);
}

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

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Main Content Area */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-base);
}

/* Header Navbar */
.top-navbar {
  height: var(--header-height);
  background: var(--bg-navbar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}

.nav-toggle-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

/* Search Bar */
.search-container {
  display: flex;
  align-items: center;
  position: relative;
  width: 320px;
}

.search-input {
  width: 100%;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 1rem 0 2.4rem;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--accent-sky);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-dim);
  width: 15px;
  height: 15px;
  pointer-events: none;
}

/* Top Actions */
.top-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  color: var(--accent-sky);
  border-color: var(--accent-sky);
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-hover);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.68rem;
  color: var(--accent-cyan);
}

/* Breadcrumbs Bar */
.breadcrumb-bar {
  padding: 0.85rem 1.5rem;
  background: rgba(10, 15, 29, 0.3);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.815rem;
  color: var(--text-dim);
}

.breadcrumb-item.active {
  color: var(--text-main);
  font-weight: 600;
}

/* Main Content Area */
.content-area {
  padding: 1.5rem;
  flex: 1;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .search-container {
    width: 200px;
  }
}
