.secondary-sidebar {
  width: 220px;
  height: 100vh;
  background: #0d0d1f;
  border-right: 1px solid #1e1e3a;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.75rem;
  gap: 0.75rem;
  overflow: hidden;
  position: relative;
  // Pas de transition sur la largeur : sinon le drag de resize "traîne" derrière la souris.
  // L'animation d'expand/collapse est gérée uniquement par la classe .collapsed ci-dessous.

  &.collapsed {
    width: 44px !important;
    padding: 1.25rem 0.5rem;
    overflow: hidden;
    transition: width 0.25s ease;
  }
}

.resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background 0.15s ease;

  &:hover,
  &:active { background: #6c63ff; }
}

.collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;

  &:hover { color: white; background: #1f2937; }
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: white;
  padding: 0 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

// Variante cliquable : le titre devient un bouton "retour à l'accueil".
.sidebar-title--link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  transition: background 0.15s;

  .sidebar-title-icon {
    flex-shrink: 0;
    color: #a78bfa;
  }

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

  &:hover { background: rgba(255, 255, 255, 0.07); }
  &.active { background: rgba(108, 99, 255, 0.18); }
}

.actions-row {
  display: flex;
  gap: 0.4rem;
}

.btn-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, filter 0.15s;

  &.primary   { background: #6c63ff; color: white; }
  &.primary:hover { background: #5a52e0; }
  &.secondary { background: #2a2a3d; color: #d1d5db; }
  &.secondary:hover { background: #363650; }
}

.tree {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}
.tree-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
// NB : les styles d'une LIGNE d'arbre (tree-row, tree-btn, chevron, dossier, poignée…)
// vivent désormais dans sidebar-tree-node.component.scss (composant récursif).

// En-tête de section (NARRATION / PERSONNAGES / OUTILS) — rendu ici, hors des nœuds.
.tree-section-header {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
  border-top: 1px solid #374151;
  margin-top: 0.35rem;
  padding: 0.6rem 0.5rem 0.3rem;

  &.first { border-top: none; margin-top: 0; padding-top: 0.3rem; }
}

/* --- Bottom panel (ex: Templates) ------------------------------------- */
.bottom-panel {
  border-top: 1px solid #1e1e3a;
  padding-top: 0.5rem;
  margin-top: auto; /* colle en bas de la sidebar flex */
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.panel-header-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.panel-header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: rgba(108, 99, 255, 0.15);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #c7d2fe;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;

  &:hover { background: #6c63ff; color: #ffffff; }
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: #a5b4fc;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;

  &:hover { background: #1f2937; }

  .panel-title { letter-spacing: 0.02em; }
}

.panel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.panel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  color: #d1d5db;
  font-size: 0.82rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;

  &:hover { background: #1f2937; }

  &.action {
    color: #6b7280;
    font-style: italic;
  }
  &.action:hover { color: #a5b4fc; }

  .panel-item-meta {
    font-size: 0.72rem;
    color: #6b7280;
    flex-shrink: 0;
  }
}

// NB : aperçu/placeholder = styles GLOBAUX (src/styles.scss), car l'aperçu CDK est
// déplacé hors du composant. Ici, juste le retour visuel de la drop list RACINE.
.tree-list.cdk-drop-list-receiving { background: rgba(138, 123, 200, 0.08); border-radius: 4px; }
