/* ==========================================================================
   iLovePDF Style PDF Editor & Annotator Studio Stylesheet
   ========================================================================== */

:root {
  --ilove-red: #e11d48;
  --ilove-red-hover: #be123c;
  --ilove-red-light: #fff1f2;
  --ilove-red-border: #fecdd3;
  --ilove-bg: #e5e7eb;
  --ilove-card-bg: #ffffff;
  --ilove-text-main: #0f172a;
  --ilove-text-muted: #64748b;
  --ilove-border: #cbd5e1;
}

* {
  box-sizing: border-box;
}

body.editor-body {
  background-color: var(--ilove-bg);
  color: var(--ilove-text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   1. UPLOAD HERO & DROPZONE
   ========================================================================== */
.editor-upload-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.25rem 4rem 1.25rem;
}

.upload-container {
  max-width: 820px;
  width: 100%;
  text-align: center;
  margin: 0 auto;
}

.upload-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.8px;
  margin-bottom: 0.5rem;
  line-height: 1.15;
}

.upload-desc {
  font-size: 1.05rem;
  color: var(--ilove-text-muted);
  max-width: 650px;
  margin: 0 auto 2.5rem auto;
  line-height: 1.5;
}

.upload-dropzone-box {
  background: var(--ilove-card-bg);
  border: 2px dashed #cbd5e1;
  border-radius: 20px;
  padding: 3.5rem 2rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-dropzone-box:hover,
.upload-dropzone-box.drag-over {
  border-color: var(--ilove-red);
  background: var(--ilove-red-light);
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(225, 29, 72, 0.12);
}

.btn-ilove-upload {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 800;
  padding: 1.15rem 3rem;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(225, 29, 72, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-ilove-upload:hover {
  transform: scale(1.03);
  box-shadow: 0 14px 30px rgba(225, 29, 72, 0.45);
}

.dropzone-hint {
  font-size: 0.92rem;
  color: #94a3b8;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0;
}

.features-pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 2.5rem;
}

.feat-pill {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   2. iLovePDF FULL-SCREEN WORKSPACE
   ========================================================================== */
.ilove-workspace {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 82px);
  background: #cbd5e1;
  overflow: hidden;
  position: relative;
}

/* TOP TOOLBAR RIBBON */
.ilove-top-bar {
  background: #ffffff;
  min-height: 52px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  z-index: 100;
  flex-shrink: 0;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.top-left-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.top-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.top-bar-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: var(--ilove-red);
}

.file-name-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: #0f172a;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center Main Tool Tabs */
.top-center-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 3px 5px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.tool-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.tool-tab-btn:hover {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.tool-tab-btn.active {
  background: var(--ilove-red);
  color: #ffffff;
  border-color: var(--ilove-red);
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.35);
}

/* Shapes Dropdown */
.dropdown-shapes-container {
  position: relative;
}

.shapes-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  padding: 6px;
  display: none;
  flex-direction: column;
  min-width: 160px;
  z-index: 1000;
}

.dropdown-shapes-container:hover .shapes-dropdown-menu,
.shapes-dropdown-menu.show {
  display: flex;
}

.shape-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.shape-menu-item:hover {
  background: var(--ilove-red-light);
  color: var(--ilove-red);
}

/* Top Right Actions (Undo, Redo, Zoom) */
.top-right-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.icon-tool-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.icon-tool-btn:hover:not(:disabled) {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
}

.icon-tool-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.toolbar-v-divider {
  width: 1px;
  height: 22px;
  background: #e2e8f0;
  margin: 0 4px;
}

.zoom-level-text {
  font-size: 0.8rem;
  font-weight: 800;
  color: #334155;
  min-width: 44px;
  text-align: center;
}

/* ==========================================================================
   3. CONTEXTUAL FORMATTING SUB-TOOLBAR
   ========================================================================== */
.ilove-context-bar {
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  z-index: 90;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
  min-height: 44px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.context-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.context-group-right {
  margin-left: auto;
}

.context-select {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
  background: #ffffff;
  cursor: pointer;
  outline: none;
}

.number-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.stepper-btn {
  width: 26px;
  height: 28px;
  border: none;
  background: #f8fafc;
  color: #475569;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.stepper-input {
  width: 38px;
  height: 28px;
  border: none;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: #0f172a;
  outline: none;
}

.context-divider {
  width: 1px;
  height: 20px;
  background: #e2e8f0;
  margin: 0 4px;
}

.context-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.context-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.context-btn.active {
  background: var(--ilove-red-light);
  border-color: var(--ilove-red);
  color: var(--ilove-red);
}

.context-btn-danger:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #ef4444;
}

.color-picker-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

.color-preview-circle {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
}

.hidden-color-input {
  display: none;
}

.context-btn-text {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.context-btn-text:hover {
  background: #f8fafc;
  color: var(--ilove-red);
}

.opacity-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   4. MAIN EDITOR AREA (SIDEBAR + STAGE + ACTION PANEL)
   ========================================================================== */
.ilove-editor-main {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
  height: calc(100% - 96px);
}

/* Left Page Thumbnails Sidebar */
.ilove-sidebar {
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  background: #ffffff;
  border-right: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 80;
  flex-shrink: 0;
}

.sidebar-top-title {
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pages-count-pill {
  font-size: 0.7rem;
  font-weight: 800;
  background: #f1f5f9;
  color: #0f172a;
  padding: 2px 6px;
  border-radius: 9999px;
}

.thumbnails-container {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thumbnail-card {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.thumbnail-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.thumbnail-card.active {
  border-color: var(--ilove-red);
  background: var(--ilove-red-light);
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.18);
}

.thumb-canvas-box {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  overflow: hidden;
  border-radius: 4px;
}

.thumb-canvas-box canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.thumb-page-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: #475569;
  margin-top: 6px;
}

.thumbnail-card.active .thumb-page-badge {
  color: var(--ilove-red);
}

.thumb-rotate-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  border: none;
  font-size: 0.75rem;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.thumbnail-card:hover .thumb-rotate-btn {
  display: flex;
}

.thumb-rotate-btn:hover {
  transform: rotate(90deg);
  background: var(--ilove-red);
}

/* Center Viewport Stage */
.ilove-viewport-area {
  flex: 1;
  background: #cbd5e1;
  overflow: auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px 80px 20px;
}

.ilove-canvas-stage {
  position: relative;
  background: #ffffff;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.22);
  border-radius: 3px;
  margin: 0 auto;
  flex-shrink: 0;
}

.pdf-canvas-layer {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.annotation-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 10;
  pointer-events: auto;
}

.drawing-canvas-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.drawing-canvas-layer.drawing-active {
  pointer-events: auto;
  cursor: crosshair;
}

/* Floating Bottom Page Quick Jumper */
.floating-page-jumper {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 30px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  padding: 5px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
}

.jumper-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.jumper-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.jumper-input {
  width: 36px;
  height: 26px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: #0f172a;
  outline: none;
}

.jumper-slash, .jumper-total {
  font-size: 0.82rem;
  font-weight: 800;
  color: #64748b;
}

/* RIGHT ACTION PANEL */
.ilove-action-panel {
  width: 290px;
  min-width: 290px;
  max-width: 290px;
  background: #ffffff;
  border-left: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  z-index: 80;
  flex-shrink: 0;
  overflow-y: auto;
}

.action-panel-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.panel-section-header {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.panel-section-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

/* Sidebar Text Styles Controls */
.sidebar-style-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.sidebar-select {
  flex: 1;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  outline: none;
}

.sidebar-select-sm {
  width: 65px;
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 6px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  outline: none;
}

.sidebar-btn-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.sidebar-icon-btn {
  flex: 1;
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sidebar-icon-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.sidebar-icon-btn.active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #2563eb;
  font-weight: 800;
}

.sidebar-color-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.sidebar-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-color-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1.5px #cbd5e1;
  display: inline-block;
}

/* ==========================================================================
   SEAMLESS IN-PLACE TEXT BLOCKS
   ========================================================================== */
.ilove-pdf-text-block {
  position: absolute;
  box-sizing: border-box;
  border: none !important;
  outline: none;
  background: transparent;
  border-radius: 2px;
  cursor: text;
  padding: 0 !important;
  margin: 0 !important;
  word-break: break-word;
  white-space: pre-wrap;
  z-index: 15;
  line-height: 1.18;
  user-select: text;
}

/* Hover: subtle blue dashed outline to indicate editable area without layout shift */
.ilove-pdf-text-block:hover {
  outline: 1px dashed rgba(37, 99, 235, 0.6) !important;
  background: rgba(37, 99, 235, 0.03) !important;
}

/* Active Edit: crisp blue outline firmly locked at exact position */
.ilove-pdf-text-block.active-edit {
  outline: 1.5px solid #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
  z-index: 50 !important;
}

/* When Modified and NOT active: seamless blend into the page */
.ilove-pdf-text-block.is-modified {
  outline: none !important;
}

.ilove-pdf-text-block.is-modified:hover {
  outline: 1px dashed rgba(37, 99, 235, 0.6) !important;
}

/* ==========================================================================
   INTERACTIVE PHOTO & QR CODE REPLACEMENT OVERLAY
   ========================================================================== */
.ilove-pdf-image-block {
  position: absolute;
  box-sizing: border-box;
  border: 2px dashed transparent;
  cursor: pointer;
  z-index: 25;
  transition: border-color 0.15s, background-color 0.15s;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ilove-pdf-image-block:hover {
  border-color: #2563eb !important;
  background-color: rgba(37, 99, 235, 0.08) !important;
}

.ilove-pdf-image-badge {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
  pointer-events: auto;
  z-index: 30;
}

.ilove-pdf-image-block:hover .ilove-pdf-image-badge {
  display: flex;
}

.image-badge-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border-radius: 4px;
}

.image-badge-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.image-badge-btn.btn-remove:hover {
  background: #dc2626;
}

.stats-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #475569;
}

.stat-row strong {
  color: #0f172a;
  font-weight: 800;
}

/* Big Red Button matching iLovePDF */
.btn-ilove-action {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 900;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(225, 29, 72, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: auto;
}

.btn-ilove-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(225, 29, 72, 0.45);
}

.secondary-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.btn-panel-sec {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-panel-sec:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
}

/* ==========================================================================
   5. PLACED ELEMENTS & 8-HANDLE TRANSFORMS
   ========================================================================== */
.placed-element {
  position: absolute;
  user-select: none;
  cursor: move;
  box-sizing: border-box;
  z-index: 20;
}

.placed-element.selected {
  outline: 1.5px solid var(--ilove-red);
}

/* Placed Text Content */
.placed-text-content {
  width: 100%;
  height: 100%;
  outline: none;
  padding: 2px 6px;
  word-break: break-word;
  white-space: pre-wrap;
  cursor: text;
  box-sizing: border-box;
  line-height: 1.25;
}

/* Placed Image */
.placed-image-content {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  pointer-events: none;
}

/* Placed Whiteout */
.placed-whiteout-content {
  width: 100%;
  height: 100%;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* 8 Transform Handles */
.transform-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #ffffff;
  border: 1.5px solid var(--ilove-red);
  border-radius: 2px;
  z-index: 40;
}

.handle-tl { top: -5px; left: -5px; cursor: nwse-resize; }
.handle-tr { top: -5px; right: -5px; cursor: nesw-resize; }
.handle-bl { bottom: -5px; left: -5px; cursor: nesw-resize; }
.handle-br { bottom: -5px; right: -5px; cursor: nwse-resize; }
.handle-tm { top: -5px; left: calc(50% - 4.5px); cursor: ns-resize; }
.handle-bm { bottom: -5px; left: calc(50% - 4.5px); cursor: ns-resize; }
.handle-ml { top: calc(50% - 4.5px); left: -5px; cursor: ew-resize; }
.handle-mr { top: calc(50% - 4.5px); right: -5px; cursor: ew-resize; }

/* Rotation Pin & Connector Line */
.rotate-handle-line {
  position: absolute;
  top: -24px;
  left: 50%;
  width: 1px;
  height: 24px;
  background: var(--ilove-red);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 38;
}

.rotate-handle {
  position: absolute;
  top: -30px;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--ilove-red);
  transform: translateX(-50%);
  cursor: grab;
  z-index: 40;
}

.rotate-handle:active {
  cursor: grabbing;
  background: var(--ilove-red);
}

/* Quick Delete Button */
.delete-quick-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e11d48;
  color: #ffffff;
  border: 1.5px solid #ffffff;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 50;
  transition: transform 0.15s ease;
}

