/* ==========================================================================
   AURORA GLASS — Dashboard Layout
   Frosted sidebars, fluid grids, and depth-perfect navigation
   ========================================================================== */

.dashboard-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-height));
  width: 100%;
  position: relative;
  isolation: isolate; /* Contain backdrop filters */
}

/* ==========================================================================
   FROSTED GLASS SIDEBAR (Level 2 Glass)
   ========================================================================== */
.dashboard-sidebar {
  width: 280px;
  background: var(--glass-2-bg);
  -webkit-backdrop-filter: var(--glass-2-blur);
  backdrop-filter: var(--glass-2-blur);
  border-right: 1px solid var(--glass-2-border);
  padding: var(--space-xl) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  
  /* Sticky sidebar for desktop */
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
}

/* Custom subtle scrollbar for sidebar */
.dashboard-sidebar::-webkit-scrollbar { width: 4px; }
.dashboard-sidebar::-webkit-scrollbar-thumb { background: var(--glass-2-border); }

/* User Profile Mini-Card (Level 1 Glass) */
.dashboard-sidebar-profile {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--glass-1-bg);
  -webkit-backdrop-filter: var(--glass-1-blur);
  backdrop-filter: var(--glass-1-blur);
  border: 1px solid var(--glass-1-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs), var(--inset-highlight);
}

.dashboard-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--grad-brand);
  color: white;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: var(--glow-brand), var(--inset-highlight-strong);
  position: relative;
  overflow: hidden;
}

.dashboard-avatar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, oklch(1 0 0 / 0.3), transparent 50%);
}

.dashboard-profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dashboard-profile-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-profile-role {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Navigation Groups & Links */
.dashboard-nav-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  list-style: none;
}

.dashboard-nav-heading {
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-md);
  margin-top: var(--space-sm);
}

.dashboard-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--dur-fast) var(--ease-spring);
  position: relative;
  border: 1px solid transparent;
}

.dashboard-nav-link:hover {
  background: var(--glass-bg-hover);
  color: var(--brand-600);
  transform: translateX(3px);
}

.dashboard-nav-link:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
}

.dashboard-nav-link.active {
  background: oklch(0.68 0.17 240 / 0.12);
  color: var(--brand-600);
  font-weight: 700;
  border-color: oklch(0.68 0.17 240 / 0.25);
  box-shadow: var(--shadow-xs), var(--inset-highlight);
  transform: translateX(0); /* Override hover transform */
}

.dashboard-nav-link.active::before {
  content: '';
  position: absolute;
  left: -1px; /* Align with border */
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--brand-500);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  box-shadow: 0 0 8px var(--brand-500);
}

.dashboard-nav-icon {
  font-size: var(--text-md);
  line-height: 1;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

/* ==========================================================================
   DASHBOARD MAIN CONTENT AREA
   ========================================================================== */
.dashboard-main {
  flex: 1;
  padding: var(--space-2xl) var(--space-2xl) var(--space-3xl);
  overflow-y: auto;
  max-width: 1600px; /* Prevent stretching on ultra-wide screens */
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: 1.2;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* ==========================================================================
   RESPONSIVE DASHBOARD LAYOUT
   ========================================================================== */

/* Transform sidebar to horizontal scrollable top bar on Tablet */
@media (max-width: 1024px) {
  .dashboard-layout {
    flex-direction: column;
  }

  .dashboard-sidebar {
    position: sticky;
    top: var(--nav-height);
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--glass-2-border);
    padding: var(--space-md) var(--space-lg);
    gap: var(--space-md);
    overflow-y: visible; /* Disable vertical scroll */
    z-index: var(--z-sticky);
  }

  .dashboard-sidebar-profile {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .dashboard-nav-group {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: var(--space-sm);
    padding-bottom: var(--space-xs);
    scrollbar-width: none;
  }

  .dashboard-nav-group::-webkit-scrollbar {
    display: none;
  }

  .dashboard-nav-heading {
    display: none;
  }

  .dashboard-nav-link {
    flex-shrink: 0;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--text-xs);
  }

  .dashboard-nav-link.active::before {
    /* Switch indicator from left bar to bottom bar for horizontal nav */
    left: 6px;
    right: 6px;
    top: auto;
    bottom: -1px;
    width: auto;
    height: 3px;
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  }

  .dashboard-main {
    padding: var(--space-xl) var(--space-lg) var(--space-2xl);
  }
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .dashboard-main {
    padding: var(--space-lg) var(--space-md) var(--space-xl);
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  /* Hide profile text on very small screens to save space */
  .dashboard-profile-info {
    display: none;
  }
  
  .dashboard-sidebar-profile {
    padding: var(--space-xs);
  }
}