/* ================================================================
   WP PDF Editor Pro — Premium UI v2.0
   Design: Refined Dark Glass · Electric Indigo · Gold Accents
   Font: DM Sans (imported) · JetBrains Mono (code)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Scoped box-sizing ─────────────────────────────────────────────────────── */
.wp-pdf-editor-wrap *,
.wp-pdf-editor-wrap *::before,
.wp-pdf-editor-wrap *::after { box-sizing: border-box; margin: 0; }

/* ── Design Tokens ─────────────────────────────────────────────────────────── */
.wp-pdf-editor-wrap {
  /* Brand */
  --primary:        #6366f1;
  --primary-glow:   rgba(99,102,241,.35);
  --primary-light:  rgba(99,102,241,.12);
  --primary-dark:   #4f46e5;
  --gold:           #f59e0b;
  --gold-light:     rgba(245,158,11,.15);
  --success:        #10b981;
  --success-light:  rgba(16,185,129,.12);
  --danger:         #ef4444;
  --danger-light:   rgba(239,68,68,.12);

  /* Light Surface */
  --bg:             #f0f2f8;
  --surface:        #ffffff;
  --surface-2:      #f8f9fe;
  --border:         rgba(99,102,241,.15);
  --border-solid:   #e4e7f0;
  --text:           #0f1117;
  --text-2:         #374151;
  --muted:          #6b7280;
  --muted-light:    #9ca3af;

  /* Layout */
  --radius-sm:      6px;
  --radius:         12px;
  --radius-lg:      18px;
  --radius-xl:      24px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:         0 4px 20px rgba(99,102,241,.08), 0 2px 8px rgba(0,0,0,.06);
  --shadow-lg:      0 12px 40px rgba(99,102,241,.14), 0 4px 16px rgba(0,0,0,.08);
  --shadow-glow:    0 0 0 3px var(--primary-glow);

  /* Motion */
  --ease:           cubic-bezier(.4,0,.2,1);
  --spring:         cubic-bezier(.34,1.56,.64,1);
  --dur-fast:       140ms;
  --dur:            220ms;
  --dur-slow:       380ms;
}

/* ── Dark Theme ──────────────────────────────────────────────────────────────*/
.wp-pdf-editor-wrap.theme-dark {
  --bg:             #0b0d14;
  --surface:        #13161f;
  --surface-2:      #1a1e2b;
  --border:         rgba(99,102,241,.2);
  --border-solid:   rgba(255,255,255,.08);
  --text:           #f1f3ff;
  --text-2:         #c7cbde;
  --muted:          #7b82a0;
  --muted-light:    #5a6180;
  --shadow:         0 4px 24px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.04);
  --shadow-lg:      0 20px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(99,102,241,.15);
}

/* ── Wrapper ─────────────────────────────────────────────────────────────────*/
.wp-pdf-editor-wrap {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  min-height: 540px;
  position: relative;
  /* Subtle background texture */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--primary-light), transparent);
}

.theme-dark.wp-pdf-editor-wrap {
  background-image:
    radial-gradient(ellipse 70% 40% at 50% -10%, rgba(99,102,241,.08), transparent),
    radial-gradient(ellipse 50% 30% at 100% 100%, rgba(99,102,241,.04), transparent);
}

/* ── Branding Bar ────────────────────────────────────────────────────────────*/
.pdf-branding-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #818cf8 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.pdf-branding-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.pdf-brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.3px;
  position: relative;
}
.pdf-brand-tagline {
  font-size: 12px;
  opacity: .75;
  font-weight: 400;
  position: relative;
}
.pdf-brand-badge {
  margin-left: auto;
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: .8px;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.25);
  position: relative;
}