.delete-quick-btn:hover {
  transform: scale(1.15);
  background: #be123c;
}

/* ==========================================================================
   6. SIGNATURE MODAL & OVERLAY
   ========================================================================== */
.editor-modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(15, 23, 42, 0.82) !important;
  backdrop-filter: blur(8px) !important;
  display: flex;
  align-items: center !important;
  justify-content: center !important;
  z-index: 2147483647 !important;
  padding: 16px !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
}

.editor-modal-overlay[style*="display: none"],
.editor-modal-overlay[style*="display:none"] {
  display: none !important;
}

.editor-modal-card {
  position: relative !important;
  z-index: 2147483647 !important;
  background: #ffffff !important;
  border-radius: 16px !important;
  width: 100% !important;
  max-width: 540px !important;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.45) !important;
  margin: auto !important;
  box-sizing: border-box !important;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes modalPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

.modal-close-btn {
  border: none;
  background: transparent;
  font-size: 1.25rem;
  color: #94a3b8;
  cursor: pointer;
}

.modal-close-btn:hover {
  color: #0f172a;
}

.modal-body {
  padding: 20px;
}

.sign-color-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.sig-color-btn {
  padding: 5px 14px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: var(--sig-c);
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
}

.sig-color-btn.active {
  border-color: var(--sig-c);
  background: var(--sig-c);
  color: #ffffff;
}

