/* ── PDF Watermark Tool ── */
:root {
  --bg:#f5f6f8;--surface:#fff;--border:#e2e5ea;--border2:#c8cdd6;
  --accent:#2563eb;--accent-h:#1d4ed8;--accent-light:#eff6ff;--accent-mid:#bfdbfe;
  --text:#111827;--text2:#4b5563;--text3:#9ca3af;
  --green:#059669;--green-bg:#ecfdf5;--red:#dc2626;--red-bg:#fef2f2;
  --sh:0 1px 3px rgba(0,0,0,.08),0 1px 2px rgba(0,0,0,.05);
  --r:8px;--rl:12px;--rxl:16px;
}
.tool-card{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;color:var(--text);max-width:720px;margin:0 auto}

/* ── Hidden ── */
.hidden{display:none!important}

/* ── Top bar ── */
.top-bar{display:flex;justify-content:flex-end;gap:8px;margin-bottom:12px}
.btn-add,.btn-clear{display:inline-flex;align-items:center;gap:5px;padding:6px 12px;border-radius:var(--r);border:1px solid var(--border2);background:var(--surface);color:var(--text2);font-size:13px;cursor:pointer;transition:all .15s}
.btn-add:hover,.btn-clear:hover{background:var(--bg);border-color:var(--accent)}
.btn-add svg,.btn-clear svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2}

/* ── Drop zone ── */
.drop-zone{border:2px dashed var(--border2);border-radius:var(--rxl);padding:48px 24px;text-align:center;cursor:pointer;transition:all .2s;background:var(--surface)}
.drop-zone:hover,.drop-zone.drag-over{border-color:var(--accent);background:var(--accent-light)}
.dz-icon{margin:0 auto 16px}
.dz-icon svg{width:48px;height:48px;stroke:var(--accent);fill:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.dz-title{font-size:18px;font-weight:600;margin-bottom:6px;color:var(--text)}
.dz-sub{font-size:13px;color:var(--text3);margin-bottom:16px}
.btn-dz{padding:10px 24px;border-radius:var(--r);border:1px solid var(--accent);background:var(--accent-light);color:var(--accent);font-weight:600;font-size:14px;cursor:pointer;transition:all .15s}
.btn-dz:hover{background:var(--accent);color:#fff}
.fmt-pills{margin-top:12px;display:flex;justify-content:center;gap:6px}
.fmt-pill{display:inline-block;padding:3px 10px;border-radius:20px;background:var(--accent-light);color:var(--accent);font-size:11px;font-weight:600;letter-spacing:.5px;text-transform:uppercase}

/* ── Settings panel ── */
.pwm-settings{background:var(--surface);border:1px solid var(--border);border-radius:var(--rl);padding:20px;margin-bottom:16px}
.pwm-row{margin-bottom:16px}
.pwm-row:last-child{margin-bottom:0}
.pwm-row>label{display:block;font-size:12px;font-weight:600;color:var(--text2);text-transform:uppercase;letter-spacing:.5px;margin-bottom:6px}
.pwm-row-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.pwm-col>label{display:block;font-size:12px;font-weight:600;color:var(--text2);text-transform:uppercase;letter-spacing:.5px;margin-bottom:6px}
.pwm-col-sm{max-width:100px}

/* Select + custom input */
.pwm-text-group{display:flex;gap:8px;align-items:center}
.pwm-select{flex:1;padding:8px 12px;border:1px solid var(--border2);border-radius:var(--r);font-size:14px;color:var(--text);background:var(--bg);cursor:pointer;outline:none}
.pwm-select:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(37,99,235,.1)}
.pwm-custom-input{flex:1;padding:8px 12px;border:1px solid var(--border2);border-radius:var(--r);font-size:14px;color:var(--text);background:var(--bg);outline:none}
.pwm-custom-input:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(37,99,235,.1)}

/* Range sliders */
.pwm-range-wrap{display:flex;align-items:center;gap:10px}
.pwm-range{flex:1;-webkit-appearance:none;appearance:none;height:6px;border-radius:3px;background:var(--border);outline:none;cursor:pointer}
.pwm-range::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;border-radius:50%;background:var(--accent);border:2px solid #fff;box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:pointer}
.pwm-range::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:var(--accent);border:2px solid #fff;box-shadow:0 1px 3px rgba(0,0,0,.2);cursor:pointer}
.pwm-range-val{font-size:13px;font-weight:600;color:var(--accent);min-width:48px;text-align:right}

/* Color picker */
.pwm-color-input{width:48px;height:36px;border:1px solid var(--border2);border-radius:var(--r);padding:2px;cursor:pointer;background:var(--surface)}

