/* ---------------------------------------------------------------
   filetools.css — shared UI for the file/image/PDF tools in /tool.
   Design tokens and components match the rest of inialdan.com.
   Pair with assets/filetools.js.
   --------------------------------------------------------------- */

:root {
     --surface: #ffffff;
     --surface-2: #f9fafb;
     --border: #e5e7eb;
     --border-strong: #d1d5db;
     --text: #111827;
     --text-muted: #6b7280;
     --text-faint: #9ca3af;
     --accent: #111827;
     --accent-fg: #ffffff;
     --danger: #dc2626;
}
.dark {
     --surface: #0a0a0a;
     --surface-2: #111111;
     --border: #1f1f1f;
     --border-strong: #2a2a2a;
     --text: #f3f4f6;
     --text-muted: #9ca3af;
     --text-faint: #6b7280;
     --accent: #f3f4f6;
     --accent-fg: #0a0a0a;
     --danger: #f87171;
}
* { font-family: 'Poppins', sans-serif; box-sizing: border-box; }
html, body { transition: background-color .25s, color .25s; }
body { background: var(--surface); color: var(--text); }
.mono { font-family: 'JetBrains Mono', monospace; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.card-header { padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); font-weight: 500; }
.link-btn { font-size: 12px; color: var(--text-faint); transition: color .15s; background: none; border: none; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--text); }
.link-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--text-muted); transition: background .15s, color .15s; background: none; border: none; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.pill-btn { font-size: 12px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-muted); background: var(--surface); cursor: pointer; transition: all .15s; white-space: nowrap; }
.pill-btn:hover { color: var(--text); border-color: var(--border-strong); }
.pill-btn:active { transform: scale(.96); }
.pill-btn.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pill-btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 500; }
.pill-btn.primary:hover { opacity: .9; color: var(--accent-fg); }
.pill-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.field { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; font-size: 13px; padding: 8px 10px; outline: none; transition: border-color .15s; }
.field:focus { border-color: var(--border-strong); }
select.field { cursor: pointer; -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-faint) 50%), linear-gradient(135deg, var(--text-faint) 50%, transparent 50%); background-position: right 14px center, right 9px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; background: var(--border); border-radius: 99px; outline: none; flex: 1; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); border-radius: 50%; cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); border-radius: 50%; cursor: pointer; }
.uploader { border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 26px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: all .15s; text-align: center; background: var(--surface-2); }
.uploader:hover, .uploader.drag { border-color: var(--text-muted); background: var(--surface); }
.stage { background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 20px 20px; border-radius: 12px; padding: 16px; display: flex; align-items: center; justify-content: center; min-height: 300px; }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; transition: background .15s; border: 1px solid transparent; }
.file-row:hover { background: var(--surface-2); }
.file-row.selected { background: var(--surface-2); border-color: var(--border); }
.crop-wrap { position: relative; display: inline-block; line-height: 0; max-width: 100%; touch-action: none; overflow: hidden; border-radius: 4px; }
.crop-wrap canvas { max-width: 100%; max-height: 60vh; display: block; user-select: none; -webkit-user-drag: none; }
.crop-box { position: absolute; border: 1px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: move; }
.crop-box::before, .crop-box::after { content: ''; position: absolute; inset: 0; pointer-events: none; }
.crop-box::before { border-left: 1px dashed rgba(255,255,255,.45); border-right: 1px dashed rgba(255,255,255,.45); left: 33.33%; right: 33.33%; }
.crop-box::after { border-top: 1px dashed rgba(255,255,255,.45); border-bottom: 1px dashed rgba(255,255,255,.45); top: 33.33%; bottom: 33.33%; }
.crop-handle { position: absolute; width: 14px; height: 14px; background: #fff; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.crop-handle[data-h=nw] { left: -7px; top: -7px; cursor: nwse-resize; }
.crop-handle[data-h=ne] { right: -7px; top: -7px; cursor: nesw-resize; }
.crop-handle[data-h=sw] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.crop-handle[data-h=se] { right: -7px; bottom: -7px; cursor: nwse-resize; }
.badge { font-size: 10px; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--border); white-space: nowrap; }
.badge.good { color: #16a34a; border-color: rgba(22,163,74,.35); }
.dark .badge.good { color: #4ade80; border-color: rgba(74,222,128,.25); }
.badge.bad { color: var(--danger); border-color: rgba(220,38,38,.3); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--text); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* --- shared extras used by the other file tools --- */
.notice { border-radius: 12px; padding: 10px 12px; font-size: 12px; line-height: 1.6; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); }
.notice.error { color: var(--danger); border-color: rgba(220,38,38,.3); background: rgba(220,38,38,.06); }
.progress { height: 4px; border-radius: 99px; background: var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.hint { font-size: 11px; color: var(--text-faint); line-height: 1.6; }
.page-thumb { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); overflow: hidden; position: relative; cursor: pointer; transition: border-color .15s; }
.page-thumb:hover { border-color: var(--border-strong); }
.page-thumb.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.page-thumb canvas, .page-thumb img { display: block; width: 100%; height: auto; }
.page-thumb .page-no { position: absolute; left: 6px; bottom: 6px; font-size: 10px; padding: 1px 6px; border-radius: 99px; background: rgba(0,0,0,.65); color: #fff; }
.drag-handle { cursor: grab; color: var(--text-faint); }
.drag-handle:active { cursor: grabbing; }
.file-row.dragging { opacity: .4; }
