/* Anotar print — pro editor chrome (Annotely / Snagit pattern)
   left tool rail + top actions + canvas hero
*/

/* Fullscreen workspace */
body.is-fullscreen .fs-workspace.ann-fs,
body.is-fullscreen .fs-workspace:has(#ann-app) {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  padding: 10px 12px 14px !important;
  box-sizing: border-box;
  min-height: min(78vh, 920px);
  background: #e8ecf3 !important;
}

html[data-theme="dark"] body.is-fullscreen .fs-workspace.ann-fs,
html[data-theme="dark"] body.is-fullscreen .fs-workspace:has(#ann-app) {
  background: #0b0e14 !important;
}

/* App shell */
.ann-app {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: min(70vh, 860px);
  height: min(74vh, 900px);
  margin: 0;
  background: #fff;
  color: var(--dica-body, #0f172a);
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid #e4e9f2;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 36px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] .ann-app {
  background: #151922;
  border-color: #2a3140;
  color: #e2e8f0;
}

/* ---- Top bar ---- */
.ann-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  padding: 8px 12px;
  border-bottom: 1px solid #e4e9f2;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
}

html[data-theme="dark"] .ann-topbar {
  border-bottom-color: #2a3140;
}

.ann-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.ann-brand {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fa5b0f;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.ann-brand-text {
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.ann-top-status {
  font-size: 0.8rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(420px, 40vw);
}

.ann-top-status.is-ok {
  color: #86efac;
}
.ann-top-status.is-error {
  color: #fca5a5;
}
.ann-top-status.is-loading {
  color: #fde68a;
}

.ann-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.ann-top-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.ann-top-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.ann-top-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ann-top-btn-primary {
  background: #fa5b0f;
  border-color: #fa5b0f;
  color: #fff;
}

.ann-top-btn-primary:hover:not(:disabled) {
  background: #e04f0a;
  border-color: #e04f0a;
}

.ann-top-btn-ghost {
  border-color: transparent;
  background: transparent;
  color: #94a3b8;
}

/* ---- Body: rail + workspace ---- */
.ann-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

/* Left rail */
.ann-rail {
  display: flex;
  flex-direction: column;
  flex: 0 0 88px;
  width: 88px;
  border-right: 1px solid #e4e9f2;
  background: #f8fafc;
  overflow-y: auto;
  overflow-x: hidden;
}

html[data-theme="dark"] .ann-rail {
  background: #11161f;
  border-right-color: #2a3140;
}

.ann-tools {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 6px;
}

.ann-tool {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 52px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  color: #334155;
  font: inherit;
}

.ann-tool:hover {
  background: #eef2f7;
}

.ann-tool.is-active {
  background: rgba(250, 91, 15, 0.12);
  border-color: rgba(250, 91, 15, 0.45);
  color: #c2410c;
  box-shadow: inset 0 0 0 1px rgba(250, 91, 15, 0.25);
}

.ann-tool-ico {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
}

.ann-tool-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
  text-align: center;
  opacity: 0.9;
}

.ann-tool-step .ann-tool-ico {
  gap: 1px;
}

.ann-step-icon {
  font-size: 0.7rem;
  opacity: 0.65;
}

.ann-step-badge {
  font-size: 0.78rem;
  font-weight: 800;
  min-width: 0.9em;
}

.ann-rail-opts {
  margin-top: auto;
  padding: 10px 8px 12px;
  border-top: 1px solid #e4e9f2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

html[data-theme="dark"] .ann-rail-opts {
  border-top-color: #2a3140;
}

.ann-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.ann-swatch {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.12);
  background: var(--sw, #ccc);
  cursor: pointer;
  padding: 0;
}

.ann-swatch.is-active {
  outline: 2px solid #fa5b0f;
  outline-offset: 1px;
}

.ann-swatch[data-ann-swatch="#ffffff"] {
  box-shadow: inset 0 0 0 1px #cbd5e1;
}

.ann-color-label input {
  width: 36px;
  height: 28px;
  padding: 1px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.ann-size-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-align: center;
}

.ann-size-label input[type="range"] {
  width: 100%;
  accent-color: #fa5b0f;
}

.ann-fill-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  user-select: none;
}

.ann-fill-label input {
  accent-color: #fa5b0f;
}

.ann-rail-btn {
  appearance: none;
  width: 100%;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
}

.ann-rail-btn:hover {
  background: #f1f5f9;
}

html[data-theme="dark"] .ann-tool {
  color: #cbd5e1;
}
html[data-theme="dark"] .ann-tool:hover {
  background: #1e293b;
}
html[data-theme="dark"] .ann-tool.is-active {
  background: rgba(250, 91, 15, 0.18);
  color: #fdba74;
}
html[data-theme="dark"] .ann-rail-btn {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

/* ---- Workspace ---- */
.ann-workspace {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background:
    linear-gradient(45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2f7 75%),
    linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #f1f5f9;
  overflow: auto;
}

html[data-theme="dark"] .ann-workspace {
  background-color: #0f141d;
  background-image:
    linear-gradient(45deg, #151b26 25%, transparent 25%),
    linear-gradient(-45deg, #151b26 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #151b26 75%),
    linear-gradient(-45deg, transparent 75%, #151b26 75%);
}

.ann-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Drop zone */
.ann-drop {
  margin: auto;
  max-width: 420px;
  width: calc(100% - 48px);
  padding: 36px 28px;
  border: 2px dashed #94a3b8;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.ann-drop[hidden] {
  display: none !important;
}

.ann-drop:hover,
.ann-drop.is-dragover {
  border-color: #fa5b0f;
  background: #fff;
}

.ann-drop-icon {
  color: #64748b;
  margin-bottom: 10px;
}

.ann-drop-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.ann-drop-hint {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 16px;
}

.ann-drop-cta {
  appearance: none;
  border: none;
  background: #fa5b0f;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
}

html[data-theme="dark"] .ann-drop {
  background: rgba(21, 25, 34, 0.92);
  border-color: #475569;
}
html[data-theme="dark"] .ann-drop-title {
  color: #f1f5f9;
}

/* Stage */
.ann-stage-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  margin: auto;
  max-width: 100%;
}

.ann-stage-wrap[hidden] {
  display: none !important;
}

.ann-stage-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 960px;
  justify-content: space-between;
}

.ann-stage-bar-btn {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.ann-meta {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
}

.ann-stage {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  line-height: 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.08),
    0 16px 40px rgba(15, 23, 42, 0.14);
  background: #0f172a;
}

.ann-stage[hidden] {
  display: none !important;
}

.ann-app.is-crop .ann-stage {
  box-shadow: 0 0 0 2px #fa5b0f, 0 16px 40px rgba(15, 23, 42, 0.14);
}

.ann-layer {
  display: block;
  max-width: 100%;
  height: auto;
}

.ann-layer.ann-ui {
  position: absolute;
  left: 0;
  top: 0;
  touch-action: none;
}

#ann-base,
#ann-draw {
  position: absolute;
  left: 0;
  top: 0;
}

.ann-stage #ann-ui {
  position: relative;
  z-index: 3;
}
.ann-stage #ann-draw {
  z-index: 2;
}
.ann-stage #ann-base {
  z-index: 1;
}

/* empty state flag */
.ann-app.is-empty .ann-rail {
  opacity: 0.92;
}

/* Mobile: horizontal tool strip on top of workspace */
@media (max-width: 760px) {
  .ann-app {
    height: auto;
    min-height: 70vh;
  }

  .ann-body {
    flex-direction: column;
  }

  .ann-rail {
    flex: 0 0 auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e4e9f2;
    flex-direction: column;
  }

  .ann-tools {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 6px;
  }

  .ann-tool {
    width: 64px;
    min-height: 48px;
  }

  .ann-rail-opts {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0;
    border-top: none;
    padding-top: 0;
  }

  .ann-size-label {
    width: 120px;
  }

  .ann-rail-btn {
    width: auto;
    padding: 6px 10px;
  }

  .ann-top-status {
    display: none;
  }

  .ann-brand-text {
    display: none;
  }
}
