/* Presentations App Styles */

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--sz-font-family, 'Segoe UI', Tahoma, sans-serif);
  font-size: var(--sz-font-size, 12px);
  background: var(--sz-color-button-face, #f0f0f0);
  color: var(--sz-color-button-text, #000);
}

/* === Main Layout === */

.app-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  grid-template-rows: 1fr auto auto;
  height: calc(100vh - 120px); /* ribbon + qat + status bar */
}

.app-layout.with-comments-panel {
  grid-template-columns: 180px 1fr 240px;
}

.app-layout.with-animation-pane.with-comments-panel {
  grid-template-columns: 180px 1fr 240px 240px;
}

.slide-panel {
  grid-row: 1 / 3;
  grid-column: 1;
  background: #f3f3f3;
  border-right: 1px solid #d0d0d0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
}

.slide-thumbs {
  flex: 1;
  padding: 8px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slide-thumb {
  position: relative;
  width: 150px;
  aspect-ratio: 16 / 9;
  border: 2px solid #c0c0c0;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  margin: 0 auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.slide-thumb:hover {
  border-color: #999;
}

.slide-thumb.active {
  border-color: #4472c4;
  box-shadow: 0 0 0 1px #4472c4, 0 1px 4px rgba(68,114,196,0.3);
}

.slide-thumb.drag-over {
  border-color: #ed7d31;
  border-style: dashed;
}

.slide-thumb-number {
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translate(-100%, -50%);
  font-size: 10px;
  color: #666;
  padding-right: 4px;
  pointer-events: none;
}

.slide-thumb-content {
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  pointer-events: none;
  position: relative;
  overflow: hidden;
}

.add-slide-btn {
  margin: 4px 14px 8px;
  padding: 6px 0;
  background: transparent;
  border: 1px dashed #aaa;
  border-radius: 3px;
  color: #666;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
}

.add-slide-btn:hover {
  background: #e8e8e8;
  border-color: #888;
  color: #333;
}

/* === Editor Area === */

.editor-area {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: #e0e0e0;
  padding: 20px;
}

.canvas-viewport {
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-canvas {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  position: relative;
  overflow: hidden;
  cursor: default;
}

/* === Slide Elements === */

.slide-element {
  position: absolute;
  cursor: move;
  box-sizing: border-box;
  min-width: 20px;
  min-height: 20px;
}

.slide-element:hover:not(.selected) {
  outline: 1px solid rgba(68,114,196,0.4);
}

.slide-element.selected {
  outline: 2px dashed #4472c4;
}

.slide-element.placeholder-empty {
  opacity: 0.6;
  border: 1px dashed #bbb;
}

.slide-element.placeholder-empty [contenteditable] {
  color: #999 !important;
  font-style: italic;
}

.el-textbox [contenteditable]:focus {
  caret-color: #000;
  outline: 1px solid rgba(68,114,196,0.5);
  outline-offset: -1px;
}

/* Resize handles */
.resize-handles {
  display: none;
}

.slide-element.selected .resize-handles {
  display: block;
}

.resize-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #fff;
  border: 1px solid #4472c4;
  box-sizing: border-box;
  z-index: 10;
}

.resize-handle.nw { top: -4px; left: -4px; cursor: nw-resize; }
.resize-handle.n  { top: -4px; left: 50%; margin-left: -4px; cursor: n-resize; }
.resize-handle.ne { top: -4px; right: -4px; cursor: ne-resize; }
.resize-handle.e  { top: 50%; margin-top: -4px; right: -4px; cursor: e-resize; }
.resize-handle.se { bottom: -4px; right: -4px; cursor: se-resize; }
.resize-handle.s  { bottom: -4px; left: 50%; margin-left: -4px; cursor: s-resize; }
.resize-handle.sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.resize-handle.w  { top: 50%; margin-top: -4px; left: -4px; cursor: w-resize; }

/* Feature 1: Rotation handle */
.rotation-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #22cc44;
  border: 1px solid #119922;
  border-radius: 50%;
  left: 50%;
  top: -30px;
  transform: translateX(-50%);
  cursor: grab;
  z-index: 100;
  pointer-events: auto;
}

.rotation-handle:active {
  cursor: grabbing;
}

