/* ══════════════════════════════════════════
   Presenter – Shared CSS
   ══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent: #4f8ef7;
  --bg-dark: #0d0d14;
  --bg-card: #13131f;
  --border: #252535;
  --text: #e8e8f0;
  --muted: #666680;
}

body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--bg-dark); color: var(--text); }

/* ── Upload Page ── */
#upload-view {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
#upload-view.hidden { display: none; }
/* legacy alias */
.upload-page {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

/* Present view fills screen */
#present-view {
  position: fixed; inset: 0;
  background: #000;
  overflow: hidden;
}
#present-view.hidden { display: none; }

.upload-container {
  width: min(500px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center;
}

.logo { margin-bottom: 4px; }

.upload-container h1 {
  font-size: 1.8rem; font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #4f8ef7 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.subtitle { color: var(--muted); font-size: 0.95rem; }

/* Drop Zone */
.drop-zone {
  width: 100%;
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 32px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop-zone.drag-over { border-color: var(--accent); background: rgba(79,142,247,0.06); }

.drop-icon { margin-bottom: 4px; }
.drop-label { font-size: 0.95rem; color: var(--muted); }
.drop-sub { font-size: 0.8rem; color: #444; }

.file-chosen {
  margin-top: 6px;
  background: rgba(79,142,247,0.12);
  border: 1px solid rgba(79,142,247,0.3);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  color: var(--accent);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Buttons */
.btn {
  padding: 11px 28px;
  border-radius: 9px; border: none; font-size: 0.95rem;
  font-weight: 600; cursor: pointer; transition: opacity .2s, transform .1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: rgba(79,142,247,0.1); }
.btn-start { width: 100%; font-size: 1.05rem; padding: 14px; margin-top: 4px; }
.hidden { display: none !important; }

.note { font-size: 0.75rem; color: #444; }

/* ══════════════════════════════════════════
   Presenter – Presentation Page
   ══════════════════════════════════════════ */
body.present-page {
  overflow: hidden;
  background: #000;
  /* Prevent elastic scroll / address-bar scroll on iOS */
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Material Symbols helper */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
  font-size: 22px;
  line-height: 1;
  user-select: none;
}

#slide-canvas-wrapper {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #000;
}

#slide-canvas {
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Drawing Canvas — buffer dimensions set by JS, display fills viewport */
#draw-canvas {
  position: absolute; inset: 0;
  touch-action: none;
  cursor: crosshair;
  width: 100%;
  height: 100%;
}
#draw-canvas.cursor-eraser { cursor: cell; }
#draw-canvas.cursor-default { cursor: default; }

/* ══ Top-right control bar ══ */
#top-bar {
  position: fixed; top: 14px; right: 14px;
  display: flex; align-items: center; gap: 4px;
  background: rgba(12,12,22,0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50px;
  padding: 6px 10px;
  z-index: 110;
  transition: opacity 0.3s;
}
#top-bar.hide { opacity: 0; pointer-events: none; }

.ctrl-btn {
  width: 36px; height: 36px;
  border-radius: 50%; border: none;
  background: transparent; color: #ccc;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.ctrl-btn:active { background: rgba(255,255,255,0.2); }

#slide-counter {
  font-size: 0.88rem; color: #bbb;
  min-width: 54px; text-align: center;
  font-variant-numeric: tabular-nums;
}

.ctrl-sep {
  width: 1px; height: 22px;
  background: rgba(255,255,255,0.15);
  margin: 0 4px;
}

/* ══ Left drawing toolbox ══ */
#toolbox-toggle {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 111;
  background: rgba(12,12,22,0.55);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.1);
  border-left: none;
  border-radius: 0 8px 8px 0;
  padding: 8px 3px;
  cursor: pointer;
  color: #ccc;
  display: flex; align-items: center; justify-content: center;
  transition: left 0.25s ease, color 0.15s;
}
#toolbox-toggle:hover { color: #fff; }
#toolbox-toggle.open { left: 58px; }
#toolbox-toggle .material-symbols-outlined { font-size: 18px; }

#toolbox {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  background: rgba(12,12,22,0.52);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.1);
  border-left: none;
  border-radius: 0 18px 18px 0;
  padding: 10px 7px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  z-index: 110;
  width: 58px;
  transition: width 0.25s ease, opacity 0.2s ease;
  overflow: visible;
}
#toolbox.collapsed { width: 0; padding: 0; opacity: 0; pointer-events: none; }

.tb-item { position: relative; }

.tool-btn {
  width: 44px; height: 44px;
  border-radius: 11px; border: none;
  background: transparent; color: rgba(220,220,235,0.85);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  position: relative;
}
.tool-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.tool-btn.active {
  background: var(--accent);
  color: #fff;
}
.tool-btn.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Tooltip on hover */
.tool-btn[title]:hover::after,
.ctrl-btn[title]:hover::after {
  content: attr(title);
  position: absolute; left: 54px; top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.88);
  color: #fff; font-size: 0.73rem;
  padding: 4px 9px; border-radius: 6px;
  white-space: nowrap; pointer-events: none;
  z-index: 300;
  font-family: 'Segoe UI', Arial, sans-serif;
}
.ctrl-btn[title]:hover::after {
  left: auto; right: 0; top: 110%;
  transform: none;
}

