/**
 * Shared sticky action bars for interactive tools (standard shells only).
 * Opaque under fixed .dica-header (~60px). No top radius (prevents see-through text).
 *
 * Full-width / fullscreen IA shells (colorir, remover fundo, upscale, desfocar…):
 *   NO sticky bars — not the dark brand bar, not the stage button row.
 *   Shell grows with content (height:auto / overflow:visible in remover-fundo.css)
 *   so the whole tool, including the brand bar, scrolls with the document.
 */
:root {
  --dica-sticky-top: 60px;
  --dica-sticky-z: 40;
  --dica-sticky-bg: #ffffff;
  --dica-sticky-bg-dark: #151922;
}

/* Full-width IA: never sticky (brand bar or stage actions) */
.rbg-app > .rbg-topbar,
.rbg-app .rbg-stage-bar,
#clr-app > .rbg-topbar,
#clr-app .rbg-stage-bar,
#rbg-app > .rbg-topbar,
#rbg-app .rbg-stage-bar,
#up-app > .rbg-topbar,
#up-app .rbg-stage-bar,
#dfb-app > .rbg-topbar,
#dfb-app .rbg-stage-bar,
#dfr-app > .rbg-topbar,
#dfr-app .rbg-stage-bar {
  position: relative !important;
  top: auto !important;
  z-index: auto !important;
  box-shadow: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* ---- Light surface toolbars (real action buttons) — standard tools only ---- */
.itool-app > .itool-toolbar,
.cpdf-app > .cpdf-toolbar,
.cimg-app > .cimg-toolbar,
.gtool-app > .gtool-toolbar,
.srec-app > .srec-top,
.srec-app > .srec-top.itool-toolbar,
.ytm-app > .ytm-toolbar,
.print-app > .print-toolbar,
.ctx-app > .ctx-toolbar,
.btest-app > .btest-toolbar,
#srec-app > .srec-top,
#epdf-app > .cpdf-toolbar,
#cpdf-app > .cpdf-toolbar,
#cimg-app > .cimg-toolbar {
  position: sticky !important;
  top: var(--dica-sticky-top) !important;
  z-index: var(--dica-sticky-z) !important;
  background-color: var(--dica-sticky-bg) !important;
  background: var(--dica-sticky-bg) !important;
  border-radius: 0 !important;
  box-shadow:
    0 1px 0 #e8ebf0,
    0 8px 18px rgba(15, 23, 42, 0.08) !important;
}

.itool-app > .itool-toolbar::before,
.cpdf-app > .cpdf-toolbar::before,
.cimg-app > .cimg-toolbar::before,
.gtool-app > .gtool-toolbar::before,
.srec-app > .srec-top::before,
#srec-app > .srec-top::before,
#epdf-app > .cpdf-toolbar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -3px;
  height: 3px;
  background-color: var(--dica-sticky-bg);
  pointer-events: none;
  z-index: -1;
}

/* ---- Dark toolbars with real actions (video / media / anotar) ---- */
.mtool-wrap > .mtool-topbar,
.cvid-wrap > .cvid-topbar,
.vspd-wrap > .vspd-topbar,
.ann-app > .ann-topbar,
#ann-app > .ann-topbar {
  position: sticky !important;
  top: var(--dica-sticky-top) !important;
  z-index: var(--dica-sticky-z) !important;
  background-color: #0f172a !important;
  background: #0f172a !important;
  border-radius: 0 !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 18px rgba(0, 0, 0, 0.35) !important;
}

.mtool-wrap > .mtool-topbar::before,
.cvid-wrap > .cvid-topbar::before,
.ann-app > .ann-topbar::before,
#ann-app > .ann-topbar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -3px;
  height: 3px;
  background-color: #0f172a;
  pointer-events: none;
  z-index: -1;
}

/* Sticky needs visible overflow on standard shells only */
.itool-app,
.cpdf-app,
.cimg-app,
.gtool-app,
.srec-app,
.mtool-wrap,
.cvid-wrap,
.ann-app,
#ann-app,
.ytm-app,
.print-app,
#srec-app,
#epdf-app {
  overflow: visible !important;
}

/* Side rails under the bar */
.srec-side,
.cpdf-side,
.itool-side {
  position: relative;
  z-index: 1;
}

/* Success strip under sticky action bar */
.itool-app .itool-success.is-visible,
.cpdf-app .cpdf-success.is-visible,
.cimg-app .itool-success.is-visible,
.mtool-wrap .mtool-success.is-visible,
.zip-success.is-visible {
  top: calc(var(--dica-sticky-top) + 56px) !important;
  z-index: 35 !important;
}

/* Dark theme — light bars */
html[data-theme="dark"] .itool-app > .itool-toolbar,
html[data-theme="dark"] .cpdf-app > .cpdf-toolbar,
html[data-theme="dark"] .cimg-app > .cimg-toolbar,
html[data-theme="dark"] .gtool-app > .gtool-toolbar,
html[data-theme="dark"] .srec-app > .srec-top,
html[data-theme="dark"] #srec-app > .srec-top,
html[data-theme="dark"] #epdf-app > .cpdf-toolbar {
  background-color: var(--dica-sticky-bg-dark) !important;
  background: var(--dica-sticky-bg-dark) !important;
  box-shadow:
    0 1px 0 #2a3140,
    0 8px 18px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .itool-app > .itool-toolbar::before,
html[data-theme="dark"] .cpdf-app > .cpdf-toolbar::before,
html[data-theme="dark"] .srec-app > .srec-top::before,
html[data-theme="dark"] #epdf-app > .cpdf-toolbar::before {
  background-color: var(--dica-sticky-bg-dark);
}

@media (max-width: 820px) {
  .cpdf-app > .cpdf-toolbar,
  .cimg-app > .cimg-toolbar,
  .itool-app > .itool-toolbar,
  #epdf-app > .cpdf-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}