.sign-canvas-box {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  position: relative;
  overflow: hidden;
}

.sign-canvas-box canvas {
  width: 100%;
  height: 180px;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.sign-baseline {
  position: absolute;
  bottom: 35px;
  left: 20px;
  right: 20px;
  height: 1px;
  background: #e2e8f0;
  pointer-events: none;
}

.modal-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-modal-sec {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-weight: 750;
  font-size: 0.82rem;
  color: #475569;
  cursor: pointer;
}

.btn-modal-prim {
  padding: 7px 18px;
  border-radius: 8px;
  border: none;
  background: var(--ilove-red);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.3);
}

/* ==========================================================================
   7. PROCESSING OVERLAY WITH SPINNER & DOWNLOAD READY MODAL
   ========================================================================== */
.processing-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000000;
}

.processing-spinner-box {
  background: #ffffff;
  padding: 2.5rem 3rem;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  max-width: 480px;
  width: 90%;
}

.pro-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #fecdd3;
  border-top-color: var(--ilove-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Download Ready Card */
.download-ready-card {
  background: #ffffff;
  padding: 3rem 2.5rem;
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.25);
  max-width: 540px;
  width: 92%;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.download-ready-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 1.25rem auto;
  box-shadow: 0 8px 20px rgba(5, 150, 105, 0.2);
}