/* ── Promo Banner ────────────────────────────────────────────────────────────*/
.pdf-promo-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 24px;
  background: linear-gradient(90deg, #065f46 0%, #047857 50%, #059669 100%);
  color: #fff;
  font-size: 13px;
  animation: promo-in .4s var(--spring);
  position: relative;
  overflow: hidden;
}
.pdf-promo-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  animation: shimmer-move 2.5s ease infinite;
}
@keyframes promo-in { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes shimmer-move { 0%,100% { transform: translateX(-100%); } 50% { transform: translateX(100%); } }
.promo-badge-icon { font-size: 22px; flex-shrink: 0; animation: bounce-gentle .9s ease infinite alternate; }
@keyframes bounce-gentle { to { transform: scale(1.18) rotate(5deg); } }
.promo-text strong { font-weight: 700; font-size: 13.5px; }
.promo-text span   { font-size: 12px; opacity: .85; display: block; }
.promo-close {
  margin-left: auto; cursor: pointer; opacity: .6;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.1); flex-shrink: 0; font-size: 14px;
  transition: all var(--dur-fast) var(--ease);
}
.promo-close:hover { opacity: 1; background: rgba(255,255,255,.2); transform: scale(1.1); }

/* ── Tab Bar ─────────────────────────────────────────────────────────────────*/
.pdf-tab-bar {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border-solid);
  overflow-x: visible;
  scrollbar-width: none;
  padding: 6px 10px 8px;
  position: relative;
  flex-wrap: wrap;
  row-gap: 4px;
  column-gap: 4px;
}
.pdf-tab-bar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.pdf-tab-bar::-webkit-scrollbar { display: none; }

.pdf-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 14px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
  border-bottom: 2px solid transparent;
  margin-bottom: 0;
  flex-shrink: 0;
  position: relative;
}
.pdf-tab:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.pdf-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tab-icon { font-size: 15px; }
.pdf-tab.tab-locked { opacity: .65; }
.pdf-tab.tab-locked:hover { color: var(--gold); background: var(--gold-light); }

/* Pro badge on tab */
.pro-badge {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--gold), #d97706);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(245,158,11,.4);
}

/* ── Panels ──────────────────────────────────────────────────────────────────*/
.pdf-panel        { display: none; padding: 28px 32px; animation: panel-in var(--dur) var(--ease); }
.pdf-panel.active { display: block; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel-header      { margin-bottom: 24px; }
.panel-header h3   {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-header p    { color: var(--muted); font-size: 13.5px; font-weight: 400; }

/* ── Upload Zone ─────────────────────────────────────────────────────────────*/
.upload-zone {
  border: 2px dashed var(--border-solid);
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  background: var(--surface-2);
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.upload-zone::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), #818cf8, var(--primary));
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
  z-index: 0;
}
.upload-zone::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: calc(var(--radius-lg) - 2px);
  background: var(--surface-2);
  z-index: 0;
}
.upload-zone > * { position: relative; z-index: 1; }
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}
.upload-zone:hover::before,
.upload-zone.dragover::before { opacity: 1; }
.upload-zone:hover::after,
.upload-zone.dragover::after { background: var(--primary-light); }

.upload-icon {
  font-size: 44px;
  margin-bottom: 12px;
  display: block;
  filter: drop-shadow(0 4px 8px var(--primary-glow));
  transition: transform var(--dur) var(--spring);
}
.upload-zone:hover .upload-icon { transform: scale(1.1) translateY(-2px); }
.upload-zone p    { color: var(--text-2); font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.upload-zone span { color: var(--muted); font-size: 12px; display: block; margin: 8px 0; }

.pdf-utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-solid);
  flex-wrap: wrap;
}
.utility-group { display: flex; align-items: center; gap: 10px; }
.utility-field { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.utility-label { font-weight: 600; color: var(--text-2); }
.utility-select {
  padding: 6px 10px;
  border: 1.5px solid var(--border-solid);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-family: 'DM Sans', sans-serif;
}
.utility-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 600;
}
.theme-toggle input { display: none; }
.theme-slider {
  width: 40px;
  height: 22px;
  background: var(--border-solid);
  border-radius: 999px;
  position: relative;
  transition: background var(--dur-fast);
  box-shadow: inset 0 0 0 1px var(--border);
}
.theme-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur-fast);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.theme-toggle input:checked + .theme-slider { background: var(--primary); }
.theme-toggle input:checked + .theme-slider::before { transform: translateX(18px); }
.theme-text { font-size: 12.5px; }