.rotation-line {
  position: absolute;
  width: 1px;
  height: 20px;
  background: #22cc44;
  left: 50%;
  top: -20px;
  transform: translateX(-50%);
  z-index: 99;
  pointer-events: none;
}

/* Element types */
.el-textbox .text-content,
.el-textbox [contenteditable] {
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: none;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.el-textbox .text-content:focus,
.el-textbox [contenteditable]:focus {
  cursor: text;
  user-select: text;
}

.el-textbox .text-content p,
.el-textbox [contenteditable] p {
  margin: 0;
}

.el-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.el-shape svg {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.el-table table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.el-table td {
  border: 1px solid #bbb;
  padding: 4px 6px;
  font-size: 12px;
  vertical-align: top;
}

.el-table td:focus {
  outline: 2px solid #4472c4;
  outline-offset: -2px;
}

/* Feature 7: Group element */
.el-group {
  overflow: visible !important;
}

/* Feature 8: Hyperlink indicator */
.has-hyperlink {
  border-bottom: 2px solid #0066cc !important;
}

.has-hyperlink::after {
  content: '\1F517';
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 10px;
  opacity: 0.6;
  pointer-events: none;
}

/* Feature 4: Smart Guides */
.smart-guide {
  position: absolute;
  background: #ff4444;
  z-index: 500;
  pointer-events: none;
}

.smart-guide-h {
  height: 1px;
  left: 0;
  right: 0;
  border-top: 1px dashed #ff4444;
  background: none;
}

.smart-guide-v {
  width: 1px;
  top: 0;
  bottom: 0;
  border-left: 1px dashed #ff4444;
  background: none;
}

/* Feature 9: Slide footer overlay */
.slide-footer-overlay {
  position: absolute;
  bottom: 8px;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #666;
  pointer-events: none;
  z-index: 0;
}

.slide-footer-left,
.slide-footer-center,
.slide-footer-right {
  flex: 1;
}

.slide-footer-center {
  text-align: center;
}

.slide-footer-right {
  text-align: right;
}

/* Feature 10: Spell check error */
.pp-spell-error {
  text-decoration: wavy underline red;
  text-decoration-skip-ink: none;
  cursor: context-menu;
}

/* Feature 6: Find & Replace dialog fields */
.pp-dlg-field {
  margin-bottom: 8px;
}

.pp-dlg-field label {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
}

.pp-dlg-field input[type="text"] {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  border-radius: 3px;
  font: inherit;
}

/* Feature 2: Align dropdown */
.rb-dropdown {
  position: relative;
  display: inline-block;
}

.rb-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 4px 0;
  min-width: 180px;
  z-index: 2000;
  font-size: 12px;
}

.rb-dropdown:hover .rb-dropdown-menu,
.rb-dropdown:focus-within .rb-dropdown-menu {
  display: block;
}

/* Allow dropdown menus to extend beyond the ribbon panel (fixes Animations>Add menu clipped behind slide thumbnails) */
.ribbon-panel:has(.rb-dropdown:hover),
.ribbon-panel:has(.rb-dropdown:focus-within) {
  overflow: visible;
}

.rb-dropdown-menu button {
  display: block;
  width: 100%;
  padding: 6px 16px;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.rb-dropdown-menu button:hover {
  background: var(--sz-color-highlight, #0078d4);
  color: var(--sz-color-highlight-text, #fff);
}

.rb-dropdown-menu hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 4px 0;
}

/* Active state for toggle buttons */
.rb-btn-active {
  background: #d4e4f7 !important;
  border-color: #4472c4 !important;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}

/* === Notes Panel === */

.notes-panel {
  grid-row: 2;
  grid-column: 2;
  border-top: 1px solid #c0c0c0;
  background: #f9f9f9;
  min-height: 30px;
}

.notes-panel.collapsed .notes-editor {
  display: none;
}

.notes-label {
  font-size: 10px;
  color: #666;
  padding: 4px 8px 2px;
  cursor: pointer;
  user-select: none;
}

.notes-editor {
  width: 100%;
  height: 80px;
  border: none;
  outline: none;
  resize: vertical;
  padding: 4px 8px;
  font-size: 11px;
  font-family: inherit;
  background: transparent;
  box-sizing: border-box;
}

/* === Status Bar === */

.status-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 10px;
  background: var(--sz-color-button-face, #f0f0f0);
  border-top: 1px solid #c0c0c0;
  font-size: 11px;
  color: #666;
  height: 22px;
  box-sizing: border-box;
}

/* === Ribbon Extensions === */

/* Transition gallery */
.transition-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, 50px);
  gap: 3px;
  max-height: 90px;
  overflow-y: auto;
  padding: 4px;
}

.transition-tile {
  width: 48px;
  height: 32px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #f8f8f8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1px;
  overflow: hidden;
  user-select: none;
}

.transition-tile svg {
  width: 100%;
  height: 100%;
  display: block;
}

.transition-tile:hover {
  border-color: #4472c4;
  background: #e8f0fa;
  box-shadow: 0 0 3px rgba(68,114,196,0.4);
}

.transition-tile.active {
  border-color: #4472c4;
  background: #d4e4f7;
  box-shadow: inset 0 0 0 1px #4472c4;
}

/* Theme gallery */
.theme-gallery {
  display: flex;
  gap: 6px;
  padding: 4px;
  flex-wrap: wrap;
}

.theme-tile {
  width: 48px;
  height: 36px;
  border: 1px solid #ccc;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.theme-tile:hover {
  border-color: #4472c4;
  box-shadow: 0 0 0 1px #4472c4;
}

.theme-tile.active {
  border-color: #4472c4;
  border-width: 2px;
}

.theme-tile-header {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: bold;
}

.theme-tile-colors {
  display: flex;
  height: 8px;
}

.theme-tile-colors span {
  flex: 1;
}

/* Layout dropdown */
.layout-dropdown {
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(3, 80px);
  gap: 6px;
  z-index: 1000;
}

.layout-option {
  width: 80px;
  height: 50px;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #f9f9f9;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #666;
  gap: 2px;
}

.layout-option:hover {
  border-color: #4472c4;
  background: #e8f0fa;
}

.layout-option .layout-preview {
  width: 60px;
  height: 34px;
  border: 1px solid #ddd;
  background: #fff;
  position: relative;
}

.layout-preview .ph {
  position: absolute;
  background: #d0d0d0;
  border-radius: 1px;
}

/* Shape dropdown */
.shape-dropdown {
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, 36px);
  gap: 4px;
  z-index: 1000;
}

.shape-option {
  width: 36px;
  height: 36px;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #f9f9f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.shape-option:hover {
  border-color: #4472c4;
  background: #e8f0fa;
}

.shape-option svg {
  width: 24px;
  height: 24px;
}

/* Context menu for slides — z-index must exceed ribbon dropdowns (2000) and layout panels */
.slide-context-menu {
  position: fixed;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 4px 0;
  min-width: 160px;
  z-index: 9000;
  font-size: 12px;
}

.slide-context-menu .ctx-item {
  padding: 6px 16px;
  cursor: pointer;
  display: block;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
}

.slide-context-menu .ctx-item:hover {
  background: var(--sz-color-highlight, #0078d4);
  color: var(--sz-color-highlight-text, #fff);
}

.slide-context-menu .ctx-sep {
  height: 1px;
  background: #e0e0e0;
  margin: 4px 0;
}

/* === Slide Sorter View === */

.slide-sorter {
  display: none;
  padding: 20px;
  gap: 16px;
  flex-wrap: wrap;
  overflow-y: auto;
  background: #e0e0e0;
  align-content: flex-start;
}

.slide-sorter.active {
  display: flex;
}

.slide-sorter .sort-thumb {
  position: relative;
  width: 200px;
  aspect-ratio: 16 / 9;
  border: 2px solid #c0c0c0;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.slide-sorter .sort-thumb:hover {
  border-color: #888;
}

.slide-sorter .sort-thumb.active {
  border-color: #4472c4;
  box-shadow: 0 0 0 2px #4472c4;
}

.slide-sorter .sort-thumb.drag-over {
  border-color: #ed7d31;
  border-style: dashed;
  box-shadow: 0 0 0 2px #ed7d31;
}

.sort-thumb-label {
  font-size: 11px;
  color: #666;
  text-align: center;
  margin-top: 4px;
}

/* === Dialogs === */

.pp-dialog-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 5000;
  align-items: center;
  justify-content: center;
}

.pp-dialog-overlay.visible {
  display: flex;
}

.pp-dialog {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  padding: 20px;
  min-width: 300px;
  max-width: 400px;
}

.pp-dialog h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.pp-dialog label {
  display: block;
  margin: 8px 0 4px;
  font-size: 12px;
}

.pp-dialog input[type="number"],
.pp-dialog input[type="text"],
.pp-dialog input[type="color"],
.pp-dialog select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
  box-sizing: border-box;
}

.pp-dialog .dlg-buttons {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.pp-dialog .dlg-buttons button {
  padding: 6px 16px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #f0f0f0;
  cursor: pointer;
  font: inherit;
}

.pp-dialog .dlg-buttons button.primary {
  background: #4472c4;
  color: #fff;
  border-color: #3a62a8;
}

/* === Background dialog specifics === */

.bg-type-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  overflow: hidden;
}

.bg-type-tab {
  flex: 1;
  padding: 6px 0;
  border: none;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 11px;
  text-align: center;
}

.bg-type-tab.active {
  background: #4472c4;
  color: #fff;
}

.bg-section {
  display: none;
}

.bg-section.active {
  display: block;
}

.gradient-preview {
  width: 100%;
  height: 40px;
  border: 1px solid #ccc;
  border-radius: 3px;
  margin-top: 8px;
}

/* === View modes === */

body.view-sorter .app-layout {
  display: none;
}

body.view-sorter .slide-sorter {
  display: flex;
  height: calc(100vh - 120px);
}

body.view-notes .notes-panel {
  min-height: 150px;
}

body.view-notes .notes-editor {
  height: 140px;
}

/* === Animation Pane === */

.animation-pane {
  width: 240px;
  border-left: 1px solid #ccc;
  background: #f9f9f9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  grid-row: 1;
  grid-column: 3;
}

.animation-pane-header {
  padding: 8px;
  background: #e8e8e8;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #d0d0d0;
}

.animation-pane-header button {
  border: none;
  background: none;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.animation-pane-header button:hover {
  color: #cc0000;
}

.animation-pane-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.animation-pane-actions {
  padding: 4px;
  border-top: 1px solid #d0d0d0;
  display: flex;
  gap: 4px;
  justify-content: center;
}

.animation-pane-actions button {
  padding: 4px 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #f0f0f0;
  cursor: pointer;
  font-size: 11px;
}

.animation-pane-actions button:hover {
  background: #e0e0e0;
  border-color: #999;
}

.anim-item {
  padding: 6px 8px;
  border: 1px solid #ddd;
  background: white;
  margin-bottom: 2px;
  border-radius: 3px;
  cursor: grab;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  user-select: none;
}

.anim-item:hover {
  background: #f0f0f0;
  border-color: #bbb;
}

.anim-item.selected {
  background: #cce5ff;
  border-color: #80b3ff;
}

.anim-item .anim-trigger-icon {
  font-size: 13px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.anim-item .anim-category-icon {
  font-size: 11px;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
}

.anim-item .anim-category-icon.entrance { background: #4caf50; }
.anim-item .anim-category-icon.emphasis { background: #ff9800; }
.anim-item .anim-category-icon.exit { background: #f44336; }
.anim-item .anim-category-icon.motion-path { background: #2196f3; }

.anim-item .anim-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anim-item .anim-badge {
  font-size: 9px;
  background: #eee;
  padding: 1px 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.anim-category-label {
  font-weight: bold;
  padding: 4px 8px;
  color: #555;
  font-size: 10px;
  text-transform: uppercase;
}

.anim-empty-msg {
  padding: 16px 8px;
  text-align: center;
  color: #999;
  font-size: 11px;
  font-style: italic;
}

/* App layout adjustment when animation pane is open */
.app-layout.with-animation-pane {
  grid-template-columns: 180px 1fr 240px;
}

.app-layout.with-animation-pane .notes-panel {
  grid-column: 2 / 4;
}

.app-layout.with-animation-pane .slide-panel {
  grid-row: 1 / 3;
}

.app-layout.with-comments-panel .notes-panel {
  grid-column: 2 / 4;
}

.app-layout.with-comments-panel .comments-panel {
  grid-row: 1 / 3;
}

.app-layout.with-animation-pane.with-comments-panel .notes-panel {
  grid-column: 2 / 5;
}

/* === Slideshow overlay === */

#slideshow-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 9999;
}

#slideshow-overlay .ss-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#slideshow-overlay .ss-slide-container {
  position: relative;
  background: #fff;
  overflow: hidden;
}

#slideshow-overlay .ss-black-overlay,
#slideshow-overlay .ss-white-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: none;
}

#slideshow-overlay .ss-black-overlay {
  background: #000;
}

#slideshow-overlay .ss-white-overlay {
  background: #fff;
}

/* =========================================================
   Feature 14: Comments System
   ========================================================= */

.comments-panel {
  width: 240px;
  border-left: 1px solid #ccc;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  grid-row: 1 / 3;
  overflow: hidden;
}

.comments-panel-header {
  padding: 8px;
  background: #e8e8e8;
  font-weight: bold;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.comments-panel-header button {
  border: none;
  background: none;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  color: #666;
}

.comments-panel-header button:hover {
  color: #000;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}

.comments-add {
  padding: 4px;
  border-top: 1px solid #ddd;
  flex-shrink: 0;
}

.comments-add button {
  width: 100%;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
}

.comments-add button:hover {
  background: #e8f0fa;
}

.comment-card {
  padding: 8px;
  border: 1px solid #ddd;
  background: white;
  margin-bottom: 4px;
  border-radius: 3px;
  font-size: 11px;
}

.comment-card.resolved {
  opacity: 0.6;
}

.comment-author {
  font-weight: bold;
  color: #333;
}

.comment-date {
  font-size: 9px;
  color: #999;
}

.comment-actions {
  margin-top: 4px;
  display: flex;
  gap: 8px;
}

.comment-actions button {
  font-size: 10px;
  border: none;
  background: none;
  color: #0066cc;
  cursor: pointer;
  padding: 0;
}

.comment-actions button:hover {
  text-decoration: underline;
}

.comment-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #ffcc00;
  border: 1px solid #cc9900;
  border-radius: 2px;
  font-size: 9px;
  text-align: center;
  line-height: 16px;
  cursor: pointer;
  z-index: 50;
  user-select: none;
}

.comment-marker:hover {
  background: #ffdd44;
  transform: scale(1.2);
}

/* =========================================================
   Feature 15: Rulers & Guide Lines
   ========================================================= */

.ruler-h, .ruler-v {
  position: absolute;
  background: #f8f8f0;
  z-index: 10;
  pointer-events: auto;
}

.ruler-h {
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
  border-bottom: 1px solid #ccc;
}

.ruler-v {
  left: -20px;
  top: 0;
  bottom: 0;
  width: 20px;
  border-right: 1px solid #ccc;
}

.ruler-tick {
  position: absolute;
  background: #666;
}

.ruler-label {
  position: absolute;
  font-size: 8px;
  color: #666;
  pointer-events: none;
}

.guide-line-h {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed #0088ff;
  z-index: 5;
  pointer-events: auto;
  cursor: ns-resize;
}

.guide-line-v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  border-left: 1px dashed #0088ff;
  z-index: 5;
  pointer-events: auto;
  cursor: ew-resize;
}

/* =========================================================
   Feature 16: Section Headers
   ========================================================= */

.section-header {
  padding: 4px 8px;
  background: #e0e0e0;
  font-weight: bold;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 3px;
  user-select: none;
}

.section-header:hover {
  background: #d0d0d0;
}

.section-header .collapse-icon {
  font-size: 10px;
  transition: transform 0.2s;
  display: inline-block;
}

.section-header.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

/* =========================================================
   Feature 20: Action Button elements
   ========================================================= */

.el-action-button {
  transition: filter 0.1s;
}

.el-action-button:hover {
  filter: brightness(1.1);
}

/* =========================================================
   Feature 21: Video/Audio elements
   ========================================================= */

.el-video {
  background: #000;
}

.el-audio {
  min-height: 60px;
}

/* =========================================================
   Feature 23: Chart elements
   ========================================================= */

.el-chart {
  border: 1px solid #e0e0e0;
  border-radius: 2px;
}

/* =========================================================
   Feature 27: Connector elements
   ========================================================= */

.el-connector {
  pointer-events: none;
}

.el-connector svg {
  pointer-events: none;
}

.el-connector svg line,
.el-connector svg polyline,
.el-connector svg path {
  pointer-events: stroke;
  cursor: pointer;
}

/* =========================================================
   Feature 29: SmartArt elements
   ========================================================= */

.el-smartart {
  border: 1px solid transparent;
  border-radius: 2px;
}

.el-smartart:hover {
  border-color: #b0b0b0;
}

/* =========================================================
   Feature 18: Custom Shows Dialog
   ========================================================= */

#dlg-custom-shows select {
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 12px;
  padding: 4px;
}

#dlg-custom-shows button {
  padding: 4px 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #f0f0f0;
  cursor: pointer;
  font-size: 11px;
}

#dlg-custom-shows button:hover {
  background: #e0e0e0;
}

