/* Presentation — ista paleta i ista pravila kao ostali moduli paketa. */

:root {
  --bg: #eef0f4;
  --surface: #ffffff;
  --surface2: #f5f6f9;
  --hover: #e6e9f0;
  --fg: #1b1d24;
  --dim: #6a7080;
  --line: #dfe3ea;
  --line2: #eceff4;
  --accent: #f0a500;          /* žuta — prezentacije, kao na raskrsnici */
  --accent-fg: #23200f;
  --accent-sm: #f0a5002e;
  --danger: #d4453c;
  --paper: #ffffff;
  --deck: #7d8494;
  --shadow: 0 1px 2px #0f172a12, 0 4px 14px #0f172a10;
  --shadow-lg: 0 10px 34px #0f172a24;

  --barh: 44px;
  --edith: 38px;
  --statush: 30px;
  --stripw: 168px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161d; --surface: #1c1e27; --surface2: #23262f; --hover: #2b2f3b;
    --fg: #d7dced; --dim: #858da6; --line: #2c3040; --line2: #242833;
    --accent: #f0b429; --accent-fg: #1d1806; --accent-sm: #f0b42926;
    --danger: #f2707f; --paper: #1e2029; --deck: #0e0f14;
    --shadow: 0 1px 2px #0008, 0 4px 14px #0006; --shadow-lg: 0 12px 38px #000a;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font: 13px/1.45 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  overflow: hidden; user-select: none; -webkit-font-smoothing: antialiased;
}

body {
  display: grid;
  grid-template-rows: var(--barh) var(--edith) 1fr var(--statush);
  height: 100vh;
}
#toolbar   { grid-row: 1; }
#editbar   { grid-row: 2; }
#main      { grid-row: 3; }
#statusbar { grid-row: 4; }

.dim { color: var(--dim); }
.spacer { flex: 1; }
.sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; flex: none; }

#toolbar, #editbar {
  display: flex; align-items: center; gap: 3px; padding: 0 10px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
#toolbar::-webkit-scrollbar, #editbar::-webkit-scrollbar { height: 0; }
#editbar { background: var(--surface2); }

.tb {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; background: transparent; color: var(--fg); text-decoration: none;
  min-width: 30px; height: 28px; padding: 0 9px;
  border-radius: 7px; cursor: pointer; font-size: 12.5px; white-space: nowrap;
  transition: background .12s;
}
.tb:hover { background: var(--hover); }
.tb.on { background: var(--accent-sm); color: var(--fg); box-shadow: inset 0 0 0 1px var(--accent); }
.tb.accent { background: var(--accent); color: var(--accent-fg); font-weight: 650; }
.tb.accent:hover { filter: brightness(1.06); }
.tb.home { font-size: 14px; color: var(--dim); }
.tb.danger { color: var(--danger); }
.tb.mini { height: 22px; font-size: 11.5px; padding: 0 8px; }
.tb[disabled] { opacity: .4; cursor: default; }
.tb[disabled]:hover { background: transparent; }

#fontsize {
  height: 26px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--fg); padding: 0 5px; font-size: 12.5px;
}
#textcolor { width: 34px; height: 26px; padding: 1px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }

/* ── Glavni deo ──────────────────────────────────────────────────────────── */
#main { display: grid; grid-template-columns: var(--stripw) 1fr; min-height: 0; }

#filmstrip {
  grid-column: 1; overflow-y: auto; padding: 10px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.thumb {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: var(--paper); border: 2px solid var(--line2); border-radius: 6px;
  margin-bottom: 10px; cursor: pointer; overflow: hidden;
  box-shadow: var(--shadow);
}
.thumb.on { border-color: var(--accent); }
.thumb canvas { width: 100%; height: 100%; display: block; }
.thumb .no { position: absolute; left: 4px; top: 3px; font-size: 10px; color: var(--dim); }

#stagewrap { grid-column: 2; overflow: auto; background: var(--deck); display: grid; place-items: center; padding: 24px; }

/* Slajd radi u SVOM koordinatnom sistemu (px izračunat iz EMU), a uklapanje u
   prozor ide preko `transform: scale`. Tako položaji oblika ostaju u jednoj
   jedinici, a zum ne dira model. */
#stage { position: relative; transform-origin: center center; }
#slide {
  position: relative; background: var(--paper);
  box-shadow: var(--shadow-lg); overflow: hidden;
}

.shape {
  position: absolute; box-sizing: border-box;
  padding: 4px; overflow: hidden; cursor: move;
  outline: 1px dashed transparent;
}
.shape:hover { outline-color: var(--line); }
.shape.sel { outline: 2px solid var(--accent); outline-offset: 0; }
.shape .txt { width: 100%; height: 100%; outline: none; user-select: text; white-space: pre-wrap; word-wrap: break-word; }
.shape img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.shape p { margin: 0; }

/* Hvatište u donjem desnom uglu za promenu veličine */
.grip {
  position: absolute; right: -5px; bottom: -5px; width: 12px; height: 12px;
  background: var(--accent); border: 2px solid var(--paper); border-radius: 3px;
  cursor: nwse-resize;
}

/* ── Statusbar ───────────────────────────────────────────────────────────── */
#statusbar {
  display: flex; align-items: center; gap: 6px; padding: 0 8px 0 10px;
  background: var(--surface); border-top: 1px solid var(--line);
  font-size: 11.5px; overflow: hidden;
}
#status-pos { margin-left: 8px; }
.group { display: flex; align-items: center; }
.zoomgrp { background: transparent; border: 0; padding: 0; margin: 0; }
.zoomgrp .tb { height: 20px; min-width: 20px; padding: 0 5px; font-size: 12px; border-radius: 5px; }
.zoomgrp .zoomlvl { min-width: 62px; font-size: 11.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.zoomgrp .zoomlvl:hover { color: var(--fg); }

#dropzone {
  position: fixed; inset: 0; z-index: 80; background: #0f172a55; backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.dropcard {
  background: var(--surface); color: var(--fg); border: 2px dashed var(--accent);
  border-radius: 16px; padding: 28px 44px; font-size: 16px; font-weight: 650; box-shadow: var(--shadow-lg);
}
#toast {
  position: fixed; bottom: 50px; left: 50%; transform: translateX(-50%);
  z-index: 90; background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 18px; box-shadow: var(--shadow-lg); max-width: 70vw; font-size: 12.5px;
}

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #8a90a555; border-radius: 7px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #8a90a599; background-clip: padding-box; }

/* ── Štampa = izvoz u PDF: jedan slajd po strani ─────────────────────────── */
@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  body { display: block; }
  #toolbar, #editbar, #filmstrip, #statusbar, #dropzone, #toast { display: none !important; }
  #main { display: block; }
  #stagewrap { overflow: visible; background: #fff; padding: 0; display: block; }
  #stage { transform: none !important; }
  .grip { display: none !important; }
  .shape { outline: none !important; }
  /* Sve strane crta print.js u #printroot; #stage se u štampi ne prikazuje. */
  #stage { display: none; }
  #printroot { display: block !important; }
  #printroot .psheet { page-break-after: always; break-after: page; position: relative; overflow: hidden; background: #fff; }
  #printroot .psheet:last-child { page-break-after: auto; break-after: auto; }
  @page { size: landscape; margin: 0; }
}
#printroot { display: none; }
