/*
 * LocalPDF Tools — Organize PDF workspace/result alignment layer.
 * Version: 2.5.2a37.6-clean
 *
 * Structural-only rules for Organize PDF workspaces and result cards.
 * This file intentionally avoids paint ownership. Tool-specific CSS remains
 * responsible for colors, surfaces, borders, gradients, and shadows.
 */
.localpdf-organize-workspace-result-aligned,
.localpdf-organize-workspace-result-aligned * {
  box-sizing: border-box;
}

.localpdf-organize-workspace-result-aligned {
  max-width: 100%;
  overflow-x: clip;
}

.localpdf-organize-workspace-result-aligned :where(
  .localpdf-workspace,
  .localpdf-process-shell,
  [class$="-workspace"],
  [class*="-workspace "],
  [class$="-process-shell"],
  [class*="-process-shell "]
):not([hidden]) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.localpdf-organize-workspace-result-aligned :where(
  .localpdf-workspace-toolbar,
  .localpdf-app-toolbar,
  .localpdf-toolbar-output,
  [class$="-workspace-toolbar"],
  [class*="-workspace-toolbar "],
  [class$="-app-toolbar"],
  [class*="-app-toolbar "],
  [class$="-toolbar-shell"],
  [class*="-toolbar-shell "]
):not([hidden]) {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  align-items: stretch;
  gap: clamp(10px, 1.6vw, 16px);
}

.localpdf-organize-workspace-result-aligned :where(
  .localpdf-workspace-actions,
  .localpdf-toolbar-actions,
  [class$="-workspace-actions"],
  [class*="-workspace-actions "],
  [class$="-toolbar-actions"],
  [class*="-toolbar-actions "],
  [class$="-file-actions"],
  [class*="-file-actions "]
):not([hidden]) {
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  gap: clamp(8px, 1.4vw, 12px);
}

.localpdf-organize-workspace-result-aligned :where(
  .localpdf-pages-data-file-list,
  [class$="-pages-grid"],
  [class*="-pages-grid "],
  [class$="-page-grid"],
  [class*="-page-grid "],
  [class$="-readonly-grid"],
  [class*="-readonly-grid "]
):not([hidden]) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  gap: clamp(10px, 1.5vw, 16px);
  overflow-x: clip;
}

.localpdf-organize-workspace-result-aligned :where(
  [class$="-page-card"],
  [class*="-page-card "],
  [class$="-file-card"],
  [class*="-file-card "],
  [class$="-page-item"],
  [class*="-page-item "]
) {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.localpdf-organize-workspace-result-aligned :where(
  .localpdf-output-row,
  .localpdf-output-name-wrap,
  .localpdf-output-summary,
  [class$="-output-settings"],
  [class*="-output-settings "],
  [class$="-output-control"],
  [class*="-output-control "],
  [class$="-output-ready"],
  [class*="-output-ready "]
):not([hidden]) {
  max-width: 100%;
  min-width: 0;
  gap: clamp(8px, 1.4vw, 12px);
  overflow-wrap: anywhere;
}

.localpdf-organize-workspace-result-aligned :where(
  input[type="text"],
  input[type="search"],
  input[type="number"],
  select,
  textarea
) {
  max-width: 100%;
  min-width: 0;
}

.localpdf-organize-workspace-result-aligned :where(
  .localpdf-result,
  .localpdf-result-card,
  [class$="-result"],
  [class*="-result "],
  [class$="-export-result"],
  [class*="-export-result "],
  [class$="-download-area"],
  [class*="-download-area "],
  [class$="-export-ready"],
  [class*="-export-ready "]
):not([hidden]) {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
  overflow-wrap: anywhere;
}

.localpdf-organize-workspace-result-aligned :where(
  [class$="-result-summary"],
  [class*="-result-summary "],
  [class$="-result-filename"],
  [class*="-result-filename "],
  [class$="-export-summary"],
  [class*="-export-summary "],
  [class$="-export-filename"],
  [class*="-export-filename "]
):not([hidden]) {
  max-width: 100%;
  min-width: 0;
  gap: clamp(8px, 1.4vw, 12px);
  overflow-wrap: anywhere;
}

.localpdf-organize-workspace-result-aligned :where(
  [class$="-download"],
  [class*="-download "],
  [class$="-export"],
  [class*="-export "],
  [class$="-download-link"],
  [class*="-download-link "],
  button,
  a
) {
  max-width: 100%;
}

.localpdf-organize-workspace-result-aligned :where(
  [class$="-download-filename"],
  [class*="-download-filename "],
  [class$="-filename"],
  [class*="-filename "],
  [data-reorder-download-filename],
  [data-delete-download-filename],
  [data-rotate-download-filename],
  [data-extract-download-filename],
  [data-reverse-download-filename],
  [data-insertblank-download-filename],
  [data-duplicate-download-filename],
  [data-insertpdf-download-filename],
  [data-sort-download-filename],
  [data-splitpdf-download-filename]
) {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 760px) {
  .localpdf-organize-workspace-result-aligned :where(
    .localpdf-workspace-toolbar,
    .localpdf-app-toolbar,
    [class$="-workspace-toolbar"],
    [class*="-workspace-toolbar "],
    [class$="-app-toolbar"],
    [class*="-app-toolbar "],
    [class$="-toolbar-shell"],
    [class*="-toolbar-shell "]
  ):not([hidden]) {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .localpdf-organize-workspace-result-aligned :where(
    .localpdf-workspace-actions,
    .localpdf-toolbar-actions,
    [class$="-workspace-actions"],
    [class*="-workspace-actions "],
    [class$="-toolbar-actions"],
    [class*="-toolbar-actions "],
    [class$="-file-actions"],
    [class*="-file-actions "]
  ):not([hidden]) {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .localpdf-organize-workspace-result-aligned :where(
    .localpdf-workspace-actions > *,
    .localpdf-toolbar-actions > *,
    [class$="-workspace-actions"] > *,
    [class*="-workspace-actions "] > *,
    [class$="-toolbar-actions"] > *,
    [class*="-toolbar-actions "] > *,
    [class$="-file-actions"] > *,
    [class*="-file-actions "] > *
  ) {
    width: 100%;
    min-width: 0;
  }

  .localpdf-organize-workspace-result-aligned :where(
    .localpdf-output-row,
    [class$="-output-settings"],
    [class*="-output-settings "]
  ):not([hidden]) {
    display: grid;
    grid-template-columns: 1fr;
  }

  .localpdf-organize-workspace-result-aligned :where(
    [class$="-result-summary"],
    [class*="-result-summary "],
    [class$="-export-summary"],
    [class*="-export-summary "]
  ):not([hidden]) {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .localpdf-organize-workspace-result-aligned :where(
    .localpdf-pages-data-file-list,
    [class$="-pages-grid"],
    [class*="-pages-grid "],
    [class$="-page-grid"],
    [class*="-page-grid "]
  ):not([hidden]) {
    grid-template-columns: 1fr;
  }
}