/* ══════════════════════════════════════════════════════════════
   Feature: Shape Format Panel (right sidebar)
   ══════════════════════════════════════════════════════════════ */

.shape-format-panel {
  width: 220px;
  min-width: 220px;
  background: #f8f8f8;
  border-left: 1px solid #d0d0d0;
  overflow-y: auto;
  font-size: 11px;
}

.shape-format-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: #e8e8e8;
  border-bottom: 1px solid #d0d0d0;
  font-weight: bold;
  font-size: 12px;
}

.shape-format-header button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

.shape-format-body {
  padding: 4px;
}

.shape-format-body details {
  margin-bottom: 2px;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #fff;
}

.shape-format-body summary {
  cursor: pointer;
  padding: 4px 6px;
  font-weight: bold;
  font-size: 11px;
  background: #f0f0f0;
  user-select: none;
}

.sfp-section {
  padding: 6px;
}

.sfp-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  font-size: 11px;
}

.sfp-row label {
  min-width: 42px;
  font-size: 11px;
}

.sfp-row input[type="color"] {
  width: 28px;
  height: 20px;
  border: 1px solid #ccc;
  border-radius: 2px;
  padding: 0;
  cursor: pointer;
}

/* Ribbon font color wrap */
.rb-color-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  cursor: pointer;
}