/* ── Buttons ─────────────────────────────────────────────────────────────────*/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--dur-fast);
}
.btn:hover::after { background: rgba(255,255,255,.1); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow), 0 1px 3px rgba(0,0,0,.15);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px var(--primary-glow), 0 2px 6px rgba(0,0,0,.15);
  transform: translateY(-1px);
}
.btn-success {
  background: linear-gradient(135deg, #059669, var(--success));
  color: #fff;
  box-shadow: 0 4px 14px rgba(16,185,129,.3);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(16,185,129,.4); transform: translateY(-1px); }
.btn-download {
  border: 1px solid rgba(16,185,129,.45);
  box-shadow: 0 6px 18px rgba(16,185,129,.35);
  letter-spacing: .2px;
}
.btn-download:hover { box-shadow: 0 8px 22px rgba(16,185,129,.45); }
.btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-solid);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--primary); color: var(--primary); }
.btn.danger {
  background: linear-gradient(135deg, #dc2626, var(--danger));
  color: #fff;
  font-size: 12px;
  padding: 7px 14px;
  box-shadow: 0 3px 10px rgba(239,68,68,.3);
}

.action-bar { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* Upgrade button */
.btn-upgrade {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 32px;
  background: linear-gradient(135deg, #d97706, var(--gold), #f59e0b);
  color: #fff;
  border: none; border-radius: var(--radius-lg);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 700; cursor: pointer;
  text-decoration: none;
  box-shadow: 0 6px 24px rgba(245,158,11,.45), 0 2px 6px rgba(0,0,0,.12);
  transition: all var(--dur) var(--ease);
  animation: gold-pulse 2.5s ease infinite;
}
@keyframes gold-pulse {
  0%,100% { box-shadow: 0 6px 24px rgba(245,158,11,.45); }
  50%      { box-shadow: 0 8px 32px rgba(245,158,11,.65); }
}
.btn-upgrade:hover { transform: translateY(-2px) scale(1.02); color: #fff; }

/* ── File List ───────────────────────────────────────────────────────────────*/
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius);
  cursor: grab;
  transition: all var(--dur-fast) var(--ease);
  box-shadow: var(--shadow-sm);
}
.file-item:hover { border-color: var(--primary); box-shadow: var(--shadow), 0 0 0 1px var(--primary-light); }
.file-item:active { cursor: grabbing; transform: scale(.99); }
.file-drag-handle { color: var(--muted-light); font-size: 16px; cursor: grab; }
.file-name {
  flex: 1; font-size: 13px; font-weight: 500;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-size  { color: var(--muted); font-size: 11.5px; flex-shrink: 0; font-family: 'JetBrains Mono', monospace; }
.file-remove { background: none; border: none; cursor: pointer; color: var(--muted-light); font-size: 16px; line-height: 1; flex-shrink: 0; padding: 2px; border-radius: 4px; transition: all var(--dur-fast); }
.file-remove:hover { color: var(--danger); background: var(--danger-light); }

/* ── File Info Box ───────────────────────────────────────────────────────────*/
.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 12px;
  animation: panel-in var(--dur) var(--ease);
}
.file-info b { color: var(--primary); font-weight: 600; }
.file-info::before { content: '📄'; font-size: 20px; flex-shrink: 0; }

/* ── Split / Options ─────────────────────────────────────────────────────────*/
.split-options {
  background: var(--surface);
  border: 1px solid var(--border-solid);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-top: 14px;
  box-shadow: var(--shadow-sm);
}
.radio-group { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.radio-group label {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; cursor: pointer; color: var(--text-2);
  padding: 10px 14px; border: 1.5px solid var(--border-solid);
  border-radius: var(--radius); transition: all var(--dur-fast);
}
.radio-group label:hover { border-color: var(--primary); background: var(--primary-light); }
.radio-group label input[type=radio]:checked ~ span,
.radio-group label:has(input:checked) { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 500; }
.sub-option { margin-top: 10px; }
.sub-option small { color: var(--muted); font-size: 11.5px; margin-left: 6px; }

/* ── Generate Form ───────────────────────────────────────────────────────────*/
.generate-form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: flex; flex-direction: column; gap: 7px; }
.form-row label {
  font-weight: 600; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
}
.form-row.two-col { flex-direction: row; gap: 16px; }
.form-row.two-col > div { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.form-input, .form-select, .form-textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border-solid);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: all var(--dur-fast) var(--ease);
  width: 100%;
  box-shadow: var(--shadow-sm);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm), 0 0 0 3px var(--primary-glow);
}
.form-textarea { resize: vertical; font-family: 'JetBrains Mono', monospace; font-size: 13px; }

