/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }

/* ── Tokens ── */
:root {
  --primary:    #3b5bdb;
  --primary-d:  #2f4abf;
  --primary-l:  #eef2ff;
  --accent:     #818cf8;
  --bg:         #f8faff;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #0f172a;
  --muted:      #64748b;
  --radius:     14px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(59,91,219,.07);
  --shadow-lg:  0 4px 6px rgba(0,0,0,.05), 0 20px 40px rgba(59,91,219,.12);
  --font:       'Plus Jakarta Sans', sans-serif;
}

/* ── Base ── */
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit }

/* ── Header ── */
.header { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.header-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); }
.header-logo { width: 36px; height: 36px; border-radius: 0; background: none; display: grid; place-items: center; flex-shrink: 0; }
.header-logo svg { width: 18px; height: 18px }
.brand-pdf { color: var(--primary) }
.header-nav { display: flex; align-items: center; gap: 6px }
.nav-link { font-size: 13.5px; font-weight: 500; color: var(--muted); padding: 6px 12px; border-radius: 8px; transition: color .15s, background .15s; }
.nav-link:hover { color: var(--text); background: var(--primary-l) }
.nav-cta { font-size: 13px; font-weight: 600; background: var(--primary); color: #fff; padding: 7px 16px; border-radius: 8px; transition: background .15s, transform .1s; }
.nav-cta:hover { background: var(--primary-d); transform: translateY(-1px) }

/* ── Hero ── */
.hero { text-align: center; padding: 72px 24px 56px; max-width: 680px; margin: 0 auto; }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); background: var(--primary-l); border: 1px solid rgba(59,91,219,.2); border-radius: 100px; padding: 5px 14px; margin-bottom: 22px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; line-height: 1.15; letter-spacing: -.03em; margin-bottom: 16px; }
.hero h1 span { color: var(--primary) }
.hero p { font-size: 16px; line-height: 1.7; color: var(--muted); max-width: 500px; margin: 0 auto 32px; }
.hero-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pill { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 100px; padding: 5px 12px; }

/* ── Section ── */
.section { padding: 0 24px 64px; max-width: 1100px; margin: 0 auto }
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Tool Grid ── */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tool-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s; cursor: pointer; }
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(59,91,219,.25); }
.tool-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.tool-icon svg { width: 22px; height: 22px }
.tool-info { min-width: 0 }
.tool-name { font-size: 14px; font-weight: 700; margin-bottom: 2px }
.tool-desc { font-size: 12px; color: var(--muted); line-height: 1.4 }

.ic-blue   { background: #eff6ff; color: #3b82f6 }
.ic-green  { background: #f0fdf4; color: #22c55e }
.ic-purple { background: #faf5ff; color: #a855f7 }
.ic-orange { background: #fff7ed; color: #f97316 }
.ic-red    { background: #fff1f2; color: #f43f5e }
.ic-teal   { background: #f0fdfa; color: #14b8a6 }
.ic-indigo { background: #eef2ff; color: #6366f1 }
.ic-yellow { background: #fefce8; color: #eab308 }
.ic-pink   { background: #fdf4ff; color: #d946ef }

/* ── Tool Page ── */
.tool-page { max-width: 720px; margin: 0 auto; padding: 40px 24px 80px }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 32px; }
.breadcrumb a { color: var(--muted); transition: color .15s }
.breadcrumb a:hover { color: var(--primary) }
.tool-header { text-align: center; margin-bottom: 36px }
.tool-header-icon { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 20px; }
.tool-header-icon svg { width: 36px; height: 36px }
.tool-header h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: -.02em; margin-bottom: 10px }
.tool-header p { font-size: 15px; color: var(--muted); line-height: 1.6; max-width: 480px; margin: 0 auto 14px }
.local-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; color: #16a34a; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 100px; padding: 4px 11px; }

/* ── Dropzone ── */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 52px 24px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; background: var(--surface); }
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary); background: var(--primary-l); }
.dropzone-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-l); color: var(--primary); display: grid; place-items: center; margin: 0 auto 16px; }
.dropzone-icon svg { width: 28px; height: 28px }
.dropzone h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px }
.dropzone p  { font-size: 13px; color: var(--muted) }

/* ── File list ── */
.file-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px }
.file-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.file-item-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--primary-l); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.file-item-icon svg { width: 20px; height: 20px }
.file-item-info { flex: 1; min-width: 0 }
.file-item-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.file-item-size { font-size: 12px; color: var(--muted) }
.file-item-actions { display: flex; gap: 4px }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent; cursor: pointer; color: var(--muted); display: grid; place-items: center; transition: background .15s, color .15s; }
.icon-btn:hover { background: #f1f5f9; color: var(--text) }
.icon-btn svg { width: 15px; height: 15px }

/* ── Controls ── */
.controls { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.control-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end }
.control-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px }
.control-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em }
.control-select, .control-input { height: 40px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; font-size: 14px; font-family: var(--font); background: var(--bg); color: var(--text); transition: border-color .15s; outline: none; }
.control-select:focus, .control-input:focus { border-color: var(--primary) }
.slider-row { display: flex; flex-direction: column; gap: 8px }
.slider-header { display: flex; justify-content: space-between }
.slider-header span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em }
.slider-val { color: var(--primary) !important }
input[type=range] { width: 100%; accent-color: var(--primary); cursor: pointer; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 22px; border-radius: 11px; border: none; font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--primary); color: #fff }
.btn-primary:hover { background: var(--primary-d); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,91,219,.3) }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none }
.btn-outline { background: var(--surface); color: var(--text); border: 1px solid var(--border) }
.btn-outline:hover { background: var(--bg) }
.btn svg { width: 17px; height: 17px }
.actions { display: flex; justify-content: flex-end; gap: 10px }

