/*
 * Spinner beside a document status while segmentation, translation, or
 * export is still running. The arc stays visible without motion. The
 * Tailwind stylesheet disables animation when the user prefers reduced
 * motion, and this rule does not turn it back on.
 */

.document-pulse {
  box-sizing: border-box;
  display: inline-block;
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid #d4dde5;
  border-top-color: #175cd3;
  border-right-color: #175cd3;
  border-radius: 9999px;
  animation: document-pulse-spin 0.8s linear infinite;
}

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

.member-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4rem;
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--color-line);
  background: var(--color-paper);
  position: sticky;
  top: 0;
  z-index: 25;
}

.member-topbar-title {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: 600;
}

.member-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.member-workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

#menu-laterale {
  display: flex;
  flex-direction: column;
  background: var(--color-paper);
  border-right: 1px solid var(--color-line);
  z-index: 20;
}

.sidebar-head {
  display: flex;
  align-items: center;
  min-height: 4rem;
}

.sidebar-head .sidebar-brand {
  flex: 1;
  min-width: 0;
}

.sidebar-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border: 0;
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
}

a.sidebar-item,
button.sidebar-item {
  cursor: pointer;
  touch-action: manipulation;
}

.sidebar-brand {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-glyph {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

.sidebar-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-ink);
  cursor: pointer;
  touch-action: manipulation;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.sidebar-collapse {
  display: none;
  border-bottom: 1px solid var(--color-line);
}

.sidebar-close {
  display: inline-flex;
  margin-left: auto;
}

.sidebar-account {
  margin-top: auto;
  border-top: 1px solid var(--color-line);
  padding: 0.5rem 0;
}

.sidebar-name,
.sidebar-tenant {
  display: block;
}

.sidebar-name {
  font-weight: 600;
}

.sidebar-tenant {
  color: var(--color-muted);
  font-size: 0.8125rem;
  font-weight: 400;
}

.sidebar-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account .sidebar-label {
  overflow: visible;
  white-space: normal;
}

a.sidebar-item:hover,
button.sidebar-item:hover,
.sidebar-icon-button:hover {
  background: color-mix(in srgb, var(--color-ink) 6%, var(--color-paper));
}

a.sidebar-item:active,
button.sidebar-item:active,
.sidebar-icon-button:active {
  background: color-mix(in srgb, var(--color-ink) 10%, var(--color-paper));
}

a.sidebar-item[aria-current="page"],
a.sidebar-item.is-current {
  background: var(--color-pale);
  font-weight: 600;
}

a.sidebar-item[aria-current="page"]:hover,
a.sidebar-item.is-current:hover {
  background: var(--color-pale);
}

.sidebar-item:focus-visible,
.sidebar-icon-button:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: -2px;
}

.sidebar-tip {
  position: absolute;
  left: calc(100% + 0.5rem);
  top: 50%;
  z-index: 30;
  translate: 0 -50%;
  padding: 0.375rem 0.5rem;
  background: var(--color-ink);
  color: var(--color-paper);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

#sidebar-backdrop {
  display: none;
}

@media (max-width: 1023px) {
  #menu-laterale {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 35;
    width: min(18rem, 86vw);
    transform: translateX(-105%);
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  body[data-drawer="open"] #menu-laterale {
    transform: none;
  }

  body[data-drawer="open"] {
    overflow: hidden;
  }

  body[data-drawer="open"] #sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgb(25 50 76 / 46%);
  }
}

@media (min-width: 1024px) {
  .member-topbar,
  .sidebar-close {
    display: none;
  }

  .member-shell {
    display: grid;
    grid-template-columns: 16rem minmax(0, 1fr);
    align-items: stretch;
    min-height: 100dvh;
    transition: grid-template-columns 180ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  #menu-laterale {
    position: sticky;
    top: 0;
    height: 100dvh;
  }

  .sidebar-collapse {
    display: flex;
  }

  body[data-collapsed="true"] .member-shell {
    grid-template-columns: 4.5rem minmax(0, 1fr);
  }

  body[data-collapsed="true"] #menu-laterale [data-sidebar-label] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  body[data-collapsed="true"] #menu-laterale .sidebar-item {
    justify-content: center;
    padding-inline: 0;
  }

  body[data-collapsed="true"] .sidebar-collapse .sidebar-glyph {
    transform: scaleX(-1);
  }

  body[data-collapsed="true"] #menu-laterale .sidebar-item:hover .sidebar-tip,
  body[data-collapsed="true"] #menu-laterale .sidebar-item:focus-visible .sidebar-tip {
    opacity: 1;
  }
}
