// ==========================================================================
// Pages - Gestion des pages
// ==========================================================================

@use '../base/variables' as *;

.admin-pages {
  background: $color-neutral;
  min-height: 100vh;
  
  .actions-cell {
    display: flex;
    gap: 10px;
  }

  tbody tr {
    cursor: move;

    &.dragging {
      opacity: 0.5;
    }
  }

  .drag-handle {
    cursor: grab;
    padding: 0 10px;
    color: $color-primary-lighter;
    user-select: none;

    &:active {
      cursor: grabbing;
    }
  }

  .pages-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .page-group {
    background: $color-light;
    border-radius: 8px;
    overflow: hidden;

    &.dragging {
      opacity: 0.5;
    }
  }

  .page-group__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    &::before {
      content: '▶';
      font-size: 10px;
      color: $color-primary-lighter;
      transition: transform 0.15s ease;
    }
  }

  .page-group[open] > .page-group__header::before {
    transform: rotate(90deg);
  }

  .page-group--flat > .page-group__header {
    cursor: move;

    &::before {
      content: none;
    }
  }

  .page-group__title {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .page-group__slug,
  .page-group__template {
    color: $color-primary-lighter;
    font-size: 0.85em;
  }

  .page-group__header > .drag-handle {
    cursor: grab;
  }

  .page-group__header > * {
    flex-shrink: 0;
  }

  .page-group__title {
    flex: 1;
    flex-shrink: 1;
    min-width: 0;
  }

  table.page-children {
    width: 100%;
    table-layout: fixed;

    tbody tr td:first-child {
      padding-left: 32px;
    }

    td {
      overflow: hidden;
    }
  }

  .text-truncate {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }
}

.admin-page-create {
  background: $color-neutral;
  min-height: 100vh;
}