.download-ready-title {
  font-size: 1.75rem;
  font-weight: 900;
  color: #0f172a;
  margin: 0 0 0.5rem 0;
}

.download-ready-sub {
  font-size: 0.95rem;
  color: #64748b;
  margin: 0 0 1.75rem 0;
}

.btn-big-download {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
  padding: 1.1rem 2.5rem;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(225, 29, 72, 0.38);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-big-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(225, 29, 72, 0.48);
}

.download-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 1.25rem;
}

.btn-download-action {
  padding: 10px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-download-action:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

/* ==========================================================================
   8. RESPONSIVE BREAKPOINTS (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 991px) {
  .ilove-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -190px;
    transition: left 0.25s ease;
    box-shadow: 10px 0 25px rgba(0, 0, 0, 0.1);
    z-index: 150;
  }

  .ilove-sidebar.open {
    left: 0;
  }

  .ilove-action-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    border-left: none;
    border-top: 1px solid #e2e8f0;
    padding: 8px 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    background: #ffffff;
    z-index: 140;
  }

  .action-panel-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .action-panel-icon,
  .action-panel-title,
  .action-panel-sub,
  .stats-box {
    display: none;
  }

  .btn-ilove-action {
    margin-top: 0;
    padding: 0.6rem 1rem;
    font-size: 0.88rem;
    flex: 1;
  }

  .hide-mobile {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .ilove-top-bar {
    padding: 4px 8px;
    min-height: 44px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .file-name-label {
    max-width: 90px;
    font-size: 0.75rem;
  }

  .tool-tab-btn {
    padding: 4px 8px;
    font-size: 0.74rem;
  }

  .ilove-context-bar {
    padding: 4px 8px;
    min-height: 38px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ilove-workspace {
    height: calc(100vh - 120px);
  }

  .ilove-editor-main {
    height: calc(100% - 82px);
    padding-bottom: 54px;
  }

  .ilove-stage-wrapper {
    padding: 8px 4px;
  }

  .upload-dropzone-box {
    padding: 2rem 1rem;
  }

  .btn-ilove-upload {
    font-size: 1.05rem;
    padding: 0.9rem 1.8rem;
  }

  .modal-overlay {
    padding: 8px;
  }

  .modal-content-box {
    max-width: 100% !important;
    max-height: 94vh;
    border-radius: 12px;
  }
}

@media (max-width: 480px) {
  .top-left-actions .top-bar-btn span,
  .top-right-actions .top-bar-btn span {
    display: none;
  }

  .top-bar-btn {
    padding: 5px 8px;
  }

  .icon-tool-btn {
    width: 28px;
    height: 28px;
  }

  .zoom-level-text {
    min-width: 32px;
    font-size: 0.72rem;
  }
}

