/* Scope all styles to avoid WordPress theme conflicts */
#pde-app-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #2c3e50;
  max-width: 1280px;
  margin: 20px auto;
  padding: 20px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

#pde-app-container * {
  box-sizing: border-box;
}

#pde-app-container .pde-header {
  text-align: center;
  margin-bottom: 20px;
}

#pde-app-container .pde-header h1 {
  font-size: 1.8rem;
  margin: 0 0 8px 0;
  color: #1a252f;
}

#pde-app-container .pde-header p {
  color: #6c757d;
  font-size: 0.95rem;
  margin: 0;
}

/* Toolbar Controls */
#pde-app-container .pde-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  margin-bottom: 15px;
}

#pde-app-container .pde-btn {
  background-color: #4a6cf7;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

#pde-app-container .pde-btn:hover { 
  background-color: #3855d6; 
}

#pde-app-container .pde-btn:disabled { 
  background-color: #ced4da; 
  cursor: not-allowed; 
}

#pde-app-container .pde-btn-success { 
  background-color: #28a745; 
}

#pde-app-container .pde-btn-success:hover { 
  background-color: #218838; 
}

#pde-app-container input[type="file"] { 
  display: none; 
}

#pde-app-container select, 
#pde-app-container input[type="color"],
#pde-app-container input[type="number"] {
  padding: 6px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* Editor Main Layout (Sidebar + Viewer) */
#pde-app-container .pde-main-layout {
  display: flex;
  gap: 15px;
  background: #525659;
  border-radius: 8px;
  padding: 15px;
  min-height: 550px;
}

/* Page Selection Sidebar */
#pde-app-container .pde-sidebar {
  width: 160px;
  background: #323639;
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 650px;
  overflow-y: auto;
}

#pde-app-container .pde-thumb-card {
  background: #fff;
  border: 3px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  padding: 4px;
  transition: all 0.2s ease;
}

#pde-app-container .pde-thumb-card.active {
  border-color: #4a6cf7;
}

#pde-app-container .pde-thumb-card canvas {
  width: 100%;
  height: auto;
  display: block;
}

#pde-app-container .pde-thumb-card span {
  font-size: 0.75rem;
  color: #fff;
  background: rgba(0,0,0,0.6);
  display: block;
  margin-top: 4px;
  border-radius: 2px;
}

/* Workspace / Main Canvas */
#pde-app-container .pde-workspace {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  max-height: 650px;
  position: relative;
}

#pde-app-container .pde-page-wrapper {
  position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  background-color: #ffffff;
}

#pde-app-container .pde-pdf-canvas { 
  display: block; 
}

#pde-app-container .pde-draw-canvas {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
}

/* Editable Text Overlay */
#pde-app-container .pde-text-overlay {
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  border: 1px dashed #4a6cf7;
  outline: none;
  padding: 2px 6px;
  white-space: nowrap;
  cursor: move;
  font-family: Helvetica, Arial, sans-serif;
}
