/* Veluma — Shell Styles
 *
 * The application chrome that wraps every authenticated screen:
 * header, sidebar navigation, content area, user menu.
 */

/* ─────────────────────────────────────────────
 * Shell container — full viewport grid
 * ───────────────────────────────────────────── */

.shell {
  display: grid;
  grid-template-rows: var(--layout-header-height) 1fr;
  grid-template-columns: var(--layout-sidebar-width) 1fr;
  grid-template-areas:
    "header header"
    "sidebar content";
  min-height: 100vh;
  background: var(--color-surface-page);
}

/* ─────────────────────────────────────────────
 * Header
 * ───────────────────────────────────────────── */

.shell-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  background: var(--color-surface-card);
  border-bottom: 1px solid var(--color-border-soft);
  z-index: var(--z-sticky);
}

.shell-header-brand {
  display: flex;
  align-items: center;
  height: 100%;
  text-decoration: none;
  padding: var(--space-2) 0;
}

.shell-header-brand-mark {
  height: 156px;
  width: auto;
  display: block;
  transition: opacity var(--duration-fast) var(--easing-default);
}

.shell-header-brand:hover .shell-header-brand-mark {
  opacity: 0.85;
}

.shell-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Header tools — "Lumenasa AI" / "Team Chat".
 * Compact secondary buttons (see components.css .btn .btn-secondary .btn-sm)
 * grouped to the left of the user menu. A ghost/secondary treatment keeps
 * them from competing with primary actions. */
.shell-header-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.shell-header-btn-glyph {
  font-size: 14px;
  line-height: 1;
}

/* User menu trigger */
.shell-user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: background var(--duration-fast) var(--easing-default);
}

.shell-user-menu:hover {
  background: var(--color-brand-anchor-soft);
}

.shell-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-brand-anchor);
  color: var(--color-text-inverse);
  display: grid;
  place-items: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
}

.shell-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.shell-user-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.shell-user-role {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

/* ─────────────────────────────────────────────
 * User menu dropdown (Change password / Sign out)
 * ───────────────────────────────────────────── */

.shell-user {
  position: relative;
}

.shell-user-menu {
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
}

.shell-user-dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 180px;
  background: var(--color-surface-card);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-1);
  z-index: var(--z-dropdown);
}

.shell-user-dropdown[hidden] {
  display: none;
}

.shell-user-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-default);
}

.shell-user-dropdown-item:hover {
  background: var(--color-brand-anchor-soft);
}

/* ─────────────────────────────────────────────
 * Modal (change-password dialog)
 * ───────────────────────────────────────────── */

.shell-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 2, 100, 0.35);
  display: grid;
  place-items: center;
  z-index: var(--z-modal);
  padding: var(--space-6);
}

.shell-modal {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.shell-modal-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.shell-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ─────────────────────────────────────────────
 * Sidebar
 * ───────────────────────────────────────────── */

.shell-sidebar {
  grid-area: sidebar;
  background: var(--color-surface-card);
  border-right: 1px solid var(--color-border-soft);
  padding: var(--space-4) var(--space-2);
  overflow-y: auto;
}

.shell-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.shell-nav-section {
  margin-top: var(--space-6);
}

.shell-nav-section:first-child {
  margin-top: 0;
}

.shell-nav-section-label {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-mono);
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.shell-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all var(--duration-fast) var(--easing-default);
  position: relative;
}

.shell-nav-link:hover {
  background: var(--color-action-primary-soft);
  color: var(--color-action-secondary);
}

/* Active nav (PINK). White label on #E0017F at rest (~4.7:1 AA); rest equals
 * the old hover shade, so the pill no longer darkens on hover. */
.shell-nav-link.is-active {
  background: var(--color-action-primary);
  color: var(--color-on-primary);
  font-weight: var(--font-weight-semibold);
}

.shell-nav-link.is-active:hover {
  background: var(--color-action-primary-hover);
  color: var(--color-text-inverse);
}

.shell-nav-link-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.shell-nav-link-label {
  flex-grow: 1;
}

.shell-nav-link-badge {
  background: var(--color-action-primary);
  color: var(--color-on-primary);
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
}

/* ─────────────────────────────────────────────
 * Content area
 * ───────────────────────────────────────────── */

.shell-content {
  grid-area: content;
  overflow-y: auto;
  padding: var(--space-8);
}

.shell-content-inner {
  max-width: var(--layout-content-max-width);
  margin: 0 auto;
}

/* ─────────────────────────────────────────────
 * Content header — module title and actions
 * ───────────────────────────────────────────── */

.module-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border-soft);
}

.module-header-titles {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.module-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-mono);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.module-title {
  font-family: var(--font-serif);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  font-style: italic;
  color: var(--color-text-primary);
  letter-spacing: var(--letter-spacing-tight);
  line-height: var(--line-height-tight);
}

.module-subtitle {
  font-size: var(--font-size-md);
  color: var(--color-text-secondary);
  margin-top: var(--space-2);
}

.module-header-actions {
  display: flex;
  gap: var(--space-3);
}

/* ─────────────────────────────────────────────
 * Module placeholder — for stub modules
 * ───────────────────────────────────────────── */

.module-placeholder {
  background: var(--color-surface-card);
  border: 1px dashed var(--color-border-medium);
  border-radius: var(--radius-lg);
  padding: var(--space-16) var(--space-8);
  text-align: center;
  margin-top: var(--space-8);
}

.module-placeholder-icon {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.module-placeholder-title {
  font-family: var(--font-serif);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.module-placeholder-text {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* ─────────────────────────────────────────────
 * Loading state
 * ───────────────────────────────────────────── */

.shell-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--color-surface-page);
}

.shell-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border-soft);
  border-top-color: var(--color-brand-primary);
  border-radius: var(--radius-full);
  animation: shell-spin 0.8s linear infinite;
}

@keyframes shell-spin {
  to { transform: rotate(360deg); }
}

/* ─────────────────────────────────────────────
 * Toast — transient, non-blocking notice
 * (Step-2 stub for the header tool buttons)
 * ───────────────────────────────────────────── */

.shell-toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(var(--space-4));
  background: var(--color-brand-anchor);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toast);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--easing-default),
              transform var(--duration-fast) var(--easing-default);
}

.shell-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─────────────────────────────────────────────
 * Responsive — collapse sidebar on small screens
 * ───────────────────────────────────────────── */

@media (max-width: 768px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "content";
  }

  .shell-sidebar {
    display: none;
  }

  .shell-content {
    padding: var(--space-4);
  }

  .shell-user-info {
    display: none;
  }

  /* Collapse the header tools to glyph-only so the header doesn't overflow,
   * consistent with how .shell-user-info is hidden on mobile. */
  .shell-header-btn-label {
    display: none;
  }

  .shell-header-brand-mark {
    height: 132px;
  }
}
