/* AI Project Universe V5.3 — SentiScope / Text Sentiment NLP Analysis
   Reliable single-document vertical scrolling on desktop, tablet and mobile. */

html[data-scroll-theme="sentiment-analysis"] {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 100% !important;
  height: auto !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-x: none;
  overscroll-behavior-y: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

html[data-scroll-theme="sentiment-analysis"] body {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  position: relative !important;
  inset: auto !important;
  touch-action: pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

html[data-scroll-theme="sentiment-analysis"] :is(#root,#app,#__next,[data-reactroot]) {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 100dvh !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* The React application originally used one viewport-height shell and an
   internal overflow container. Convert it into normal document flow so the
   browser owns the only vertical scrollbar. */
html[data-scroll-theme="sentiment-analysis"] :is(
  [data-apu-sentiment-shell="true"],
  #root > div,
  #app > div,
  #__next > div
) {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 100dvh !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  align-items: stretch !important;
}

html[data-scroll-theme="sentiment-analysis"] :is(
  [data-apu-sentiment-main="true"],
  #root main,
  #app main,
  #__next main,
  main[role="main"]
) {
  min-width: 0 !important;
  width: auto !important;
  min-height: 100dvh !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  position: relative !important;
  inset: auto !important;
}

html[data-scroll-theme="sentiment-analysis"] :is(
  [data-apu-sentiment-content="true"],
  main > div[class*="overflow-auto"],
  main > div[class*="overflow-y-auto"],
  main > section[class*="overflow-auto"],
  main > section[class*="overflow-y-auto"]
) {
  flex: 0 0 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: calc(100dvh - 3.5rem) !important;
  height: auto !important;
  max-height: none !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  overscroll-behavior: auto !important;
  padding-bottom: max(5rem, env(safe-area-inset-bottom)) !important;
}

/* Keep the desktop navigation visible without creating a second page scroll. */
@media (min-width: 54.001rem) {
  html[data-scroll-theme="sentiment-analysis"] [data-apu-sentiment-sidebar="true"],
  html[data-scroll-theme="sentiment-analysis"] #root > div > aside,
  html[data-scroll-theme="sentiment-analysis"] #app > div > aside {
    position: sticky !important;
    top: 0 !important;
    align-self: flex-start !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }
}

/* Tables and code areas may scroll horizontally, but must never become a
   competing vertical page scroller. */
html[data-scroll-theme="sentiment-analysis"] :is(
  .apu-table-wrap,.table-wrap,.table-responsive,.apu-mobile-table-shell,
  [data-apu-horizontal-scroll="true"]
) {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

html[data-scroll-theme="sentiment-analysis"] :is(dialog,[role="dialog"],.modal-card) {
  max-height: min(88dvh, 760px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

@media (max-width: 54rem) {
  html[data-scroll-theme="sentiment-analysis"],
  html[data-scroll-theme="sentiment-analysis"] body {
    min-height: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
  }

  html[data-scroll-theme="sentiment-analysis"] :is(
    [data-apu-sentiment-shell="true"],#root > div,#app > div,#__next > div
  ) {
    display: block !important;
    min-height: 100dvh !important;
  }

  html[data-scroll-theme="sentiment-analysis"] :is(
    [data-apu-sentiment-sidebar="true"],
    #root > div > aside,
    #app > div > aside
  ) {
    display: none !important;
  }

  html[data-scroll-theme="sentiment-analysis"] :is(
    [data-apu-sentiment-main="true"],#root main,#app main,#__next main
  ) {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* The bundled app's translucent mobile header is replaced by the solid V5
     project bar, avoiding duplicate navigation and blurred content. */
  html[data-scroll-theme="sentiment-analysis"] :is(
    [data-apu-sentiment-main="true"],#root main,#app main,#__next main
  ) > header[class*="md:hidden"] {
    display: none !important;
  }

  html[data-scroll-theme="sentiment-analysis"] :is(
    [data-apu-sentiment-content="true"],
    main > div[class*="overflow-auto"],
    main > div[class*="overflow-y-auto"]
  ) {
    min-height: 0 !important;
    padding: 18px 12px max(5.5rem, env(safe-area-inset-bottom)) !important;
  }

  html[data-scroll-theme="sentiment-analysis"] .apu-v5-mobile-project-bar {
    position: sticky !important;
    top: 0 !important;
  }

  html[data-scroll-theme="sentiment-analysis"] .apu-v5-mobile-nav-drawer {
    position: sticky !important;
    top: 58px !important;
    max-height: calc(100dvh - 58px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  html[data-scroll-theme="sentiment-analysis"] :is(
    .apu-data-studio,.apu-studio-shell,.apu-studio-card,.apu-studio-grid,
    .apu-studio-grid > *,section,article
  ) {
    min-width: 0 !important;
    max-width: 100% !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-scroll-theme="sentiment-analysis"] { scroll-behavior: auto !important; }
}

@media print {
  html[data-scroll-theme="sentiment-analysis"],
  html[data-scroll-theme="sentiment-analysis"] body,
  html[data-scroll-theme="sentiment-analysis"] :is(
    #root,#app,#__next,[data-reactroot],[data-apu-sentiment-shell="true"],
    [data-apu-sentiment-main="true"],[data-apu-sentiment-content="true"]
  ) {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}