/* Position pills */
.pwm-pos-pills{display:flex;gap:6px;flex-wrap:wrap}
.pwm-pos-pill{padding:7px 16px;border-radius:20px;border:1px solid var(--border2);background:var(--surface);color:var(--text2);font-size:13px;font-weight:500;cursor:pointer;transition:all .15s}
.pwm-pos-pill:hover{border-color:var(--accent);color:var(--accent)}
.pwm-pos-pill.active{background:var(--accent)!important;color:#fff!important;border-color:var(--accent)!important}

/* ── File list ── */
.file-list{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}
.file-row{background:var(--surface);border:1px solid var(--border);border-radius:var(--rl);padding:12px 16px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px}
.file-info{display:flex;align-items:center;gap:10px;flex:1;min-width:0}
.file-icon{width:20px;height:20px;stroke:var(--accent);fill:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.file-details{min-width:0}
.file-name{font-size:14px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.file-meta{font-size:12px;color:var(--text3)}
.file-status{display:flex;align-items:center;gap:8px;flex-shrink:0}
.status-badge{font-size:11px;font-weight:600;padding:3px 8px;border-radius:12px}
.status-pending{background:var(--bg);color:var(--text3)}
.status-processing{background:var(--accent-light);color:var(--accent)}
.status-done{background:var(--green-bg);color:var(--green)}
.status-error{background:var(--red-bg);color:var(--red)}
.file-result{font-size:12px;font-weight:600;color:var(--green)}
.btn-dl{padding:4px 10px;border-radius:var(--r);border:1px solid var(--accent);background:var(--accent-light);color:var(--accent);font-size:12px;font-weight:600;cursor:pointer;transition:all .15s}
.btn-dl:hover{background:var(--accent);color:#fff}

/* Progress bar */
.file-progress{width:100%;margin-top:6px}
.progress-bar{height:4px;background:var(--border);border-radius:2px;overflow:hidden}
.progress-fill{height:100%;background:linear-gradient(90deg,var(--accent),#60a5fa);border-radius:2px;transition:width .3s}

/* ── Action row ── */
.action-row{display:flex;justify-content:center;gap:12px;margin-bottom:16px;flex-wrap:wrap}
.btn-ghost{display:inline-flex;align-items:center;gap:7px;padding:10px 20px;border-radius:var(--r);border:1px solid var(--border2);background:var(--surface);color:var(--text2);font-size:14px;font-weight:500;cursor:pointer;transition:all .15s}
.btn-ghost:hover{border-color:var(--accent);color:var(--accent);background:var(--accent-light)}
.btn-ghost svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.btn-primary{display:inline-flex;align-items:center;gap:7px;padding:10px 20px;border-radius:var(--r);border:none;font-size:14px;font-weight:650;cursor:pointer;transition:all .2s cubic-bezier(.4,0,.2,1);
  background:linear-gradient(180deg,#3b82f6 0%,#2563eb 100%)!important;color:#fff!important;
  box-shadow:0 1px 3px rgba(37,99,235,.35),0 4px 12px rgba(37,99,235,.2),inset 0 1px 0 rgba(255,255,255,.15)!important}
.btn-primary:hover{background:linear-gradient(180deg,#2563eb 0%,#1d4ed8 100%)!important;transform:translateY(-1px)!important;
  box-shadow:0 2px 6px rgba(37,99,235,.4),0 8px 20px rgba(37,99,235,.25),inset 0 1px 0 rgba(255,255,255,.15)!important}
.btn-primary:disabled{opacity:.5;cursor:not-allowed;transform:none!important}
.btn-primary svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.badge-circle{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:rgba(255,255,255,.25);font-size:11px;font-weight:700}

/* ── Privacy banner ── */
.privacy-banner{display:flex;align-items:center;justify-content:center;gap:8px;padding:12px;color:var(--text3);font-size:12px}
.privacy-banner svg{width:16px;height:16px;flex-shrink:0}

/* ── RTL ── */
[dir="rtl"] .top-bar{flex-direction:row-reverse}
[dir="rtl"] .file-row{flex-direction:row-reverse}
[dir="rtl"] .file-info{flex-direction:row-reverse;text-align:right}
[dir="rtl"] .file-status{flex-direction:row-reverse}
[dir="rtl"] .pwm-text-group{flex-direction:row-reverse}
[dir="rtl"] .pwm-range-val{text-align:left}
[dir="rtl"] .privacy-banner{flex-direction:row-reverse}

/* ── Responsive ── */
@media(max-width:640px){
  .pwm-row-grid{grid-template-columns:1fr}
  .pwm-col-sm{max-width:100%}
  .drop-zone{padding:32px 16px}
  .action-row{flex-direction:column;align-items:stretch}
  .btn-ghost,.btn-primary{justify-content:center}
  .file-row{flex-direction:column;align-items:flex-start}
  .file-status{width:100%;justify-content:flex-end}
}