.toolbar { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.fmt-btn {
  padding: 6px 11px; border: 1.5px solid var(--border-solid);
  border-radius: var(--radius-sm); background: var(--surface);
  cursor: pointer; font-size: 12px; font-family: 'DM Sans', sans-serif;
  color: var(--text-2); font-weight: 600; transition: all var(--dur-fast);
}
.fmt-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ── Text Edit Tools ─────────────────────────────────────────────────────────*/
.edit-tools { margin-top: 14px; }
.tools-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border-solid);
  border-radius: var(--radius); padding: 10px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.tool-label { font-size: 10px; font-weight: 700; color: var(--muted-light); text-transform: uppercase; letter-spacing: .8px; flex-shrink: 0; }
.tool-btn {
  padding: 7px 12px; border: 1.5px solid var(--border-solid);
  border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--text-2); cursor: pointer; font-size: 12.5px;
  font-family: 'DM Sans', sans-serif; font-weight: 500; transition: all var(--dur-fast);
}
.tool-btn:hover, .tool-btn.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}
.tool-btn.danger { border-color: var(--danger); color: var(--danger); background: var(--danger-light); }
.tool-btn.danger:hover { background: var(--danger); color: #fff; }

.page-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.nav-btn {
  padding: 7px 16px; border: 1.5px solid var(--border-solid);
  border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text-2); cursor: pointer; font-weight: 600;
  transition: all var(--dur-fast); box-shadow: var(--shadow-sm);
}
.nav-btn:hover { border-color: var(--primary); color: var(--primary); box-shadow: var(--shadow); }

/* ── Canvas Wrap ─────────────────────────────────────────────────────────────*/
.canvas-wrap {
  position: relative; display: inline-block;
  border: 1px solid var(--border-solid); border-radius: var(--radius);
  overflow: auto; max-width: 100%;
  box-shadow: var(--shadow-lg);
}
#edit-pdf-canvas  { display: block; max-width: 100%; }
#edit-annot-canvas {
  position: absolute; top: 0; left: 0;
  cursor: crosshair; z-index: 10; pointer-events: all;
}

/* ── Form Fill ───────────────────────────────────────────────────────────────*/
.form-fields    { margin-top: 16px; }
.form-fields h4 { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 14px; }
#form-fields-list { display: flex; flex-direction: column; gap: 10px; }
.form-field-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border-solid);
  border-radius: var(--radius); padding: 12px 16px;
  flex-wrap: wrap; box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast);
}
.form-field-row:hover { border-color: var(--primary); }
.field-label { flex: 0 0 auto; max-width: 200px; font-size: 13px; font-weight: 600; word-break: break-word; }
.field-type  { font-size: 10px; color: var(--primary); background: var(--primary-light); padding: 2px 8px; border-radius: 12px; flex-shrink: 0; font-weight: 600; letter-spacing: .3px; }
.field-input {
  flex: 1; min-width: 120px; padding: 8px 12px;
  border: 1.5px solid var(--border-solid); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--surface-2); color: var(--text);
  font-family: 'DM Sans', sans-serif;
  transition: all var(--dur-fast);
}
.field-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); background: var(--surface); }