.rb-color-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-weight: bold;
  font-size: 12px;
  border-radius: 2px;
  pointer-events: none;
}

/* Color swatch (replaces native <input type="color">) */
.color-swatch {
  display: inline-block;
  width: 28px;
  height: 20px;
  border: 1px solid #999;
  border-radius: 2px;
  cursor: pointer;
  vertical-align: middle;
  box-sizing: border-box;
}

.color-swatch:hover {
  border-color: #333;
  box-shadow: 0 0 0 1px #333;
}

.rb-color-wrap .color-swatch {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.pp-dialog .color-swatch {
  width: 100%;
  height: 24px;
  border-radius: 3px;
}

.sfp-row input[type="number"] {
  border: 1px solid #ccc;
  border-radius: 2px;
  padding: 2px 4px;
}

.sfp-row select {
  border: 1px solid #ccc;
  border-radius: 2px;
  padding: 2px 4px;
}

.app-layout.with-format-panel {
  grid-template-columns: 200px 1fr auto auto auto;
}

/* ══════════════════════════════════════════════════════════════
   Feature: PDF Export - Print Styles
   ══════════════════════════════════════════════════════════════ */

.print-container {
  display: none;
}

.print-slide-page {
  width: 960px;
  height: 540px;
  position: relative;
  overflow: hidden;
  background: #fff;
  page-break-after: always;
}

.print-slide-page:last-child {
  page-break-after: auto;
}

@media print {
  body > *:not(.print-container) {
    display: none !important;
  }
  .print-container {
    display: block !important;
  }
  .print-slide-page {
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    page-break-after: always;
    margin: 0;
    padding: 0;
  }
  .print-slide-page:last-child {
    page-break-after: auto;
  }
  .print-slide-page .slide-canvas {
    transform: none !important;
    width: 100% !important;
    height: 100% !important;
  }
  @page {
    size: landscape;
    margin: 0;
  }
}

/* ══════════════════════════════════════════════════════════════
   Feature: Alt Text Dialog
   ══════════════════════════════════════════════════════════════ */

#dlg-alt-text .pp-dlg-field {
  margin-bottom: 8px;
}