/* ── Result ── */
.result-card { background: linear-gradient(135deg, #eff6ff, #eef2ff); border: 1px solid rgba(59,91,219,.2); border-radius: var(--radius); padding: 24px; text-align: center; margin-top: 20px; animation: pop .3s cubic-bezier(.16,1,.3,1); }
@keyframes pop { from { opacity:0; transform:scale(.97) } to { opacity:1; transform:scale(1) } }
.result-card h3 { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 6px }
.result-card p  { font-size: 13px; color: var(--muted); margin-bottom: 16px }

/* ── Spinner ── */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .7s linear infinite; display: none; }
@keyframes spin { to { transform: rotate(360deg) } }
.btn.loading .spinner { display: block }
.btn.loading .btn-label { display: none }

/* ── Thumbnails ── */
.thumbs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 20px; }
.thumb-item { border: 2px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; transition: border-color .15s; position: relative; }
.thumb-item.selected { border-color: var(--primary) }
.thumb-item canvas { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block }
.thumb-label { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 5px; border-top: 1px solid var(--border); background: var(--surface); }
.thumb-check { position: absolute; top: 5px; right: 5px; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: #fff; display: none; place-items: center; font-size: 11px; }
.thumb-item.selected .thumb-check { display: grid }

/* ── Footer ── */
.footer { border-top: 1px solid var(--border); padding: 28px 24px; text-align: center; font-size: 13px; color: var(--muted); }
.footer a { color: var(--primary) }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: #0f172a; color: #fff; font-size: 13.5px; font-weight: 500; padding: 12px 20px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transition: all .3s; pointer-events: none; z-index: 999; white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) }
.toast.error { background: #dc2626 }
.toast.success { background: #16a34a }

/* ── Responsive ── */
@media (max-width: 600px) {
  .header-nav .nav-link { display: none }
  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) }
}

/* ── Dropdown ── */
.dropdown { position: relative }
.dropdown-btn { background: none; border: none; cursor: pointer; font-family: var(--font) }
.dropdown-menu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px; min-width: 180px;
  box-shadow: var(--shadow-lg); z-index: 200;
}
.dropdown:hover .dropdown-menu { display: flex; flex-direction: column }
.dropdown-menu a { font-size: 13.5px; font-weight: 500; color: var(--text); padding: 8px 12px; border-radius: 8px; transition: background .15s }
.dropdown-menu a:hover { background: var(--primary-l); color: var(--primary) }

/* ── Mobile menu btn ── */
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: 4px }
@media (max-width: 768px) {
  .header-nav .nav-link, .header-nav .dropdown, .header-nav .nav-cta { display: none }
  .mobile-menu-btn { display: flex }
}

/* ── Mobile menu ── */
.mobile-menu {
  display: none; position: fixed; top: 60px; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  z-index: 99; overflow-y: auto;
}
.mobile-menu.open { display: block }
.mobile-menu-inner { padding: 16px 20px; display: flex; flex-direction: column; gap: 4px }
.mobile-menu-inner a { font-size: 14px; font-weight: 500; color: var(--text); padding: 10px 12px; border-radius: 10px; transition: background .15s }
.mobile-menu-inner a:hover { background: var(--primary-l); color: var(--primary) }
.mobile-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 12px 4px; }