/* ── Result Box ──────────────────────────────────────────────────────────────*/
.result-box {
  margin-top: 18px;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 13.5px;
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 10px;
  animation: result-in .3s var(--spring);
  font-weight: 500;
}
@keyframes result-in { from { opacity: 0; transform: scale(.97) translateY(4px); } to { opacity: 1; transform: none; } }
.result-box.success { background: var(--success-light); border: 1px solid rgba(16,185,129,.3); color: #064e3b; }
.result-box.error   { background: var(--danger-light);  border: 1px solid rgba(239,68,68,.3);  color: #7f1d1d; }
.theme-dark .result-box.success { color: #6ee7b7; border-color: rgba(16,185,129,.4); }
.theme-dark .result-box.error   { color: #fca5a5; border-color: rgba(239,68,68,.4); }

/* ── Info Message ────────────────────────────────────────────────────────────*/
.info-msg {
  padding: 14px 18px; background: var(--primary-light);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--primary); font-size: 13.5px; margin-top: 14px; font-weight: 500;
}

/* ── Progress Overlay ────────────────────────────────────────────────────────*/
.progress-overlay {
  position: absolute; inset: 0;
  background: rgba(15,17,25,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; backdrop-filter: blur(6px);
  animation: overlay-in .2s var(--ease);
}
.theme-dark .progress-overlay { background: rgba(0,0,0,.75); }
@keyframes overlay-in { from { opacity: 0; backdrop-filter: blur(0px); } to { opacity: 1; backdrop-filter: blur(6px); } }

.progress-box {
  text-align: center; padding: 32px 48px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  border: 1px solid var(--border-solid);
  animation: progress-pop .3s var(--spring);
}
@keyframes progress-pop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.progress-box p { margin: 14px 0 12px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.progress-bar-wrap { background: var(--border-solid); border-radius: 999px; height: 5px; overflow: hidden; }
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary), #818cf8);
  border-radius: 999px; width: 0; transition: width .35s var(--ease);
  background-size: 200% 100%;
  animation: gradient-shift 1.5s linear infinite;
}
@keyframes gradient-shift { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border-solid);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  margin: 0 auto;
  box-shadow: 0 0 12px var(--primary-glow);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Preview Area ────────────────────────────────────────────────────────────*/
.preview-area {
  margin-top: 18px; border: 1px solid var(--border-solid);
  border-radius: var(--radius-lg); overflow: hidden;
  max-height: 520px; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.preview-area canvas { display: block; max-width: 100%; }

/* ── Convert Options (shared) ────────────────────────────────────────────────*/
.convert-options {
  background: var(--surface); border: 1px solid var(--border-solid);
  border-radius: var(--radius-lg); padding: 20px 24px;
  margin-top: 16px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--shadow-sm);
  animation: panel-in var(--dur) var(--ease);
}

/* ── Image Preview List ──────────────────────────────────────────────────────*/
.img-preview-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; min-height: 10px; }
.img-preview-item {
  position: relative; width: 110px;
  border: 2px solid var(--border-solid); border-radius: var(--radius);
  overflow: hidden; background: var(--surface); cursor: grab;
  transition: all var(--dur-fast) var(--ease);
  box-shadow: var(--shadow-sm);
}
.img-preview-item:hover    { box-shadow: var(--shadow-lg); border-color: var(--primary); transform: translateY(-2px); }
.img-preview-item.drag-over { border-color: var(--primary); box-shadow: var(--shadow-glow); }
.img-preview-item img { width: 100%; height: 80px; object-fit: cover; display: block; }
.img-preview-meta { padding: 5px 7px; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-preview-remove {
  position: absolute; top: 5px; right: 5px;
  background: rgba(239,68,68,.9); color: #fff; border: none;
  border-radius: 50%; width: 22px; height: 22px; font-size: 12px;
  line-height: 22px; text-align: center; cursor: pointer; padding: 0;
  opacity: 0; transition: opacity var(--dur-fast);
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.img-preview-item:hover .img-preview-remove { opacity: 1; }
.img-preview-num {
  position: absolute; top: 5px; left: 5px;
  background: rgba(0,0,0,.65); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: var(--radius-sm); padding: 1px 6px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── PDF→Image Thumbnails ────────────────────────────────────────────────────*/
.pdf2img-thumbs {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px;
  max-height: 420px; overflow-y: auto; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border-solid);
  border-radius: var(--radius-lg);
}
.pdf2img-thumb { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pdf2img-thumb canvas {
  border: 1px solid var(--border-solid); border-radius: var(--radius-sm);
  width: 120px; height: auto; display: block; box-shadow: var(--shadow-sm);
}
.pdf2img-thumb-label { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.pdf2img-thumb-dl {
  font-size: 11px; color: var(--primary); cursor: pointer;
  text-decoration: none; background: var(--primary-light); border: none;
  padding: 3px 10px; border-radius: 20px; font-weight: 600;
  transition: all var(--dur-fast);
}
.pdf2img-thumb-dl:hover { background: var(--primary); color: #fff; }

/* ── Compress Stats ──────────────────────────────────────────────────────────*/
.compress-stats {
  display: flex; align-items: center; gap: 12px; margin-top: 18px;
  padding: 20px 24px; background: var(--surface); border: 1px solid var(--border-solid);
  border-radius: var(--radius-lg); flex-wrap: wrap; box-shadow: var(--shadow-sm);
}
.stat-box { text-align: center; flex: 1; min-width: 90px; }
.stat-box.highlight {
  background: var(--success-light); border-radius: var(--radius);
  padding: 12px 18px; border: 1px solid rgba(16,185,129,.25);
}
.theme-dark .stat-box.highlight { background: rgba(16,185,129,.1); }
.stat-label { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.stat-val   { display: block; font-size: 24px; font-weight: 800; color: var(--text); font-family: 'JetBrains Mono', monospace; letter-spacing: -1px; }
.stat-arrow { font-size: 22px; color: var(--muted-light); flex: 0; }

.compress-level-opt {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border: 1.5px solid var(--border-solid); border-radius: var(--radius);
  cursor: pointer; transition: all var(--dur-fast); background: var(--surface);
}
.compress-level-opt:hover { border-color: var(--primary); background: var(--primary-light); }
.compress-level-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.compress-level-opt input { margin-top: 3px; flex-shrink: 0; accent-color: var(--primary); }
.compress-level-opt strong { color: var(--text); font-size: 13.5px; }
.compress-level-opt div p  { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

/* ── Page Organizer ──────────────────────────────────────────────────────────*/
.org-controls { margin-top: 16px; }
.org-info-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--surface); border: 1px solid var(--border-solid);
  border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; font-weight: 600;
  flex-wrap: wrap; gap: 10px; box-shadow: var(--shadow-sm);
}
.org-pages-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px; max-height: 540px; overflow-y: auto; padding: 4px;
}
.org-page-card {
  position: relative; background: var(--surface);
  border: 2px solid var(--border-solid); border-radius: var(--radius);
  overflow: hidden; cursor: grab;
  transition: all var(--dur-fast) var(--ease); user-select: none;
  box-shadow: var(--shadow-sm);
}
.org-page-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary); transform: translateY(-2px); }
.org-page-card.drag-over-card { border-color: var(--success); opacity: .7; box-shadow: 0 0 0 3px rgba(16,185,129,.3); }
.org-page-card.deleted { opacity: .3; border-color: var(--danger); filter: grayscale(.5); }
.org-page-card canvas { display: block; width: 100%; }
.org-page-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px; background: var(--surface-2); border-top: 1px solid var(--border-solid);
}
.org-page-num  { font-size: 10px; font-weight: 700; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.org-page-acts { display: flex; gap: 3px; }
.org-act-btn {
  background: none; border: 1px solid var(--border-solid); border-radius: var(--radius-sm);
  padding: 3px 7px; font-size: 11px; cursor: pointer; color: var(--text-2); transition: all var(--dur-fast);
}
.org-act-btn:hover   { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.org-act-btn.del     { color: var(--danger); }
.org-act-btn.del:hover { background: var(--danger-light); border-color: var(--danger); }
.org-page-select {
  position: absolute; top: 7px; left: 7px; width: 18px; height: 18px;
  accent-color: var(--primary); cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
}
.org-rotate-badge {
  position: absolute; top: 7px; right: 7px;
  background: rgba(0,0,0,.7); color: #fff; font-size: 10px;
  border-radius: var(--radius-sm); padding: 1px 6px;
  font-family: 'JetBrains Mono', monospace; font-weight: 700;
}

/* ── Pro Lock Overlay ────────────────────────────────────────────────────────*/
.pro-lock-overlay {
  position: absolute; inset: 0;
  background: rgba(248,250,252,.97);
  z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 36px;
  backdrop-filter: blur(8px);
  animation: overlay-in .25s var(--ease);
}
.theme-dark .pro-lock-overlay {
  background: rgba(11,13,20,.97);
}
.pro-lock-icon {
  font-size: 56px; margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(245,158,11,.5));
  animation: bounce-gentle .8s ease infinite alternate;
}
.pro-lock-title {
  font-size: 22px; font-weight: 800; letter-spacing: -.4px;
  margin-bottom: 10px; color: var(--text);
}
.pro-lock-desc {
  font-size: 14px; color: var(--muted); margin-bottom: 22px;
  max-width: 380px; line-height: 1.65;
}
.pro-lock-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.pro-feature-list { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 22px; }
.pro-feature-pill {
  font-size: 12px; padding: 5px 13px;
  background: var(--gold-light); color: #92400e;
  border-radius: 20px; font-weight: 600;
  border: 1px solid rgba(245,158,11,.3);
}
.theme-dark .pro-feature-pill { background: rgba(245,158,11,.12); color: #fbbf24; border-color: rgba(245,158,11,.2); }

/* ── Utility ─────────────────────────────────────────────────────────────────*/
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .pdf-panel { padding: 18px 16px; }
  .pdf-tab   { padding: 12px 13px; font-size: 12px; }
  .tab-icon  { display: none; }
  .form-row.two-col { flex-direction: column; }
  .file-name { max-width: 130px; }
  .tools-bar { gap: 5px; }
  .tool-btn  { padding: 5px 9px; font-size: 12px; }
  .org-pages-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .compress-stats { flex-direction: column; gap: 10px; }
  .stat-arrow { transform: rotate(90deg); }
  .action-bar { flex-direction: column; }
  .action-bar .btn { width: 100%; }
  .pdf-branding-bar { padding: 11px 16px; }
  .pdf-brand-name { font-size: 15px; }
  .pdf-brand-tagline { display: none; }
  .progress-box { padding: 24px 28px; min-width: 200px; }
}
@media (max-width: 480px) {
  .wp-pdf-editor-wrap { border-radius: var(--radius); }
  .pdf-tab { padding: 11px 10px; font-size: 11px; }
  .panel-header h3 { font-size: 17px; }
  .upload-zone { padding: 28px 14px; }
  .upload-icon { font-size: 32px; }
  .form-field-row { flex-direction: column; align-items: flex-start; }
  .field-label { max-width: 100%; }
  .img-preview-item { width: 86px; }
  .img-preview-item img { height: 65px; }
  .org-pages-grid { grid-template-columns: repeat(3, 1fr); }
  .btn-upgrade { padding: 11px 22px; font-size: 14px; }
}
@media print {
  .pdf-tab-bar, .action-bar, .tools-bar, .page-nav, .pdf-branding-bar, .pdf-promo-banner { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PWA INSTALL BUTTON
   ══════════════════════════════════════════════════════════════════════════ */

/* Install button in branding bar */
.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  background: rgba(255,255,255,.18);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: 20px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  backdrop-filter: blur(8px);
  transition: all 220ms cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
  animation: pwa-btn-appear .5s cubic-bezier(.34,1.56,.64,1);
  margin-left: auto;
  margin-right: 10px;
}
.pwa-install-btn:hover {
  background: rgba(255,255,255,.28);
  border-color: rgba(255,255,255,.6);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.pwa-install-btn:active { transform: scale(.97); }
.pwa-install-icon { font-size: 16px; animation: pwa-pulse 1.8s ease infinite; }

@keyframes pwa-btn-appear {
  from { opacity: 0; transform: scale(.7) translateX(10px); }
  to   { opacity: 1; transform: scale(1) translateX(0); }
}
@keyframes pwa-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.15) rotate(-5deg); }
}

/* Installing state */
.pwa-install-btn.installing {
  pointer-events: none;
  opacity: .8;
}
.pwa-install-btn.installing .pwa-install-icon {
  animation: spin .65s linear infinite;
}

/* Installed success flash */
.pwa-install-btn.installed {
  background: rgba(16,185,129,.25);
  border-color: rgba(16,185,129,.5);
  animation: none;
}

/* PWA Toast notification */
.pwa-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #13161f;
  color: #f1f3ff;
  padding: 14px 24px;
  border-radius: 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.4), 0 0 0 1px rgba(99,102,241,.3);
  border: 1px solid rgba(99,102,241,.25);
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 380px;
  width: calc(100vw - 32px);
  transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  opacity: 0;
}
.pwa-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.pwa-toast-icon { font-size: 24px; flex-shrink: 0; }
.pwa-toast-text strong { display: block; font-size: 14px; margin-bottom: 2px; }
.pwa-toast-text span   { font-size: 12px; color: #7b82a0; }
.pwa-toast-close {
  margin-left: auto; cursor: pointer; opacity: .5;
  font-size: 18px; flex-shrink: 0; padding: 4px;
  border-radius: 50%; background: rgba(255,255,255,.08); border: none; color: inherit;
  transition: opacity .15s;
}
.pwa-toast-close:hover { opacity: 1; }

/* Already installed state — hide button entirely */
@media (display-mode: standalone) {
  .pwa-install-btn { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PAYPAL INTEGRATION UI
   ══════════════════════════════════════════════════════════════════════════ */

/* Plan Selector Tabs */
.pp-plan-selector { width: 100%; max-width: 480px; margin-top: 16px; }
.pp-plan-tabs {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; justify-content: center;
}
.pp-plan-tab {
  flex: 1; min-width: 120px; padding: 10px 14px;
  border: 2px solid var(--border-solid); border-radius: var(--radius);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  font-family: 'DM Sans', sans-serif; font-size: 12.5px; font-weight: 600;
  text-align: center; transition: all var(--dur-fast) var(--ease); line-height: 1.4;
}
.pp-plan-tab small { display: block; font-weight: 400; color: var(--muted); margin-top: 3px; font-size: 11.5px; }
.pp-plan-tab:hover  { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.pp-plan-tab.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.pp-plan-tab.active small { color: var(--primary); }
.pp-save-badge {
  display: inline-block; background: var(--success); color: #fff;
  font-size: 9px; padding: 1px 5px; border-radius: 8px; font-weight: 700; margin-left: 3px;
}

/* PayPal Button Container */
.pp-btn-container { min-height: 44px; }
.pp-btn-loading { text-align: center; color: var(--muted); font-size: 13px; padding: 12px; }

/* Payment status message */
.pp-payment-msg {
  margin-top: 10px; padding: 10px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500; text-align: center;
}

/* Card fields divider */
.pp-card-divider {
  text-align: center; color: var(--muted); font-size: 12px;
  margin: 12px 0; position: relative;
}
.pp-card-divider::before,
.pp-card-divider::after {
  content: ''; position: absolute; top: 50%; width: 35%;
  height: 1px; background: var(--border-solid);
}
.pp-card-divider::before { left: 0; }
.pp-card-divider::after  { right: 0; }

/* Hosted field wrappers */
.pp-hf-field {
  border: 1.5px solid var(--border-solid); border-radius: var(--radius-sm);
  padding: 10px 12px; background: var(--surface); margin-bottom: 8px;
  min-height: 40px; transition: border-color var(--dur-fast);
}
.pp-hf-field.pp-focused { border-color: var(--primary); }

/* Card pay button */
.pp-card-pay-btn {
  width: 100%; padding: 11px; background: var(--primary);
  color: #fff; border: none; border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all var(--dur-fast);
  box-shadow: 0 4px 14px var(--primary-glow);
}
.pp-card-pay-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* Back button in pro lock */
.pp-back-btn {
  margin-top: 14px; padding: 9px 20px;
  border: 1.5px solid var(--border-solid); border-radius: var(--radius);
  background: none; cursor: pointer; font-size: 13px; color: var(--muted);
  font-family: 'DM Sans', sans-serif; transition: all var(--dur-fast);
}
.pp-back-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Sandbox mode badge */
.pp-sandbox-badge {
  display: inline-block; background: #fef3c7; color: #92400e;
  font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 20px; letter-spacing: .5px; text-transform: uppercase;
  border: 1px solid #fde68a; margin-left: 8px;
}