#dlg-alt-text label {
  display: block;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 3px;
}

#dlg-alt-text input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
}

/* ══════════════════════════════════════════════════════════════
   Feature 13: Pen / Laser Pointer in Slideshow
   ══════════════════════════════════════════════════════════════ */

.slideshow-laser {
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: red;
  box-shadow: 0 0 12px 4px rgba(255,0,0,.6);
  pointer-events: none;
  z-index: 100001;
  transform: translate(-50%,-50%);
}

.slideshow-pen-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100000;
  cursor: crosshair;
}

.slideshow-toolbar {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0,0,0,.7);
  border-radius: 20px;
  z-index: 100002;
  transition: opacity .3s;
}

.slideshow-toolbar button {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
}

.slideshow-toolbar button:hover {
  background: rgba(255,255,255,.4);
}

.slideshow-toolbar button.active {
  background: rgba(255,255,255,.5);
}

/* ══════════════════════════════════════════════════════════════
   Feature 22: Master Slide Editing
   ══════════════════════════════════════════════════════════════ */

.master-view-banner {
  background: #c44;
  color: #fff;
  padding: 4px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.master-view-banner button {
  background: #fff;
  color: #c44;
  border: none;
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
}

.master-view-banner button:hover {
  background: #eee;
}

.master-element-overlay {
  position: absolute;
  pointer-events: none;
  opacity: 0.4;
}

/* ══════════════════════════════════════════════════════════════
   P1: Equation Editor
   ══════════════════════════════════════════════════════════════ */

.slide-equation {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: inherit;
  line-height: 1.4;
  padding: 4px 8px;
  min-height: 1.2em;
}

.eq-fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  text-align: center;
  line-height: 1.2;
}

