/* <x-detail>: the detail panel, same look as the Bouwplan prototype. */
x-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);

  > .empty-state { flex: 1; display: grid; place-items: center; text-align: center; padding: 40px; }
  .empty-title { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
  .empty-text { color: var(--fg-3); }

  > .main { flex: 1; min-height: 0; display: flex; flex-direction: column; }

  .head { padding: 20px 24px 14px; flex: none; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
  .head .title { font-size: 20px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; text-wrap: balance; }
  .head .sub { color: var(--fg-3); font-size: 14px; }

  .tabs {
    display: flex;
    gap: 4px;
    padding: 0 16px;
    box-shadow: inset 0 -3px 0 var(--tab-base);
    flex: none;
    overflow-x: auto;
    scrollbar-width: none;

    &::-webkit-scrollbar { display: none; }
  }

  .tab {
    height: 46px;
    padding: 0 12px;
    border: 0;
    background: none;
    color: var(--fg-2);
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    flex: none;
    transition: color 0.25s var(--ease);

    &::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; transition: background 0.3s var(--ease); }
    &:hover { color: var(--fg); }
    &:hover::after { background: var(--tab-hover); }
    &.active { color: var(--fg); font-weight: 600; }
    &.active::after { background: var(--accent); }
  }

  .body { flex: 1; overflow-y: auto; margin-top: 16px; padding: 8px 24px 24px; container-type: inline-size; }
  .body.fade { animation: detail-fade 0.35s var(--ease); }

  .foot { flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 24px; border-top: 1px solid var(--line); min-height: 61px; }
  .actions, .confirm { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; align-items: center; }
  .actions[hidden], .confirm[hidden] { display: none; }
  .confirm-text { color: var(--danger); font-weight: 600; font-size: 13.5px; }

  .save-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-3); transition: opacity 0.5s var(--ease); }
  .save-state .ic { width: 16px; height: 16px; }
  .save-state.saving .ic { animation: detail-spin 1s linear infinite; }
  .save-state.saved { color: var(--ok); font-weight: 600; animation: detail-fade 0.35s var(--ease); }
  .save-state.saved .ic { stroke-width: 2.5; }
  .save-state.failed { color: var(--danger); font-weight: 600; }
  .save-state.fading { opacity: 0; }
}

@keyframes detail-fade { from { opacity: 0; } }
@keyframes detail-spin { to { transform: rotate(360deg); } }

/* Mobile: the detail is part of the page scroll, under the sticky list bar */
@media (max-width: 767px) {
  x-detail {
    border-radius: 0;
    border-width: 0;
    overflow: visible;

    .head { padding: 18px 16px 12px; }
    .tabs { padding: 0 6px; }
    .body { overflow: visible; margin-top: 0; padding: 20px 16px 28px; }
    .foot { padding: 12px 16px; }
  }
}
