/* PDF-Yard - PDF Editor, Signer & Page Organizer Styles */

/* Interactive Studio Layout */
.editor-layout {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-body);
}

/* Side Thumbnail Drawer in Editor */
.editor-sidebar {
  width: 220px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-normal);
}

.editor-sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-thumbnails-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editor-thumb-item {
  position: relative;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  cursor: pointer;
  background: var(--bg-surface);
  transition: all var(--transition-fast);
  text-align: center;
}

.editor-thumb-item:hover {
  border-color: var(--color-primary);
}

.editor-thumb-item.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-glow);
}

.editor-thumb-img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.editor-thumb-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Editor Main Canvas Area */
.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Editor Top Toolbar */
.editor-toolbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  z-index: 20;
  overflow-x: auto;
}

.editor-tool-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.editor-tool-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
  margin: 0 0.4rem;
}

.editor-tool-btn {
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.editor-tool-btn:hover {
  background: var(--bg-subtle);
}

.editor-tool-btn.active {
  background: var(--color-primary);
  color: #ffffff;
}

/* Canvas Viewport */
.editor-viewport {
  flex: 1;
  overflow: auto;
  background: #525659;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  gap: 2rem;
}

[data-theme="dark"] .editor-viewport {
  background: #181c24;
}

.pdf-page-container {
  position: relative;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  margin-bottom: 1rem;
  user-select: none;
}

.pdf-page-canvas {
  display: block;
  border-radius: 4px;
}

.pdf-overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  cursor: default;
}

/* Floating Properties Bar */
.properties-bar {
  position: absolute;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 0.4rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  z-index: 30;
  backdrop-filter: blur(10px);
}

.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--border-subtle);
  transition: transform var(--transition-fast);
}

.color-dot:hover, .color-dot.active {
  transform: scale(1.25);
}

/* Draggable & Resizable Elements on Canvas */
.placed-element {
  position: absolute;
  border: 1px dashed var(--color-primary);
  cursor: move;
  z-index: 50;
  user-select: none;
  background: rgba(79, 70, 229, 0.05);
}

.placed-element:hover {
  border-color: var(--color-primary);
}

.placed-element-del {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 20px;
  height: 20px;
  background: var(--color-ruby);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.placed-element-handle {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  background: var(--color-primary);
  border-radius: 2px;
  cursor: se-resize;
}

/* eSign Signature Creation Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.signature-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modal-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-pop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-tabs {
  display: flex;
  padding: 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.5rem;
  background: var(--bg-subtle);
}

.modal-tab-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-tab-btn.active {
  background: var(--bg-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.signature-canvas-wrap {
  position: relative;
  margin: 1.5rem;
  background: #ffffff;
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  height: 200px;
}

.signature-pad-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  border-radius: var(--radius-lg);
}

.cursive-preview-card {
  padding: 1rem;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.cursive-preview-card:hover {
  border-color: var(--color-primary);
}

.cursive-preview-card.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.font-gv { font-family: 'Great Vibes', cursive; font-size: 2.2rem; }
.font-ds { font-family: 'Dancing Script', cursive; font-size: 2rem; }
.font-pacifico { font-family: 'Pacifico', cursive; font-size: 1.7rem; }

/* Page Organizer Visual Grid */
.organizer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.page-tile {
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: grab;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.page-tile:active {
  cursor: grabbing;
}

.page-tile:hover {
  border-color: var(--color-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.page-tile.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.page-tile-img-box {
  width: 100%;
  aspect-ratio: 1 / 1.414; /* A4 aspect ratio */
  background: #f1f5f9;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.page-tile-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--transition-fast);
}

.page-tile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.page-tile-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.page-tile-btns {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tile-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all var(--transition-fast);
}

.tile-icon-btn:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.tile-icon-btn.btn-del:hover {
  background: var(--color-ruby);
  border-color: var(--color-ruby);
}