.eq-fraction .eq-num,
.eq-fraction .eq-den {
  padding: 0 4px;
}

.eq-fraction .eq-bar {
  width: 100%;
  height: 1px;
  background: currentColor;
  margin: 1px 0;
}

.eq-sqrt {
  display: inline-flex;
  align-items: flex-end;
  vertical-align: middle;
}

.eq-sqrt::before {
  content: '\221A';
  font-size: 1.3em;
  line-height: 1;
}

.eq-sqrt .eq-sqrt-content {
  border-top: 1px solid currentColor;
  padding: 0 4px 0 2px;
  margin-top: 2px;
}

.eq-sup {
  font-size: 0.7em;
  vertical-align: super;
}

.eq-sub {
  font-size: 0.7em;
  vertical-align: sub;
}

.eq-large-op {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  line-height: 1;
  margin: 0 2px;
}

.eq-large-op .eq-op {
  font-size: 1.6em;
  line-height: 1;
}

.eq-large-op .eq-limit-top,
.eq-large-op .eq-limit-bot {
  font-size: 0.6em;
  line-height: 1.1;
}

.eq-matrix {
  display: inline-flex;
  flex-direction: column;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
  padding: 2px 6px;
  vertical-align: middle;
  gap: 2px;
}

.eq-matrix-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Equation Dialog Styles */
.eq-symbol-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #fafafa;
  max-height: 60px;
  overflow-y: auto;
}

