/* ── NAC Hub Layout ─────────────────────── */
/* Sidebar (left) + Main content (center) + Drawer (right) */

:root {
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --drawer-width: 420px;
}

/* ── Left Sidebar ──────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: width 0.2s ease;
  overflow: hidden;
  z-index: 100;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-logo {
  font-size: 16px;
  text-align: center;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: rgba(124, 106, 239, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-item .nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item .nav-badge {
  background: var(--accent);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.sidebar-status .status-dot.offline {
  background: var(--red);
}

.sidebar.collapsed .sidebar-footer {
  padding: 12px 8px;
  text-align: center;
}

.sidebar.collapsed .status-text {
  display: none;
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px;
  margin-top: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.15s;
}

.sidebar-collapse-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

/* ── Main Content Area ─────────────────── */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  transition: margin-right 0.3s ease;
}

.main-wrapper.drawer-open {
  margin-right: var(--drawer-width);
}

.page-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-header h1 {
  font-size: 18px;
  font-weight: 700;
}

.page-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Floating Chat Bubble (FAB) ────────── */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c6aef, #60a5fa);
  box-shadow: 0 4px 20px rgba(124, 106, 239, 0.4);
  color: white;
  border: none;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, right 0.3s;
  animation: fab-pulse 2s ease-in-out infinite;
}

.chat-fab:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 28px rgba(124, 106, 239, 0.6);
}

.chat-fab.active {
  animation: none;
  right: calc(var(--drawer-width) + 24px);
}

.chat-fab svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.chat-fab .unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  background: var(--red);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

.chat-fab .unread-badge.visible {
  display: flex;
}

@keyframes fab-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(124, 106, 239, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(124, 106, 239, 0.7); }
}

/* ── Right Workspace Drawer ────────────── */
.ws-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.ws-drawer-backdrop.visible {
  opacity: 1;
  pointer-events: all;
}

.ws-drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--drawer-width);
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 32px rgba(0, 0, 0, 0.5);
}

.ws-drawer.open {
  transform: translateX(0);
}

/* ── Toast Notifications ───────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  animation: toastIn 0.3s ease, toastOut 0.3s ease forwards;
  animation-delay: 0s, 3s;
  max-width: 360px;
}

.toast.success { background: var(--green); color: #000; }
.toast.error { background: var(--red); color: #000; }
.toast.info { background: var(--blue); color: #000; }
.toast.warning { background: var(--yellow); color: #000; }

/* ── Modal Overlay ─────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
}

.modal h2 { font-size: 18px; margin-bottom: 20px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Modal Box (used by portfolio & other pages) ── */
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: var(--surface2);
  color: var(--text);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

/* ── Responsive ────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .main-wrapper.drawer-open {
    margin-right: 0;
  }

  .ws-drawer {
    width: 100vw;
    border-left: none;
  }

  .chat-fab.active {
    right: 24px;
  }
}
