* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f7f8ff;
  --card: #ffffff;
  --text: #161b33;
  --muted: #727b91;
  --muted-2: #8a91a5;
  --border: #ececff;
  --primary: #6958ff;
  --primary-2: #836dff;
  --primary-soft: #f3f1ff;
  --success: #11b56d;
  --danger: #ff5d5d;
}

body {
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top, rgba(105, 88, 255, 0.08), transparent 35%),
    var(--bg);
  color: var(--text);
  padding: 26px;
  overflow-x: hidden;
}

.container {
  max-width: 1400px;
  margin: 0 auto; /* Centered horizontally */
}

.top {
  margin-bottom: 15px;
}

.title {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.icon-box {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);

  flex: 0 0 auto;
}

.icon-box i {
  font-size: 54px;
}

h1 {
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 800;
  letter-spacing: -2px;
  margin-bottom: 0px !important;
}

.desc {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.9;
  font-size: 15px;
  margin-top: 0px;
}

.features {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.features {
  display: flex;
  gap: 15px;
  margin-top: 10px;
  flex-wrap: wrap;
  margin-left: -15px;
}

.feature {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: #f7f8ff;
  font-size: 13px;
  font-weight: 500;
  color: #5d6478;
}

.feature i {
  font-size: 13px;
  border: 7px solid #fff;
  border-radius: 50%;
  background: #fff;
}

.feature:nth-child(1) i {
  color: #6958ff;
}
.feature:nth-child(2) i {
  color: #6958ff;
}
.feature:nth-child(3) i {
  color: #6958ff;
}
.feature:nth-child(4) i {
  color: #6958ff;
}
.tool-box {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 34px;
  padding: 30px;
  box-shadow: 0 16px 40px rgba(99, 91, 255, 0.06);
  height: auto;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.sub {
  font-size: 14px;
  color: var(--muted-2);
  margin-bottom: 28px;
  line-height: 1.8;
}

.editor-layout {
  display: grid;
  grid-template-columns: 82px 1fr 320px;
  gap: 22px;
  align-items: stretch;
  height: 920px;
}

/* ========================= TOOLBAR ========================= */
.tools-bar {
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tools-bar::-webkit-scrollbar {
  display: none;
}

.tool-btn {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  border: none;
  background: #f6f7ff;
  color: #606984;
  font-size: 18px;
  cursor: pointer;
  transition: 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.tool-btn:hover,
.tool-btn.active {
  background: linear-gradient(to bottom, var(--primary-2), var(--primary));
  color: white;
  box-shadow: 0 14px 24px rgba(99, 91, 255, 0.25);
}

.tool-btn .tool-tip {
  position: absolute;
  left: 64px;
  background: var(--text);
  color: white;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: 0.2s;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tool-btn:hover .tool-tip {
  opacity: 1;
  left: 68px;
}

.tool-sep {
  width: 70%;
  border-top: 1px solid var(--border);
  margin: 4px 0;
  flex-shrink: 0;
}

/* ========================= EDITOR PANEL ========================= */
.editor-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.editor-top {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
  background: #ffffff;
}

.editor-title {
  font-size: 18px;
  font-weight: 800;
}

.editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.nav-btn {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f5f6ff;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
  color: #5d6478;
  font-size: 12px;
  font-family: inherit;
  transition: 0.15s;
}

.nav-btn:hover {
  background: #ececff;
}

.page-indicator {
  padding-top: 11px;
  font-size: 12px;
  font-weight: 700;
  color: #5d6478;
  cursor: auto;
  border: none;
  background: transparent;
}

.b {
  display: flex;
}

.small-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f5f6ff;
  color: #5d6478;
  cursor: pointer;
  font-size: 13px;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.small-btn:hover {
  background: #ececff;
}

/* ========================= TOOL OPTIONS BAR ========================= */
.tool-options-bar {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: #fcfcff;
  display: none;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 50px;
  font-size: 12px;
  flex-shrink: 0;
}

.tool-options-bar.visible {
  display: flex;
}

.opt-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.opt-group label {
  font-weight: 700;
  color: #50596d;
  font-size: 11px;
  white-space: nowrap;
}

.tool-options-bar select,
.tool-options-bar input[type="number"] {
  height: 32px;
  border-radius: 8px;
  border: 1px solid #dde1ef;
  padding: 0 8px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
  background: white;
  color: var(--text);
}

.tool-options-bar input[type="color"] {
  width: 32px;
  height: 32px;
  border: 2px solid #dde1ef;
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: white;
}

.opt-btn {
  height: 32px;
  border-radius: 8px;
  border: 1px solid #dde1ef;
  background: white;
  padding: 0 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #50596d;
  transition: 0.15s;
}

.opt-btn:hover {
  background: #f3f1ff;
  border-color: #6958ff;
  color: #6958ff;
}

.opt-btn.active-toggle {
  background: #6958ff;
  color: white;
  border-color: #6958ff;
}

.opt-btn.active-toggle i {
  color: white;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: 0.15s;
}

.color-swatch:hover,
.color-swatch.active {
  border-color: var(--text);
  transform: scale(1.1);
}

.opt-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 2px;
}

/* ========================= PREVIEW & PDF ========================= */
.preview-wrap {
  background: linear-gradient(180deg, #eef0ff, #e0e4f7);
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.pdf-page {
  width: 100%;
  max-width: 650px;
  background: white;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  position: relative;
  transform-origin: top center;
  max-height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

#pdfCanvas {
  display: block;
  width: 100%;
  height: auto;
  background: white;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.placeholder-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 800px;
  width: 100%;
  padding: 40px;
  color: #8a91a5;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.placeholder-state i {
  font-size: 60px;
  margin-bottom: 20px;
  color: #d7d2ff;
}

#watermarkOverlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  font-size: 100px;
  font-weight: 900;
  color: rgba(0, 0, 0, 0.05);
  pointer-events: none;
  z-index: 1;
  white-space: nowrap;
  display: none;
  user-select: none;
}

/* ========================= SETTINGS PANEL ========================= */
.settings-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.settings-panel::-webkit-scrollbar {
  display: none;
}

.settings-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 18px;
}

.setting {
  margin-bottom: 14px;
}

.setting label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #50596d;
}

.setting select,
.setting input {
  width: 100%;
  height: 46px;
  border-radius: 14px;
  border: 1px solid #dde1ef;
  background: white;
  padding: 0 12px;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  transition: 0.15s;
}

.setting select:focus,
.setting input:focus {
  border-color: #6958ff;
  box-shadow: 0 0 0 3px rgba(105, 88, 255, 0.1);
}

.option-box {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}

.option-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.option-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #f3f1ff;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.option-box h4 {
  font-size: 13px;
  margin-bottom: 2px;
}

.option-box p {
  font-size: 11px;
  color: #7f8799;
  line-height: 1.4;
  margin: 5px 0 0px;
}

.switch {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.switch label {
  font-size: 12px;
  font-weight: 600;
}

.switch input {
  width: 16px;
  height: 16px;
  accent-color: #6958ff;
}

.export-btn {
  width: 100%;
  height: 58px;
  padding: 15px;
  border: none;
  border-radius: 18px;
  margin-top: 18px;
  background: linear-gradient(to right, var(--primary), var(--primary-2));
  color: white;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 18px 35px rgba(99, 91, 255, 0.24);
  font-family: inherit;
}

.export-btn:hover {
  opacity: 0.92;
}

.export-btn i {
  margin-right: 8px;
}

/* ========================= UPLOAD & SIGNATURES ========================= */
.upload-area-wrap {
  margin-bottom: 28px;
}

.drop {
  border: 2px dashed #d7d2ff;
  border-radius: 24px;
  background: linear-gradient(180deg, #fcfcff, #f7f8ff);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  transition: 0.3s ease;
  cursor: pointer;
}

.drop.dragover {
  border-color: #6958ff;
  background: #f4f2ff;
}

.upload-circle {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(to bottom, #836dff, #6958ff);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto auto 16px;
  font-size: 28px;
  box-shadow: 0 14px 30px rgba(105, 88, 255, 0.25);
}

.drop h2 {
  font-size: 22px;
  margin-bottom: 10px;
}

.drop p {
  max-width: 500px;
  margin: auto;
  line-height: 1.6;
  color: #7c859a;
  font-size: 13px;
}

.browse-btn {
  height: 48px;
  padding: 0 24px;
  border: none;
  border-radius: 14px;
  margin-top: 20px;
  background: linear-gradient(to right, #6958ff, #836dff);
  color: white;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}

.files {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.file-item {
  background: white;
  border: 1px solid #ececff;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.file-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #f3f1ff;
  color: #6958ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.file-name {
  font-size: 13px;
  font-weight: 700;
}

.file-size {
  font-size: 11px;
  color: #8a91a5;
  margin-top: 2px;
}

.remove-file {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: #fff0f0;
  color: #ff5d5d;
  cursor: pointer;
  font-size: 14px;
}

.sig-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

.sig-modal-overlay.visible {
  display: flex;
}

.sig-modal {
  background: white;
  border-radius: 20px;
  padding: 28px;
  width: 500px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
}

.sig-modal h3 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 16px;
}

.sig-modal .sig-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.sig-modal .sig-tab {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
}

.sig-modal .sig-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.sig-modal .sig-type-area input {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #dde1ef;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
  font-family: inherit;
  color: var(--text);
  background: white;
}

.sig-modal .sig-fonts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.sig-modal .sig-font-opt {
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  text-align: center;
  background: white;
}

.sig-modal .sig-font-opt.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.sig-modal .sig-preview {
  height: 80px;
  border-radius: 12px;
  border: 1px dashed #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: #fafafa;
}

.sig-modal .sig-canvas-wrap canvas {
  width: 100%;
  height: 140px;
  border-radius: 12px;
  border: 2px solid #dde1ef;
  cursor: crosshair;
  background: white;
  margin-bottom: 12px;
}

.sig-modal .sig-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.sig-modal .sig-actions button {
  padding: 10px 20px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.sig-modal .sig-cancel {
  background: #f0f0f5;
  color: #666;
}

.sig-modal .sig-place {
  background: var(--primary);
  color: white;
}

/* ========================= EDITOR ELEMENTS ========================= */
.editor-el {
  position: absolute;
  cursor: move;
  user-select: none;
  min-width: 20px;
  min-height: 20px;
  box-sizing: border-box;
  overflow: visible !important;
  touch-action: none;
}

.editor-el.selected {
  z-index: 100;
  outline: 1px solid #4a86e8 !important;
  outline-offset: 0;
}

.editor-el .resize-handle {
  position: absolute;
  width: 11px !important;
  height: 11px !important;
  background: #ffffff;
  border: 1.5px solid #6f6f6f;
  border-radius: 50%;
  box-sizing: border-box;
  z-index: 99999;
  pointer-events: all;
  display: none;
}

.editor-el.selected .resize-handle {
  display: block;
}

.rh-tl {
  top: -5px !important;
  left: -5px !important;
  cursor: nwse-resize;
}

.rh-tc {
  left: 50%;
  top: -6px !important;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.rh-tr {
  top: -5px !important;
  right: -5px !important;
  cursor: nesw-resize;
}

.rh-ml {
  top: 50%;
  left: -6px !important;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.rh-mr {
  top: 50%;
  right: -6px !important;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.rh-bl {
  bottom: -5px !important;
  left: -5px !important;
  cursor: nesw-resize;
}

.rh-bc {
  bottom: -6px !important;
  right: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.rh-br {
  bottom: -5px !important;
  right: -5px !important;
  cursor: nwse-resize;
}

.rh-rotate-container {
  position: absolute;
  top: -38px;
  left: 50%;
  width: 24px;
  height: 34px;
  transform: translateX(-50%);
  background: transparent !important;
  border: none !important;
  pointer-events: all;
  cursor: grab;
  z-index: 100000;
  display: none;
}

.editor-el.selected .rh-rotate-container {
  display: block;
  pointer-events: auto;
}

.rh-rotate-line {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 2px;
  height: 12px;
  background: #7a7a7a;
  transform: translateX(-50%);
}

.rh-rotate-icon {
  position: absolute;
  top: 0;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #6f6f6f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #666666;
  box-sizing: border-box;
}

.el-delete {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: #f44336;
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px !important;
  cursor: pointer;
  z-index: 100001;
  padding: 0;
  pointer-events: auto;
}

.editor-el.selected .el-delete {
  display: flex;
}

.editor-el.quick-resizing .resize-handle,
.editor-el.quick-resizing .rh-rotate-container,
.editor-el.quick-resizing .el-delete {
  display: none !important;
}

.rh-tc:hover,
.rh-bc:hover,
.rh-rotate-icon:hover {
  transform: translateX(-50%) scale(1.05);
}

.rh-ml:hover,
.rh-mr:hover {
  transform: translateY(-50%) scale(1.05);
}

.el-line.selected {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
}

.editor-el.el-text {
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.editor-el.el-text:hover {
  border-color: #ddd;
}

.editor-el.el-text .text-content {
  width: 100%;
  height: 100%;
  outline: none;
  overflow: hidden;
  padding: 4px 6px;
  word-wrap: break-word;
  white-space: pre-wrap;
  cursor: text;
}

.text-content.placeholder-active:empty::before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
  font-style: italic;
  opacity: 0.6;
}

.text-content:focus {
  outline: none;
}

.editor-el.el-image {
  border: 1px dashed transparent;
  overflow: hidden;
  background: #f0f0f0;
}

.editor-el.el-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.editor-el.el-highlight {
  border-radius: 2px;
  opacity: 0.6;
}

.editor-el.el-signature {
  border: 1px dashed #bbb;
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.editor-el.el-signature .sig-text {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.editor-el.el-signature .sig-drawn {
  width: 100%;
  height: 100%;
}

.editor-el.el-signature .sig-drawn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.editor-el.el-shape {
  overflow: visible;
}

.editor-el.el-comment {
  background: #fffde7;
  border: 1px solid #e0d89a;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.editor-el.el-comment .comment-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(105, 88, 255, 0.08);
  border-radius: 5px 5px 0 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
}

.editor-el.el-comment .comment-body {
  padding: 6px 8px;
  outline: none;
  font-size: 11px;
  line-height: 1.4;
  min-height: 30px;
  color: var(--text);
  cursor: text;
}

.editor-el.el-draw img {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.zoom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #f5f5ff;
  border-radius: 10px;
  padding: 4px;
  border: 1px solid #ececff;
}

.zoom-controls button {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5d6478;
  font-size: 14px;
  transition: all 0.15s ease;
}

.zoom-controls button:hover {
  background: #6958ff;
  color: white;
  transform: scale(1.05);
}

.zoom-controls button:active {
  transform: scale(0.95);
}

.zoom-controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.zoom-level {
  min-width: 52px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #161b33;
  user-select: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

.zoom-level:hover {
  background: rgba(105, 88, 255, 0.1);
}

.zoom-fit-btn {
  margin-left: 8px !important;
  border-left: 1px solid #ececff !important;
  text-align: center;
}

#zoomInBtn {
  margin-right: -8px !important;
}

/* ==============================================
   LARGE SCREENS — starts at 1200px
=============================================== */

@media (min-width: 1200px) {
  body {
    padding: 30px 3vw;
  }

  .page-container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .container {
    max-width: 94vw !important;
    width: 94vw !important;
  }
}

/* ——— 1440 px ——— */
@media (min-width: 1440px) {
  body {
    padding: 36px 3vw;
  }

  h1 {
    font-size: 56px;
  }

  .desc {
    font-size: 16px;
  }

  .icon-box {
    width: 108px;
    height: 108px;
    border-radius: 24px;
  }

  .icon-box i {
    font-size: 60px;
  }

  .feature {
    font-size: 14px;
    padding: 13px 18px;
  }

  .tool-box {
    padding: 36px;
    border-radius: 36px;
  }

  .editor-layout {
    grid-template-columns: 88px 1fr 340px;
    gap: 26px;
  }

  .tool-btn {
    width: 58px;
    height: 58px;
    font-size: 20px;
  }

  .settings-panel {
    padding: 28px;
  }

  .settings-title {
    font-size: 20px;
  }

  .setting select,
  .setting input {
    height: 50px;
    font-size: 14px;
  }

  .export-btn {
    height: 62px;
    font-size: 16px;
  }
}

/* ——— 1600 px ——— */
@media (min-width: 1600px) {
  body {
    padding: 38px 3vw;
  }

  h1 {
    font-size: 62px;
  }

  .desc {
    font-size: 17px;
  }

  .icon-box {
    width: 116px;
    height: 116px;
  }

  .icon-box i {
    font-size: 66px;
  }

  .editor-layout {
    grid-template-columns: 92px 1fr 360px;
  }

  .tool-btn {
    width: 62px;
    height: 62px;
  }

  .setting select,
  .setting input {
    height: 54px;
  }

  .export-btn {
    height: 66px;
    font-size: 17px;
  }
}

/* ——— 1920 px ——— */
@media (min-width: 1920px) {
  body {
    padding: 42px 3vw;
  }

  h1 {
    font-size: 72px;
  }

  .desc {
    max-width: 56vw;
    font-size: 18px;
    line-height: 1.8;
  }

  .top {
    margin-bottom: 40px;
  }

  .title {
    gap: 24px;
    margin-bottom: 20px;
  }

  .icon-box {
    width: 132px;
    height: 132px;
    border-radius: 30px;
  }

  .icon-box i {
    font-size: 78px;
  }

  .features {
    gap: 20px;
    margin-top: 24px;
  }

  .feature {
    font-size: 16px;
    padding: 15px 22px;
    gap: 10px;
  }

  .tool-box {
    padding: 44px;
    border-radius: 40px;
  }

  .editor-layout {
    grid-template-columns: 100px 1fr 400px;
    gap: 30px;
    height: 1050px;
  }

  .tool-btn {
    width: 68px;
    height: 68px;
    font-size: 22px;
    border-radius: 18px;
  }

  .editor-top {
    padding: 20px 28px;
  }

  .editor-title {
    font-size: 22px;
  }

  .nav-btn,
  .small-btn {
    height: 44px;
    font-size: 14px;
  }

  .settings-panel {
    padding: 34px;
    border-radius: 32px;
  }

  .settings-title {
    font-size: 24px;
    margin-bottom: 24px;
  }

  .setting select,
  .setting input {
    height: 60px;
    font-size: 15px;
    border-radius: 16px;
  }

  .option-icon {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  .export-btn {
    height: 72px;
    font-size: 19px;
    border-radius: 20px;
  }
}

/* ——— 2560 px ——— */
@media (min-width: 2560px) {
  body {
    padding: 52px 3vw;
  }

  h1 {
    font-size: 90px;
  }

  .desc {
    max-width: 52vw;
    font-size: 22px;
  }

  .top {
    margin-bottom: 56px;
  }

  .title {
    gap: 30px;
  }

  .icon-box {
    width: 170px;
    height: 170px;
    border-radius: 38px;
  }

  .icon-box i {
    font-size: 100px;
  }

  .features {
    gap: 26px;
    margin-top: 28px;
  }

  .feature {
    font-size: 20px;
    padding: 18px 28px;
    gap: 14px;
  }

  .tool-box {
    padding: 60px;
    border-radius: 48px;
  }

  .editor-layout {
    grid-template-columns: 120px 1fr 480px;
    gap: 38px;
    height: 1300px;
  }

  .tool-btn {
    width: 84px;
    height: 84px;
    font-size: 28px;
    border-radius: 22px;
  }

  .editor-top {
    padding: 26px 36px;
  }

  .editor-title {
    font-size: 28px;
  }

  .nav-btn,
  .small-btn {
    height: 54px;
    width: 54px;
    font-size: 18px;
  }

  .settings-panel {
    padding: 48px;
    border-radius: 38px;
  }

  .settings-title {
    font-size: 30px;
  }

  .setting select,
  .setting input {
    height: 74px;
    font-size: 19px;
    border-radius: 18px;
  }

  .option-icon {
    width: 56px;
    height: 56px;
    font-size: 20px;
  }

  .export-btn {
    height: 90px;
    font-size: 24px;
    border-radius: 24px;
  }
}

/* =========================
   EXISTING RESPONSIVE (small/medium screens)
========================= */

@media (max-width: 1150px) {
  .editor-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .tools-bar {
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
    gap: 8px;
  }

  .tool-btn {
    width: 48px;
    height: 48px;
  }

  .tool-btn .tool-tip {
    display: none !important;
  }

  .tool-sep {
    width: 1px;
    height: 70%;
    border-left: 1px solid var(--border);
    border-top: none;
    margin: 0 4px;
  }

  .tool-box {
    height: auto;
    min-height: unset;
  }

  .settings-panel {
    position: static !important;
  }
}

@media (max-width: 768px) {
  body {
    padding: 15px;
  }
  .main-card {
    padding: 20px;
  }
  h1 {
    font-size: 34px;
  }
  .drop h2 {
    font-size: 20px;
  }
  .title {
    margin-bottom: 0px !important;
  }
}

@media (max-width: 768px) {
  .tool-box {
    border-radius: 20px;
  }

  .editor-layout {
    gap: 16px;
  }

  .editor-panel {
    min-height: 500px;
    border-radius: 20px;
  }

  .editor-top {
    padding: 12px 16px;
  }

  .settings-panel {
    border-radius: 20px;
    padding: 16px;
  }

  .upload-circle {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .drop h2 {
    font-size: 18px;
  }

  .sig-modal {
    padding: 20px;
    border-radius: 16px;
  }

  body {
    padding: 15px;
  }
  .main-card {
    padding: 20px;
  }
  h1 {
    font-size: 34px;
  }
  .drop h2 {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 28px;
  }

  .editor-actions {
    width: 100%;
    justify-content: space-between;
  }

  .tool-options-bar {
    padding: 8px 12px;
    gap: 8px;
  }

  .opt-group {
    flex-wrap: wrap;
  }
}

/* =========================
   MOBILE BREAKPOINTS
========================= */

@media (max-width: 425px) {
  body {
    padding: 8px;
    font-size: 13px;
  }

  h1 {
    font-size: 26px;
    letter-spacing: -1px;
  }

  .desc {
    font-size: 13px;
    line-height: 1.6;
  }

  .section-title,
  .settings-title {
    font-size: 16px;
  }

  .sub {
    font-size: 12px;
  }

  .feature {
    font-size: 11px;
    padding: 6px 8px;
    gap: 5px;
  }

  .tool-box {
    padding: 14px;
    border-radius: 18px;
  }

  .editor-layout {
    gap: 12px;
  }

  .tool-btn {
    width: 42px;
    height: 42px;
    font-size: 16px;
  }

  .editor-panel {
    border-radius: 18px;
  }

  .settings-panel {
    padding: 14px;
    border-radius: 18px;
  }

  .setting select,
  .setting input {
    height: 42px;
    font-size: 13px;
  }

  .export-btn {
    height: 48px;
    font-size: 14px;
  }

  .drop {
    min-height: 180px;
    padding: 20px;
  }

  .browse-btn {
    height: 42px;
    font-size: 13px;
  }
}

@media (max-width: 375px) {
  body {
    padding: 6px;
    font-size: 12.5px;
  }

  h1 {
    font-size: 23px;
  }

  .desc {
    font-size: 12px;
  }

  .section-title,
  .settings-title {
    font-size: 15px;
  }

  .feature {
    font-size: 10.5px;
    padding: 5px 6px;
  }

  .tool-box {
    padding: 12px;
    border-radius: 16px;
  }

  .tool-btn {
    width: 38px;
    height: 38px;
    font-size: 14px;
    border-radius: 10px;
  }

  .setting select,
  .setting input {
    height: 40px;
    font-size: 12.5px;
  }

  .export-btn {
    height: 46px;
    font-size: 13px;
  }

  .drop h2 {
    font-size: 18px;
  }
}

@media (max-width: 325px) {
  body {
    padding: 6px;
    font-size: 12px;
  }

  h1 {
    font-size: 21px;
  }

  .desc {
    font-size: 11.5px;
  }

  .section-title,
  .settings-title {
    font-size: 14px;
  }

  .feature {
    font-size: 10px;
    gap: 4px;
  }

  .tool-box {
    padding: 10px;
    border-radius: 14px;
  }

  .tool-btn {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .editor-top {
    padding: 10px 12px;
  }

  .nav-btn,
  .small-btn {
    height: 32px;
    font-size: 10px;
  }

  .settings-panel {
    padding: 10px;
    border-radius: 14px;
  }

  .setting select,
  .setting input {
    height: 38px;
    font-size: 12px;
  }

  .export-btn {
    height: 42px;
    font-size: 12px;
    border-radius: 12px;
  }

  .drop {
    min-height: 160px;
    padding: 14px;
  }

  .upload-circle {
    width: 46px;
    height: 46px;
    font-size: 18px;
  }

  .browse-btn {
    height: 40px;
    font-size: 12px;
  }
}

/* =========================
   DARK MODE
========================= */

body.dark {
  color-scheme: dark;
  --bg: #0b1020;
  --card: #11172a;
  --card-2: #0f1628;
  --text: #edf2ff;
  --muted: #a7b0ca;
  --muted-2: #8d97b4;
  --border: #24304a;
  --primary: #8b7bff;
  --primary-2: #a18fff;
  --primary-soft: #1a2140;
  --success: #32d583;
  --danger: #ff6b6b;
  --overlay: rgba(0, 0, 0, 0.45);
}

body.dark {
  background:
    radial-gradient(circle at top, rgba(139, 123, 255, 0.12), transparent 35%),
    var(--bg);
  color: var(--text);
}

/* Main Cards & Containers */
body.dark .tool-box,
body.dark .editor-panel,
body.dark .settings-panel,
body.dark .sig-modal {
  background: rgba(17, 23, 42, 0.96);
  border-color: var(--border);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.28);
}

body.dark .preview-wrap {
  background: rgb(42 53 80);
}

/* Text Elements */
body.dark h1,
body.dark h2,
body.dark h3,
body.dark h4,
body.dark .section-title,
body.dark .settings-title,
body.dark .editor-title,
body.dark .option-top h4,
body.dark .sig-font-opt {
  color: var(--text);
}

body.dark .desc,
body.dark .sub,
body.dark .option-top p,
body.dark .setting label,
body.dark .switch label,
body.dark .tool-tip,
body.dark .placeholder-state p,
body.dark .features .feature {
  color: var(--muted);
}

body.dark .sig-font-opt,
body.dark .sig-font-opt.active {
  background: #10182d;
  border: 1px solid var(--border) !important;
}

/* Features */
body.dark .feature {
  border-radius: 999px;
  background: transparent !important;
  border: 1px solid var(--border);
}

body.dark .feature i {
  color: var(--primary-2) !important;
  border-color: transparent !important;
  background: transparent !important;
}

/* Upload Area */
body.dark .drop {
  background: linear-gradient(180deg, #11172a, #0e1526);
  border-color: #2a3550;
}

body.dark .drop:hover,
body.dark .drop.drag-over {
  background: #131d33;
  border-color: var(--primary);
}

body.dark .upload-circle {
  background: linear-gradient(to bottom, var(--primary-2), var(--primary));
}

/* ZOOM CONTROLS */
body.dark .zoom-controls {
  background: #0f1628;
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

body.dark .zoom-controls button {
  background: #10182d;
  color: var(--muted);
  border: none;
}

body.dark .zoom-controls button:hover {
  background: rgba(139, 123, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(139, 123, 255, 0.22);
}

body.dark .zoom-controls button:active {
  transform: scale(0.96);
}

body.dark .zoom-level {
  background: rgba(139, 123, 255, 0.12);
  border: 1px solid rgba(139, 123, 255, 0.18);
  color: #ffffff;
}

body.dark .zoom-fit-btn {
  background: linear-gradient(to bottom, var(--primary-2), var(--primary));
  color: #ffffff;
  border: none;
  border-left: 1px solid rgba(139, 123, 255, 0.18) !important;
}

body.dark .zoom-fit-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 8px 22px rgba(139, 123, 255, 0.32);
}

/* TOOLBAR */
body.dark .tools-bar {
  background: #0f1628;
  border-color: var(--border);
}

body.dark .tool-btn {
  background: rgba(139, 123, 255, 0.08);
  color: var(--muted);
}

body.dark .tool-btn:hover,
body.dark .tool-btn.active {
  background: linear-gradient(to bottom, var(--primary-2), var(--primary));
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(139, 123, 255, 0.3);
}

body.dark .tool-sep {
  border-color: var(--border);
}

/* EDITOR TOP & OPTIONS */
body.dark .editor-top {
  border-color: var(--border);
  background: #11172a;
}

body.dark .nav-btn,
body.dark .small-btn {
  background: #10182d;
  color: var(--text);
  border-color: var(--border);
}

body.dark .nav-btn:hover,
body.dark .small-btn:hover {
  background: rgba(139, 123, 255, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

body.dark .page-indicator {
  color: var(--muted);
  background: transparent;
  border: none;
}

/* Tool Options Bar */
body.dark .tool-options-bar {
  background: #0f1628;
  border-color: var(--border);
}

body.dark .opt-group label {
  color: var(--muted);
}

body.dark .opt-btn {
  background: #10182d;
  color: var(--text);
  border-color: var(--border);
}

body.dark .opt-btn:hover,
body.dark .opt-btn.active-toggle {
  background: rgba(139, 123, 255, 0.15);
  border-color: var(--primary);
  color: #ffffff;
}

body.dark .tool-options-bar select,
body.dark .tool-options-bar input[type="number"] {
  background: #10182d;
  color: var(--text);
  border-color: var(--border);
}

body.dark .tool-options-bar input[type="color"] {
  background: #10182d;
  border-color: var(--border);
}

body.dark .color-swatch {
  border-color: var(--border);
}

body.dark .color-swatch:hover,
body.dark .color-swatch.active {
  border-color: #ffffff;
}

/* PREVIEW */
body.dark .pdf-page,
body.dark .canvas,
body.dark canvas {
  background: #ffffff;
}

body.dark .placeholder-state {
  background: #0f1628;
  color: var(--muted);
}

body.dark .placeholder-state i {
  color: var(--primary);
  opacity: 0.6;
}

body.dark #watermarkOverlay {
  color: rgba(255, 255, 255, 0.15);
}

/* SETTINGS */

body.dark .option-box,
body.dark .sig-type-area,
body.dark .sig-canvas-wrap {
  background: #10182d;
  border-color: var(--border);
}

body.dark .option-icon {
  background: rgba(139, 123, 255, 0.12);
  color: var(--primary);
}

body.dark input[type="text"],
body.dark select {
  background: #10182d;
  color: var(--text);
  border-color: var(--border);
}

body.dark input[type="text"]::placeholder {
  color: var(--muted-2);
}

body.dark input[type="text"]:focus,
body.dark select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(139, 123, 255, 0.14);
}

body.dark select option {
  background: #10182d;
  color: var(--text);
}

body.dark #watermarkText {
  background: #10182d !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* Buttons */
body.dark .browse-btn,
body.dark .export-btn {
  background: linear-gradient(to right, var(--primary), var(--primary-2));
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

/* Badges */
body.dark .badge,
body.dark .page-indicator,
body.dark .zoom-pill {
  background: rgba(139, 123, 255, 0.12);
  border-color: rgba(139, 123, 255, 0.18);
  color: #ffffff;
}

/* Upload file list */
body.dark .files .file-item,
body.dark .file-card {
  background: #10182d;
  border-color: var(--border);
}

body.dark .file-icon {
  background: rgba(139, 123, 255, 0.12);
  color: var(--primary);
}

body.dark .remove-file {
  background: rgba(255, 93, 93, 0.1);
  color: var(--danger);
}

/* Signature modal */
body.dark .sig-modal-overlay {
  background: rgba(0, 0, 0, 0.6);
}

body.dark .sig-modal {
  background: #11172a;
  border-color: var(--border);
}

body.dark .sig-tabs {
  background: #0f1628;
}

body.dark .sig-tab {
  color: var(--muted);
  border-color: var(--border);
  background: #10182d;
}

body.dark .sig-tab.active {
  background: #17213a;
  color: #ffffff;
  border-color: var(--primary);
}

body.dark .sig-preview {
  background: #0f1628;
  border-color: var(--border);
}

body.dark .sig-cancel {
  background: #10182d;
  color: var(--text);
  border-color: var(--border);
}

body.dark .sig-place {
  background: var(--primary);
  color: white;
}

body.dark .sig-type-area input {
  background: #10182d;
  border-color: var(--border);
  color: var(--text);
}

body.dark .sig-canvas-wrap canvas {
  background: #10182d;
  border-color: var(--border);
}

/* Editor Elements */
body.dark .editor-el.el-text {
  background: rgba(15, 22, 40, 0.9);
}

body.dark .editor-el.el-comment {
  background: #1a1f35;
  border-color: #3a3f55;
}

body.dark .editor-el.el-comment .comment-header {
  background: rgba(139, 123, 255, 0.15);
}

/* Scrollbar */
body.dark ::-webkit-scrollbar {
  width: 10px;
}

body.dark ::-webkit-scrollbar-track {
  background: #0f162a;
}

body.dark ::-webkit-scrollbar-thumb {
  background: #283552;
  border-radius: 999px;
}

body.dark ::-webkit-scrollbar-thumb:hover {
  background: #34456a;
}

/* Selection */
body.dark ::selection {
  background: rgba(139, 123, 255, 0.35);
  color: #ffffff;
}

@media (max-width: 600px) {
  .page-container {
    padding-left: 0px !important;
    padding-right: 0px !important;
    padding-top: 0px !important;
  }
}