.eq-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  cursor: pointer;
  font-size: 16px;
  background: #fff;
  user-select: none;
}

.eq-symbol:hover {
  background: #e8f0fa;
  border-color: #4472c4;
}

.eq-template-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #fafafa;
}

.eq-template-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 10px;
  color: #666;
}

.eq-template-tile:hover {
  border-color: #4472c4;
  background: #e8f0fa;
}

.eq-template-preview {
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: 14px;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.eq-preview-box {
  min-height: 60px;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #fff;
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

/* ══════════════════════════════════════════════════════════════
   P2: Animation Painter
   ══════════════════════════════════════════════════════════════ */

.animation-painter-active,
.animation-painter-active .slide-canvas,
.animation-painter-active .slide-element {
  cursor: crosshair !important;
}

/* ══════════════════════════════════════════════════════════════
   P4: Eyedropper Color Picker
   ══════════════════════════════════════════════════════════════ */

.eyedropper-active,
.eyedropper-active .slide-canvas,
.eyedropper-active .slide-element {
  cursor: crosshair !important;
}

.eyedropper-preview {
  position: fixed;
  width: 24px;
  height: 24px;
  border: 2px solid #333;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  background: #fff;
}

/* ══════════════════════════════════════════════════════════════
   P5: Image Cropping
   ══════════════════════════════════════════════════════════════ */

.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  pointer-events: none;
}

.crop-mask {
  position: absolute;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.crop-mask-top {
  top: 0;
  left: 0;
  right: 0;
}

.crop-mask-bottom {
  bottom: 0;
  left: 0;
  right: 0;
}

.crop-mask-left {
  top: 0;
  bottom: 0;
  left: 0;
}

.crop-mask-right {
  top: 0;
  bottom: 0;
  right: 0;
}

.crop-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid #4472c4;
  box-sizing: border-box;
  z-index: 210;
  pointer-events: auto;
}

.crop-handle-nw { top: -5px; left: -5px; cursor: nw-resize; }
.crop-handle-n  { top: -5px; left: 50%; margin-left: -5px; cursor: n-resize; }
.crop-handle-ne { top: -5px; right: -5px; cursor: ne-resize; }
.crop-handle-e  { top: 50%; margin-top: -5px; right: -5px; cursor: e-resize; }
.crop-handle-se { bottom: -5px; right: -5px; cursor: se-resize; }
.crop-handle-s  { bottom: -5px; left: 50%; margin-left: -5px; cursor: s-resize; }
.crop-handle-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.crop-handle-w  { top: 50%; margin-top: -5px; left: -5px; cursor: w-resize; }

.crop-actions {
  position: absolute;
  bottom: -36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 220;
  pointer-events: auto;
}

.crop-apply-btn,
.crop-cancel-btn {
  padding: 4px 12px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
}

.crop-apply-btn {
  background: #4472c4;
  color: #fff;
  border-color: #3a62a8;
}

.crop-apply-btn:hover {
  background: #3a62a8;
}

.crop-cancel-btn {
  background: #f0f0f0;
}

.crop-cancel-btn:hover {
  background: #e0e0e0;
}

.cropped-image {
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════
   P1: Rehearse Timings - Timer Overlay & Summary Dialog
   ══════════════════════════════════════════════════════════════ */

.rehearsal-timer-overlay {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 16px;
  align-items: center;
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 8px 20px;
  border-radius: 6px;
  font-family: Consolas, monospace;
  font-size: 16px;
  user-select: none;
}

.rehearsal-timer-overlay .rt-slide-time {
  color: #4fc3f7;
}

.rehearsal-timer-overlay .rt-total-time {
  color: #a5d6a7;
}

.rehearsal-timer-overlay .rt-label {
  font-size: 10px;
  text-transform: uppercase;
  opacity: 0.7;
  margin-right: 4px;
}

.rehearsal-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
}

.rehearsal-summary-table th,
.rehearsal-summary-table td {
  padding: 4px 8px;
  border: 1px solid #ddd;
  text-align: center;
}

.rehearsal-summary-table th {
  background: #4472c4;
  color: #fff;
  font-weight: bold;
}

.rehearsal-summary-table tr:nth-child(even) {
  background: #f5f5f5;
}

.rehearsal-summary-table .total-row {
  font-weight: bold;
  background: #e8e8e8;
}

/* ══════════════════════════════════════════════════════════════
   P5: Element Locking
   ══════════════════════════════════════════════════════════════ */

.slide-element.locked {
  cursor: default;
}

.slide-element.locked .resize-handles-overlay {
  opacity: 0.3;
  pointer-events: none;
}

.slide-element.locked .resize-handle,
.slide-element.locked .rotation-handle {
  pointer-events: none;
  opacity: 0.3;
}

.lock-icon-overlay {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  pointer-events: none;
  z-index: 200;
  line-height: 1;
}
