/* hprworks.com: estudio do Slide Editor */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.editor-intro h1 { margin-bottom: 0.5rem; }
.editor-intro .lead { margin-bottom: 1.25rem; }
.ed-wrap { max-width: 100rem; padding-inline: clamp(0.5rem, 2vw, 1.5rem); }
.editor-notes { margin-top: 3rem; }

.ed { background: var(--white); border: 1px solid var(--line-strong); border-radius: 8px; overflow: clip; }
.ed-nojs { padding: 1.5rem; }

/* Barra do topo: fica fixa e guarda o botao Apresentar */
.ed-top { position: sticky; top: 0; z-index: 30; background: var(--emerald-ink); color: #fff; padding: 0.6rem 0.9rem 0.4rem; }
.ed-top-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 1.1rem; }
.ed-name { display: grid; gap: 0.15rem; min-width: 11rem; flex: 1 1 11rem; max-width: 20rem; }
.ed-name label { font-size: 0.8rem; color: #C9DDD5; }
.ed-name input { padding: 0.45rem 0.6rem; font: 600 1rem var(--sans); border-radius: 5px; border: 2px solid #5E8C7E; background: #0A3A30; color: #fff; }
.ed-actions { display: flex; gap: 0.35rem; }
.ed-top button:not(.btn), .ed-strip button, .panel-buttons button, .fmt button {
  font: 600 0.88rem/1.15 var(--sans); padding: 0.45rem 0.7rem; border-radius: 5px; cursor: pointer;
  border: 2px solid #5E8C7E; background: transparent; color: #fff;
}
.ed-top button:not(.btn):hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }
.ed-top button:disabled, .ed-strip button:disabled, .panel-buttons button:disabled, .fmt button:disabled { opacity: 0.45; cursor: not-allowed; }
.ed-present { margin-left: auto; padding: 0.6rem 1.7rem; font-size: 1.05rem; }
.ed-status, .ed-alert { margin: 0.35rem 0 0; font-size: 0.9rem; min-height: 1.3em; }
.ed-status { color: #D8E8E1; }
.ed-alert { color: #FFD0C7; font-weight: 700; margin-top: 0; min-height: 0; }
.ed-alert:empty { display: none; }

.ed-body { display: grid; grid-template-columns: 12rem minmax(0, 1fr) 18rem; align-items: start; background: #EAF0EC; }

/* Miniaturas */
.ed-strip { position: sticky; top: 5.6rem; max-height: calc(100vh - 6rem); overflow-y: auto; background: #DCE6E1; padding: 0.6rem; }
.strip-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem; margin-bottom: 0.7rem; }
.ed-strip button { color: var(--graphite); border-color: #7C948B; background: var(--white); }
.ed-strip button:hover:not(:disabled) { background: var(--emerald-tint); }
.strip-tools button:first-child { grid-column: 1 / -1; background: var(--emerald); border-color: var(--emerald); color: #fff; }
.strip-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.strip-item { position: relative; border-radius: 7px; cursor: grab; }
.strip-item.dragging { opacity: 0.4; }
.strip-item.drop-before { box-shadow: 0 -4px 0 var(--emerald); }
.strip-item.drop-after { box-shadow: 0 4px 0 var(--emerald); }
/* O botao e vazio e fica por cima do desenho: so o teclado e os leitores de tela passam por ele */
.ed-strip .thumb-btn { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 7px; background: transparent; pointer-events: none; }
.ed-strip .thumb-btn:hover:not(:disabled) { background: transparent; }
.thumb-card { position: relative; display: block; padding: 4px; border: 3px solid transparent; border-radius: 7px; }
.strip-item:hover .thumb-card { background: rgba(11, 93, 75, 0.1); }
.thumb-btn[aria-current="true"] + .thumb-card { border-color: var(--emerald); background: var(--emerald-tint); }
.thumb-card .slide-frame { outline: 1px solid var(--line-strong); }
.thumb-num { position: absolute; left: 0; top: 0; min-width: 1.4rem; padding: 0.05rem 0.35rem; background: var(--coral); color: var(--graphite); font: 700 0.78rem/1.3 var(--sans); border-radius: 6px 0 6px 0; text-align: center; }

/* Palco */
.ed-stage { padding: 1rem 1.25rem 1.5rem; min-width: 0; }
.fmt { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.75rem; }
.fmt button { color: var(--graphite); background: var(--white); border-color: #7C948B; min-width: 2.4rem; }
.fmt button[aria-pressed="true"] { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.fmt-hint { font-size: 0.88rem; color: var(--ink-2); margin-left: 0.4rem; }
.canvas-wrap { max-width: 64rem; }
#canvas { box-shadow: 0 10px 30px -14px rgba(5, 43, 35, 0.6); outline: 1px solid var(--line-strong); }
.over-note { color: #9B1C1C; font-weight: 600; font-size: 0.93rem; min-height: 1.4em; margin: 0.5rem 0 0; }
.notes { margin-top: 0.75rem; max-width: 64rem; }
.notes label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.notes textarea { width: 100%; padding: 0.7rem 0.85rem; font: 400 1rem/1.5 var(--sans); border: 2px solid var(--line-strong); border-radius: 6px; resize: vertical; background: var(--white); color: var(--graphite); }
.notes-help { font-size: 0.88rem; color: var(--ink-3); margin: 0.35rem 0 0; }

/* Painel de estilo */
.ed-panel { padding: 1rem; background: var(--white); border-left: 1px solid var(--line); min-height: 100%; }
.ed-panel fieldset { border: 0; margin: 0 0 1.35rem; padding: 0; }
.ed-panel legend, .panel-block h2 { font: 700 0.98rem/1.3 var(--sans); color: var(--graphite); margin: 0 0 0.55rem; padding: 0; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.opt-list { display: grid; gap: 0.45rem; }
.opt { position: relative; display: block; }
.opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.opt-body { display: grid; gap: 0.35rem; padding: 0.45rem; border: 2px solid var(--line-strong); border-radius: 7px; background: var(--white); height: 100%; }
.opt-list .opt-body { grid-template-columns: 4.2rem 1fr; align-items: center; }
.opt:hover .opt-body { border-color: var(--emerald); }
.opt input:checked + .opt-body { border-color: var(--emerald); box-shadow: inset 0 0 0 2px var(--emerald); background: var(--emerald-tint); }
.opt input:focus-visible + .opt-body { outline: 3px solid var(--graphite); outline-offset: 2px; }
.opt-text { display: grid; }
.opt-name { font-weight: 600; font-size: 0.9rem; line-height: 1.2; }
.opt-hint { font-size: 0.78rem; color: var(--ink-3); line-height: 1.25; }
.opt-grid .thumb { width: 100%; }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); height: 1.9rem; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
.swatches i { display: block; }
.seg-row { display: grid; grid-template-columns: repeat(3, 1fr); }
.seg { position: relative; display: block; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.seg span { display: block; text-align: center; padding: 0.5rem 0.25rem; border: 2px solid var(--line-strong); font-weight: 600; font-size: 0.9rem; background: var(--white); margin-left: -2px; }
.seg:first-child span { border-radius: 6px 0 0 6px; margin-left: 0; }
.seg:last-child span { border-radius: 0 6px 6px 0; }
.seg input:checked + span { background: var(--emerald); border-color: var(--emerald); color: #fff; position: relative; z-index: 1; }
.seg input:focus-visible + span { outline: 3px solid var(--graphite); outline-offset: 2px; z-index: 2; position: relative; }
.panel-note { font-size: 0.86rem; color: var(--ink-2); margin: 0.6rem 0 0; line-height: 1.45; }
.panel-block { margin-bottom: 1.35rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.panel-buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.panel-buttons button { color: var(--graphite); background: var(--white); border-color: #7C948B; }
.panel-buttons button:hover:not(:disabled) { background: var(--emerald-tint); }

/* Layouts desenhados nas opcoes (o layout "title" so existe aqui) */
.thumb[data-layout="title"] { background: var(--emerald); border-color: var(--emerald); }
.thumb[data-layout="title"] i:nth-child(1) { left: 12%; top: 24%; width: 12%; height: 6%; background: var(--coral); }
.thumb[data-layout="title"] i:nth-child(2) { left: 12%; top: 40%; width: 62%; height: 16%; background: var(--ivory); }
.thumb[data-layout="title"] i:nth-child(3) { left: 12%; top: 66%; width: 38%; height: 7%; background: var(--ivory); opacity: 0.7; }

/* Dialogos */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(62rem, 94vw); max-height: 92vh; color: var(--graphite); background: var(--white); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6); }
dialog::backdrop { background: rgba(5, 43, 35, 0.72); }
#alt-dialog, #confirm { width: min(34rem, 94vw); }
.dlg { padding: 1.5rem; display: grid; gap: 1rem; }
.dlg h2 { font-size: 1.6rem; }
.dlg p { margin: 0; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin-top: 0.25rem; }
.tpl { display: grid; align-content: start; gap: 0.4rem; text-align: left; padding: 0.6rem; border: 2px solid var(--line-strong); border-radius: 8px; background: var(--white); color: var(--graphite); cursor: pointer; font: inherit; }
.tpl:hover { border-color: var(--emerald); background: var(--emerald-tint); }
.tpl-name { font: 400 1.3rem/1.2 var(--serif); color: var(--emerald); }
.tpl-blurb { font-size: 0.92rem; color: var(--ink-2); }
.tpl-blank { place-content: center; min-height: 8rem; border-style: dashed; }
.tpl-more summary { cursor: pointer; font-weight: 600; margin-bottom: 0.75rem; color: var(--emerald); }
.alt-preview { max-width: 100%; height: auto; max-height: 14rem; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; justify-self: start; }
#alt-text { width: 100%; padding: 0.7rem 0.85rem; font: 400 1rem/1.5 var(--sans); border: 2px solid var(--line-strong); border-radius: 6px; }
#alt-text:disabled { background: #EEF1EF; }
.alt-deco label { display: flex; gap: 0.6rem; align-items: flex-start; }
.alt-deco input { margin-top: 0.3rem; width: 1.1rem; height: 1.1rem; }
.field-error { color: #B3261E; font-weight: 600; margin: 0; }
.field-error:empty { display: none; }

/* Modo Apresentar */
.is-presenting { overflow: hidden; }
.present { position: fixed; inset: 0; z-index: 1000; background: #000; color: #fff; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.present:focus { outline: none; }
.present-main { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }
.present-main.with-side { grid-template-columns: minmax(0, 1fr) min(24rem, 34vw); }
.present-stage { display: grid; place-items: center; min-height: 0; min-width: 0; overflow: hidden; cursor: pointer; }
.present-frame { width: min(100%, calc((100vh - 3.6rem) * 16 / 9)); }
.present-side { background: #0F1A22; padding: 1rem 1.1rem; overflow: auto; border-left: 1px solid #2D3B48; display: grid; gap: 1.25rem; align-content: start; }
.side-title { font: 700 0.95rem var(--sans); color: #C9DDD5; margin: 0 0 0.5rem; }
.side-next .slide-frame { max-width: 100%; outline: 1px solid #44566A; }
.side-end { color: #C9DDD5; margin: 0; }
.notes-text { white-space: pre-wrap; font: 400 1.35rem/1.5 var(--sans); color: #fff; }
.present-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; padding: 0.55rem 1rem; background: #0B0F14; font-size: 0.95rem; }
.present-bar button { font: 600 0.9rem var(--sans); padding: 0.4rem 0.9rem; border-radius: 6px; border: 2px solid #fff; background: transparent; color: #fff; cursor: pointer; }
.present-bar button:hover:not(:disabled) { background: #fff; color: #000; }
.present-bar button:disabled { opacity: 0.4; cursor: not-allowed; }
.present-bar button[aria-pressed="true"] { background: var(--coral); border-color: var(--coral); color: var(--graphite); }
.present-pos { min-width: 5rem; text-align: center; }
.present-timer { margin-left: auto; font: 700 1.3rem var(--sans); font-variant-numeric: tabular-nums; }

/* PDF: so existe na impressao */
.print-root { display: none; }
@media print {
  @page { size: 13.333in 7.5in; margin: 0; }
  body.is-printing { background: #fff; margin: 0; }
  body.is-printing > *:not(.print-root) { display: none !important; }
  body.is-printing .print-root { display: block; }
  .print-slide { width: 13.333in !important; height: 7.5in !important; aspect-ratio: auto; break-after: page; page-break-after: always; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none; outline: 0; }
  .print-slide:last-child { break-after: auto; page-break-after: auto; }
}

/* Telas menores */
@media (max-width: 70rem) {
  .ed-body { grid-template-columns: minmax(0, 1fr); }
  .ed-strip { position: static; max-height: none; overflow: visible; }
  .strip-tools { grid-template-columns: repeat(5, auto); justify-content: start; }
  .strip-tools button:first-child { grid-column: auto; }
  .strip-list { display: flex; overflow-x: auto; padding-bottom: 0.4rem; }
  .strip-item { flex: 0 0 9.5rem; }
  .ed-panel { border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 1.5rem; }
  .ed-top { top: 0; }
}
@media (max-width: 40rem) {
  /* Barra do topo compacta: Apresentar primeiro, o resto numa linha que rola para o lado */
  .ed-top { padding: 0.5rem 0.6rem 0.3rem; }
  .ed-top-row { flex-wrap: nowrap; overflow-x: auto; align-items: flex-end; gap: 0.5rem; padding-bottom: 0.35rem; scrollbar-width: thin; }
  .ed-top-row > * { flex: 0 0 auto; }
  .ed-present { order: -1; margin-left: 0; padding: 0.55rem 1.1rem; font-size: 1rem; align-self: flex-end; }
  .ed-name { min-width: 10rem; max-width: none; flex: 0 0 11rem; }
  .ed-status { font-size: 0.82rem; margin-top: 0.15rem; min-height: 1.2em; }
  .ed-actions button { white-space: nowrap; }
  .strip-tools { grid-template-columns: repeat(3, auto); }
}
