/* Slide Master View */
.slide-master-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  background: var(--bg-app, #e5e7eb);
  color: var(--text-main, #1e293b);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}
.sm-ribbon {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 4px 8px 0;
  background: var(--bg-toolbar, #f8fafc);
  border-bottom: 1px solid var(--border-color, #cbd5e1);
  overflow: visible;
  position: relative;
  z-index: 1000;
}
.sm-group {
  display: flex;
  flex-direction: column;
  padding: 0 8px;
  border-right: 1px solid var(--border-color, #cbd5e1);
}
.sm-group-close { margin-left: auto; border-right: none; }
.sm-group-body { display: flex; align-items: flex-start; gap: 4px; flex: 1; padding: 2px 0; }
.sm-group-title { text-align: center; font-size: 0.68rem; color: var(--text-muted, #64748b); padding: 2px 0 3px; }
.sm-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 56px; padding: 4px 6px;
  background: transparent; border: 1px solid transparent; border-radius: 4px;
  color: inherit; font-size: 0.7rem; line-height: 1.15; cursor: pointer; text-align: center;
}
.sm-btn i.fa-solid:first-child { font-size: 1.35rem; color: #ea580c; }
.sm-btn:hover, .sm-btn-sm:hover { background: rgba(234, 88, 12, 0.1); border-color: rgba(234, 88, 12, 0.35); }
.sm-close i { color: #dc2626 !important; }
.sm-stack { display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.sm-btn-sm {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 8px; background: transparent; border: 1px solid transparent; border-radius: 4px;
  color: inherit; font-size: 0.74rem; cursor: pointer; text-align: left; white-space: nowrap;
}
.sm-btn-sm:disabled, .sm-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.sm-btn-sm.on { background: rgba(234, 88, 12, 0.15); border-color: rgba(234, 88, 12, 0.4); }
.sm-chk { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; padding: 3px 4px; cursor: pointer; white-space: nowrap; }
.sm-dd { position: relative; }
.sm-menu {
  position: absolute; top: calc(100% + 3px); left: 0; z-index: 10000; min-width: 190px;
  background-color: var(--bg-surface, #ffffff); border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 6px; box-shadow: 0 12px 28px rgba(15, 23, 42, 0.25), 0 2px 6px rgba(0, 0, 0, 0.08); padding: 4px;
}
.sm-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 10px; background: transparent; border: none; border-radius: 4px;
  color: inherit; font-size: 0.78rem; cursor: pointer; text-align: left; white-space: nowrap;
}
.sm-menu-item:hover { background: var(--bg-toolbar, #f1f5f9); color: #ea580c; }
.sm-swatch { width: 28px; height: 18px; border: 1px solid #94a3b8; border-radius: 3px; display: inline-block; }
.sm-swatch-row { display: inline-flex; gap: 2px; }
.sm-swatch-row i { width: 10px; height: 18px; display: inline-block; border: 1px solid rgba(0,0,0,0.15); }
.sm-bg-menu { display: grid; grid-template-columns: repeat(4, 44px); gap: 6px; padding: 8px; min-width: 0; }
.sm-bg-swatch { width: 44px; height: 30px; border: 1px solid #94a3b8; border-radius: 3px; cursor: pointer; }
.sm-bg-swatch:hover { outline: 2px solid #ea580c; }
.sm-bg-reset { grid-column: 1 / -1; }

.sm-formatbar {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; background: var(--bg-surface, #fff); border-bottom: 1px solid var(--border-color, #cbd5e1);
  font-size: 0.78rem;
}
.sm-formatbar.idle > *:not(.sm-fmt-label) { opacity: 0.45; pointer-events: none; }
.sm-fmt-label { font-weight: 600; margin-right: 8px; min-width: 190px; }
.sm-input {
  padding: 3px 6px; border: 1px solid var(--border-color, #cbd5e1); border-radius: 4px;
  background: var(--bg-surface, #fff); color: inherit; font-size: 0.78rem;
}
.sm-fmt-btn {
  width: 28px; height: 26px; border: 1px solid var(--border-color, #cbd5e1); border-radius: 4px;
  background: var(--bg-surface, #fff); color: inherit; cursor: pointer;
}
.sm-fmt-btn:hover { background: var(--bg-toolbar, #f1f5f9); }
.sm-color { width: 30px; height: 26px; padding: 0; border: 1px solid var(--border-color, #cbd5e1); border-radius: 4px; background: none; cursor: pointer; }

.sm-body { flex: 1; display: flex; min-height: 0; }
.sm-thumbs {
  width: 190px; flex-shrink: 0; overflow-y: auto; padding: 10px 8px;
  background: var(--bg-toolbar, #f1f5f9); border-right: 1px solid var(--border-color, #cbd5e1);
  display: flex; flex-direction: column; gap: 8px;
}
.sm-thumb { position: relative; padding: 4px 4px 4px 20px; border: 2px solid transparent; border-radius: 4px; cursor: pointer; }
.sm-thumb-layout { margin-left: 10px; padding-left: 22px; }
.sm-thumb:hover { background: rgba(234, 88, 12, 0.08); }
.sm-thumb.active { border-color: #c2410c; background: rgba(234, 88, 12, 0.1); }
.sm-thumb-num { position: absolute; left: 3px; top: 4px; font-size: 0.7rem; color: var(--text-muted, #64748b); }
.sm-thumb-name { font-size: 0.66rem; color: var(--text-muted, #64748b); text-align: center; padding-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-mini { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid #94a3b8; background: #fff; }
.sm-mini-inner { position: absolute; left: 0; top: 0; width: 960px; height: 540px; transform-origin: top left; transform: scale(0.142); }
.sm-thumb-layout .sm-mini-inner { transform: scale(0.13); }
.sm-mini-ph { position: absolute; border: 8px dashed #94a3b8; box-sizing: border-box; }

.sm-stage-wrap { flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 24px; background: var(--bg-app, #e5e7eb); }
.sm-stage-scaler { position: relative; flex-shrink: 0; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
.sm-stage { position: absolute; left: 0; top: 0; width: 960px; height: 540px; transform-origin: top left; background: #fff; overflow: hidden; }
.sm-ph {
  display: flex; align-items: center; box-sizing: border-box; padding: 6px 10px;
  border: 1.5px dashed #64748b; cursor: move; user-select: none; overflow: hidden;
}
.sm-ph.selected, .sm-deco.selected { outline: 2px solid #ea580c; outline-offset: 1px; }
.sm-deco { cursor: move; }
.sm-deco.sm-locked { opacity: 0.35; pointer-events: none; }
.sm-footer-ph { color: #64748b; cursor: pointer; }
.sm-footer-ph.off { opacity: 0.35; text-decoration: line-through; }
.sm-resize {
  position: absolute; right: -5px; bottom: -5px; width: 12px; height: 12px;
  background: #ea580c; border: 2px solid #fff; border-radius: 2px; cursor: nwse-resize; display: none; z-index: 5;
}
.selected > .sm-resize { display: block; }
[data-theme="dark"] .sm-ribbon, [data-theme="dark"] .sm-formatbar, [data-theme="dark"] .sm-thumbs { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .sm-menu, [data-theme="dark"] .sm-input, [data-theme="dark"] .sm-fmt-btn { background: #0f172a; border-color: #334155; }