.tool-sep { width: 34px; height: 1px; background: rgba(255,255,255,0.1); margin: 4px 0; }

/* Colour Picker swatch */
#color-swatch {
  width: 26px; height: 26px;
  border-radius: 50%; border: 2px solid rgba(255,255,255,0.3);
  cursor: pointer; overflow: hidden;
  flex-shrink: 0;
}
#color-swatch input[type="color"] {
  width: 200%; height: 200%; border: none; padding: 0; margin: -50%; cursor: pointer;
}

/* ══ Side popup panels (pen, shape, width) ══ */
.side-popup {
  position: absolute; left: 56px; top: 0;
  background: rgba(12,12,22,0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 12px;
  padding: 10px 12px;
  z-index: 200;
  white-space: nowrap;
  display: flex; flex-direction: column; gap: 6px;
  min-width: 170px;
}
.side-popup.hidden { display: none; }

.pp-label {
  color: rgba(180,180,200,0.8);
  font-size: 0.75rem;
  font-family: 'Segoe UI', Arial, sans-serif;
}
.side-popup input[type="range"] {
  accent-color: var(--accent);
  width: 140px;
  cursor: pointer;
}

/* Pen colour swatches */
#pen-swatches, #hl-swatches {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.pswatch, .hswatch {
  width: 22px; height: 22px;
  border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; transition: border-color 0.15s, transform 0.1s;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.pswatch:hover, .hswatch:hover { transform: scale(1.15); }
.pswatch.active, .hswatch.active { border-color: #fff; }
.pswatch.custom, .hswatch.custom {
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
  position: relative; overflow: hidden;
}
.pswatch.custom input[type="color"],
.hswatch.custom input[type="color"] {
  position: absolute; inset: -4px;
  opacity: 0; cursor: pointer;
  width: 200%; height: 200%;
}

/* Shape sub-menu */
#shape-menu {
  flex-direction: column; gap: 2px;
  min-width: 52px; padding: 6px;
}
.shape-sep { height: 1px; background: rgba(255,255,255,0.1); margin: 2px 0; width: 100%; }
.shape-opt {
  width: 40px; height: 40px;
  border-radius: 9px; border: none;
  background: transparent; color: rgba(200,200,220,0.85); font-size: 1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.shape-opt:hover { background: rgba(255,255,255,0.1); color: #fff; }
.shape-opt.active { background: rgba(79,142,247,0.28); color: var(--accent); }
.shape-opt .material-symbols-outlined { font-size: 20px; }

/* Loading overlay */
#loading-overlay {
  position: fixed; inset: 0;
  background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; z-index: 500;
}
#loading-overlay.hidden { display: none; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-msg { color: #aaa; font-size: 0.95rem; }

/* ══ Slide Thumbnail Panel ══ */
#thumb-panel {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12,12,22,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 92vw;
  z-index: 120;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
#thumb-panel::-webkit-scrollbar        { height: 4px; }
#thumb-panel::-webkit-scrollbar-track  { background: transparent; }
#thumb-panel::-webkit-scrollbar-thumb  { background: rgba(255,255,255,0.2); border-radius: 2px; }
#thumb-panel.hidden { display: none; }

.thumb-item {
  flex-shrink: 0;
  border: none;
  background: transparent;
  padding: 5px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: background 0.15s;
}
.thumb-item:hover  { background: rgba(255,255,255,0.08); }
.thumb-item.active { background: rgba(79,142,247,0.15); }

.thumb-item img {
  width: 160px;
  height: 90px;
  object-fit: contain;
  border-radius: 5px;
  border: 2px solid transparent;
  display: block;
  background: #111;
}
.thumb-item.active img { border-color: var(--accent); }

.thumb-num {
  font-size: 0.72rem;
  color: rgba(180,180,200,0.7);
  font-variant-numeric: tabular-nums;
  font-family: 'Segoe UI', Arial, sans-serif;
}
.thumb-item.active .thumb-num { color: var(--accent); }

/* Selection overlay canvas */
#sel-canvas {
  position: absolute; inset: 0;
  touch-action: none;
  pointer-events: none; /* pass-through by default; JS toggles to auto when area-select active */
  width: 100%; height: 100%;
  z-index: 5;
}

/* Selection action toolbar */
#sel-toolbar {
  position: fixed;
  top: 66px; left: 50%;
  transform: translateX(-50%);
  background: rgba(12,12,22,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50px;
  padding: 5px 10px;
  display: flex; align-items: center; gap: 4px;
  z-index: 115;
}
#sel-toolbar.hidden { display: none; }

.sel-btn {
  width: 36px; height: 36px;
  border-radius: 50%; border: none;
  background: transparent; color: #ccc;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.sel-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
#sel-delete:hover { color: #ff5555; }

/* Draw canvas sits above slide canvas */
#draw-canvas  { z-index: 4; }

/* ══ Line Style Popup ══ */
#line-style-popup {
  min-width: 110px;
  gap: 2px;
}

.linestyle-opt {
  width: 100%;
  padding: 5px 8px;
  border-radius: 7px; border: none;
  background: transparent; color: rgba(200,200,220,0.85);
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.linestyle-opt:hover { background: rgba(255,255,255,0.1); color: #fff; }
.linestyle-opt.active { background: rgba(79,142,247,0.28); color: var(--accent); }
.linestyle-opt svg { flex-shrink: 0; }
.linestyle-opt span {
  font-size: 0.75rem;
  font-family: 'Segoe UI', Arial, sans-serif;
}

/* ══════════════════════════════════════════
   Presenter – HOME PAGE
   ══════════════════════════════════════════ */
body.home-page {
  min-height: 100dvh;
  background: var(--bg-dark);
  color: var(--text);
  font-family: 'Segoe UI', Arial, sans-serif;
}

.home-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex; flex-direction: column; gap: 36px;
}

/* Header */
.home-header {
  display: flex; align-items: center; justify-content: space-between;
}
.home-logo {
  display: flex; align-items: center; gap: 12px;
  font-size: 1.4rem; font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #4f8ef7 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.home-back-btn {
  display: flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: 0.85rem; text-decoration: none;
  padding: 6px 12px; border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.home-back-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.home-back-btn .material-symbols-outlined { font-size: 18px; }

/* Section titles */
.section-title {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px;
}

/* ── Start cards ── */
.start-cards {
  display: flex; flex-direction: column; gap: 10px;
}
@media (min-width: 500px) { .start-cards { flex-direction: row; } }

.start-card {
  flex: 1;
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
  color: var(--text);
}
.start-card:hover {
  border-color: rgba(79,142,247,0.5);
  background: rgba(79,142,247,0.06);
  transform: translateY(-2px);
}
.start-card:active { transform: translateY(0); }

.sc-icon {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 12px;
  background: rgba(79,142,247,0.15);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.sc-icon .material-symbols-outlined { font-size: 26px; }
.sc-icon-file { background: rgba(100,200,120,0.13); color: #64c878; }

.sc-body { flex: 1; }
.sc-name { font-size: 1rem; font-weight: 600; margin-bottom: 3px; }
.sc-desc { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }

.sc-arrow { color: var(--muted); font-size: 20px; flex-shrink: 0; }

/* ── Recents ── */
.recents-list {
  display: flex; flex-direction: column; gap: 8px;
}
.no-recents {
  color: var(--muted); font-size: 0.88rem;
  padding: 18px 0;
}

.recent-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 14px 16px;
  cursor: pointer; text-align: left;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
  width: 100%;
}
.recent-card:hover {
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
}

.rc-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 10px;
  background: rgba(79,142,247,0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.rc-icon .material-symbols-outlined { font-size: 22px; }

.rc-body { flex: 1; overflow: hidden; }
.rc-name {
  font-size: 0.92rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rc-meta { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.rc-arrow { color: var(--muted); font-size: 18px; flex-shrink: 0; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px;
  width: min(420px, 100%);
  display: flex; flex-direction: column; gap: 14px;
}
.modal-title { font-size: 1.2rem; font-weight: 700; }
.modal-sub   { font-size: 0.85rem; color: var(--muted); margin-top: -6px; }

.modal-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.modal-input:focus { border-color: var(--accent); }
.modal-input::placeholder { color: var(--muted); }

.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 4px;
}

/* ── Processing overlay ── */
.proc-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; z-index: 600;
}
.proc-overlay.hidden { display: none; }
.proc-overlay .spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.proc-overlay p { color: #aaa; font-size: 0.95rem; }

/* ── Canvas page ── */
#infinite-canvas {
  position: fixed; inset: 0;
  display: block;
  touch-action: none;
}

.board-name-label {
  font-size: 0.9rem; font-weight: 600; color: #ddd;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-radius: 6px; padding: 2px 6px;
  transition: background 0.15s;
}
.board-name-label:hover { background: rgba(255,255,255,0.08); }

.zoom-label {
  font-size: 0.82rem; color: #aaa;
  min-width: 42px; text-align: center;
  font-variant-numeric: tabular-nums;
}

