/* ===========================
   PDFEasy – Global Stylesheet
   =========================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg: #09090f;
  --bg2: #0e0e1a;
  --bg3: #13131f;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(167,139,250,0.35);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #a78bfa;
  --accent2: #7c3aed;
  --accent3: #6366f1;
  --accent-glow: rgba(167,139,250,0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 4px 30px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
  --transition: 0.28s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent2); border-radius: 99px; }

/* ===== CONTAINER ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(9,9,15,0.75);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.navbar.scrolled { background: rgba(9,9,15,0.95); }
.nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; gap: 32px;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.15rem; flex-shrink: 0;
}
.logo-icon { display: flex; align-items: center; }
.logo-text { letter-spacing: -0.5px; }
.logo-accent { color: var(--accent); }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-link {
  padding: 8px 14px; border-radius: var(--radius-xs);
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
  transition: var(--transition);
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.btn-nav-cta {
  padding: 9px 20px; border-radius: var(--radius-xs);
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: #fff; font-size: 0.88rem; font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-nav-cta:hover { opacity: 0.88; transform: translateY(-1px); }
.hamburger { display: none; flex-direction: column; gap: 5px; padding: 6px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: var(--transition); }
.mobile-menu { display: none; flex-direction: column; padding: 12px 24px 16px; gap: 4px; }
.mobile-menu a { padding: 10px 12px; border-radius: var(--radius-xs); color: var(--text-muted); font-weight: 500; }
.mobile-menu a:hover { background: rgba(255,255,255,0.05); color: var(--text); }

/* ===== HERO ===== */
.hero {
  min-height: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 140px 24px 60px;
  position: relative; overflow: hidden;
  max-width: 1200px; margin: 0 auto;
  gap: 60px;
  text-align: center;
}
.hero-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
.hero-orb {
  position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.18;
}
.orb1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #7c3aed, transparent 70%);
  top: -150px; left: -150px; animation: drift 18s ease-in-out infinite;
}
.orb2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
  top: 20%; right: -100px; animation: drift 24s ease-in-out infinite reverse;
}
.orb3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #a78bfa, transparent 70%);
  bottom: 0; left: 30%; animation: drift 20s ease-in-out infinite 4s;
}
.grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 60px 60px;
}
@keyframes drift {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px,-30px) scale(1.05); }
  66% { transform: translate(-20px,20px) scale(0.97); }
}

.hero-content { position: relative; z-index: 1; flex: 1; max-width: 800px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(167,139,250,0.08);
  border: 1px solid rgba(167,139,250,0.2);
  padding: 6px 14px; border-radius: 99px;
  font-size: 0.8rem; color: var(--accent); font-weight: 500;
  margin-bottom: 28px;
}
.badge-dot {
  width: 7px; height: 7px; background: #4ade80; border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.8); }
}
.hero-title {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 900; line-height: 1.1;
  letter-spacing: -2px; margin-bottom: 20px;
}
.gradient-text {
  background: linear-gradient(135deg, #a78bfa 0%, #818cf8 40%, #67e8f9 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 1.05rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 36px;
}
.hero-btns { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 48px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: #fff; font-size: 1rem; font-weight: 600;
  box-shadow: 0 0 30px rgba(167,139,250,0.3);
  transition: var(--transition);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 40px rgba(167,139,250,0.4); }
.btn-ghost {
  padding: 14px 24px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted); font-size: 1rem; font-weight: 500;
  transition: var(--transition);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.hero-stats { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat-num { font-size: 1.6rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), #67e8f9); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-label { font-size: 0.78rem; color: var(--text-dim); font-weight: 500; }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

/* ===== HERO VISUAL ===== */
.hero-visual {
  position: relative; z-index: 1; flex: 0 0 360px;
  display: flex; align-items: center; justify-content: center;
}
.pdf-mockup { position: relative; width: 280px; height: 320px; }
.pdf-card {
  position: absolute;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.pm1 { width: 180px; top: 10px; left: 0; transform: rotate(-8deg); }
.pm2 { width: 200px; top: 60px; left: 50px; z-index: 2;
  border-color: rgba(167,139,250,0.3);
  box-shadow: 0 0 40px rgba(167,139,250,0.15);
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px;
  animation: float 4s ease-in-out infinite;
}
.pm3 { width: 160px; bottom: 0; right: 0; transform: rotate(6deg); }
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.pm-bar { height: 8px; background: var(--border); border-radius: 4px; margin-bottom: 8px; }
.pm-bar.short { width: 60%; }
.pm-bar.medium { width: 80%; }
.pm-icon { width: 40px; height: 40px; }
.pm2 span { font-size: 0.8rem; color: var(--accent); font-weight: 600; }

/* ===== TOOLS SECTION ===== */
.tools-section { padding: 0 0 100px; }
.section-header { text-align: center; margin-bottom: 60px; }
.section-tag {
  display: inline-block;
  background: rgba(167,139,250,0.08);
  border: 1px solid rgba(167,139,250,0.2);
  color: var(--accent); font-size: 0.78rem; font-weight: 600;
  padding: 4px 14px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px;
}
.section-title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -1px; margin-bottom: 12px; }
.section-sub { color: var(--text-muted); font-size: 1rem; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.tool-card {
  display: flex; flex-direction: column;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
  position: relative; overflow: hidden; cursor: pointer;
}
.tool-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), var(--accent-glow), transparent 60%);
  opacity: 0; transition: opacity 0.4s;
}
.tool-card:hover::before { opacity: 1; }
.tool-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(167,139,250,0.1);
}
.tc-icon-wrap {
  width: 52px; height: 52px; border-radius: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--clr) 15%, transparent), color-mix(in srgb, var(--clr2) 8%, transparent));
  border: 1px solid color-mix(in srgb, var(--clr) 20%, transparent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.tc-icon-wrap svg { width: 22px; height: 22px; color: var(--clr); }
.tc-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.tc-body p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.55; flex: 1; }
.tc-arrow {
  display: block; margin-top: 16px;
  color: var(--accent); font-size: 1.1rem; font-weight: 700;
  transition: transform var(--transition);
}
.tool-card:hover .tc-arrow { transform: translateX(6px); }

/* ===== FEATURES ===== */
.features-section {
  padding: 100px 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 50%, var(--bg) 100%);
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: var(--transition);
}
.feature-card:hover { border-color: var(--border-hover); transform: translateY(-3px); }
.fc-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(167,139,250,0.12), rgba(99,102,241,0.08));
  border: 1px solid rgba(167,139,250,0.15);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.fc-icon svg { width: 22px; height: 22px; color: var(--accent); }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; }

/* ===== FAQ ===== */
.faq-section { padding: 100px 0; }
.faq-list { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--transition);
}
.faq-item.open { border-color: rgba(167,139,250,0.25); }
.faq-q {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; font-size: 0.95rem; font-weight: 600; color: var(--text);
  background: none; border: none; text-align: left;
}
.faq-arrow {
  width: 18px; height: 18px; flex-shrink: 0; transition: transform 0.28s;
  color: var(--text-muted);
}
.faq-item.open .faq-arrow { transform: rotate(180deg); color: var(--accent); }
.faq-a {
  max-height: 0; overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1), padding 0.3s;
}
.faq-item.open .faq-a { max-height: 200px; }
.faq-a p { padding: 0 22px 18px; color: var(--text-muted); font-size: 0.9rem; line-height: 1.7; }

/* ===== FOOTER ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 60px 0 30px;
  background: var(--bg2);
}
.footer-inner { display: flex; gap: 60px; flex-wrap: wrap; padding-bottom: 48px; }
.footer-brand { flex: 1; min-width: 220px; }
.footer-brand .nav-logo { margin-bottom: 14px; display: inline-flex; }
.footer-brand p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; max-width: 280px; }
.footer-links { display: flex; gap: 40px; flex-wrap: wrap; }
.fl-group h4 { font-size: 0.8rem; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; }
.fl-group { display: flex; flex-direction: column; gap: 10px; }
.fl-group a { font-size: 0.875rem; color: var(--text-muted); transition: color var(--transition); }
.fl-group a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; text-align: center; }
.footer-bottom p { font-size: 0.82rem; color: var(--text-dim); }

/* ===== TOOL PAGE – SHARED LAYOUT ===== */
.tool-page { min-height: 100vh; padding-top: 80px; }
.tool-hero {
  padding: 60px 24px 40px;
  text-align: center;
  position: relative; overflow: hidden;
}
.tool-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(167,139,250,0.1), transparent 70%);
  pointer-events: none;
}
.tool-hero-icon {
  width: 72px; height: 72px; border-radius: 18px;
  margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(167,139,250,0.15), rgba(99,102,241,0.1));
  border: 1px solid rgba(167,139,250,0.25);
}
.tool-hero-icon svg { width: 36px; height: 36px; }
.tool-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -1px; margin-bottom: 12px; }
.tool-hero p { color: var(--text-muted); font-size: 1rem; max-width: 500px; margin: 0 auto; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
  margin-bottom: 32px; transition: color var(--transition);
}
.back-btn:hover { color: var(--accent); }
.back-btn svg { width: 16px; height: 16px; }

/* UPLOAD ZONE */
.upload-zone {
  border: 2px dashed rgba(167,139,250,0.3);
  border-radius: var(--radius);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: rgba(167,139,250,0.03);
  position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(167,139,250,0.07);
}
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-icon { font-size: 3rem; margin-bottom: 14px; }
.upload-zone h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.upload-zone p { color: var(--text-muted); font-size: 0.875rem; }

/* TOOL AREA */
.tool-area { padding: 0 24px 80px; }
.tool-container { max-width: 860px; margin: 0 auto; }
.tool-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-top: 20px;
}
.panel-title { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 18px; }

/* PAGES GRID */
.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.page-thumb {
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden; cursor: pointer; position: relative;
  transition: var(--transition); aspect-ratio: 3/4;
}
.page-thumb canvas { width: 100% !important; height: 100% !important; object-fit: cover; }
.page-thumb .page-num {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(9,9,15,0.8);
  font-size: 0.72rem; font-weight: 600; padding: 5px;
  text-align: center; backdrop-filter: blur(4px);
}
.page-thumb.selected { border-color: var(--accent); box-shadow: 0 0 16px rgba(167,139,250,0.3); }
.page-thumb.selected::after {
  content: '✓'; position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.page-thumb:hover { border-color: rgba(167,139,250,0.4); transform: scale(1.02); }

/* BUTTONS */
.btn-action {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 600; transition: var(--transition);
}
.btn-action.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: #fff; box-shadow: 0 0 20px rgba(167,139,250,0.25);
}
.btn-action.primary:hover { transform: translateY(-2px); box-shadow: 0 0 30px rgba(167,139,250,0.4); }
.btn-action.secondary {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text-muted);
}
.btn-action.secondary:hover { border-color: var(--border-hover); color: var(--text); }
.btn-action.danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); color: #f87171; }
.btn-action.danger:hover { background: rgba(239,68,68,0.18); }
.btn-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* PROGRESS */
.progress-wrap { margin-top: 20px; }
.progress-bar-outer {
  height: 6px; background: var(--border);
  border-radius: 99px; overflow: hidden;
}
.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent3));
  border-radius: 99px; width: 0%;
  transition: width 0.4s;
}
.progress-text { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; }

/* TOAST */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  padding: 14px 20px; border-radius: var(--radius-sm);
  background: var(--bg3); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  animation: slideIn 0.3s ease-out;
}
.toast.success { border-color: rgba(52,211,153,0.3); }
.toast.error { border-color: rgba(248,113,113,0.3); }
.toast-icon { font-size: 1.1rem; }
@keyframes slideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100px); opacity: 0; }
}

/* OUTPUT IMAGES */
.output-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 20px; }
.output-item { position: relative; }
.output-item img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.output-item a.download-btn {
  display: block; text-align: center; margin-top: 8px;
  padding: 8px; border-radius: var(--radius-xs);
  background: rgba(167,139,250,0.1); border: 1px solid rgba(167,139,250,0.2);
  font-size: 0.78rem; font-weight: 600; color: var(--accent);
  transition: var(--transition);
}
.output-item a.download-btn:hover { background: rgba(167,139,250,0.2); }

/* RANGE / SELECT */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-row label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-row input[type="range"] { accent-color: var(--accent); cursor: pointer; }
.form-row input[type="text"],
.form-row input[type="number"],
.form-row select,
.form-row textarea {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-xs); padding: 10px 14px;
  color: var(--text); font-family: inherit; font-size: 0.9rem;
  transition: border-color var(--transition);
  width: 100%;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { outline: none; border-color: rgba(167,139,250,0.4); }
.form-row select option { background: var(--bg3); }

/* DRAG HANDLE */
.drag-handle { cursor: grab; color: var(--text-dim); padding: 4px; }
.drag-handle:active { cursor: grabbing; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-dim); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .hero { flex-direction: column; gap: 40px; padding: 100px 24px 60px; }
  .hero-visual { display: none; }
  .nav-links, .btn-nav-cta { display: none; }
  .hamburger { display: flex; margin-left: auto; }
  .mobile-menu.open { display: flex; }
  .footer-inner { gap: 40px; }
}
@media (max-width: 600px) {
  .hero-title { letter-spacing: -1px; }
  .hero-stats { gap: 16px; }
  .tools-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .footer-links { gap: 24px; }
  .pages-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}

/* ===================================================
   TOOL LAYOUT — Sidebar + Live Preview (shared)
   =================================================== */
.tl-wrap { display:flex; height:calc(100vh - 64px); overflow:hidden; }

.tl-sidebar {
  width:380px; min-width:300px; max-width:420px; flex-shrink:0;
  background:var(--bg2); border-right:1px solid var(--border);
  display:flex; flex-direction:column; overflow:hidden;
}
.tl-sidebar-scroll {
  flex:1; overflow-y:auto; padding:18px;
  display:flex; flex-direction:column; gap:14px;
}
.tl-sidebar-scroll::-webkit-scrollbar { width:4px; }
.tl-sidebar-scroll::-webkit-scrollbar-thumb { background:var(--accent2); border-radius:4px; }

.tl-head {
  padding:14px 18px 12px; border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:10px; flex-shrink:0;
}
.tl-head-icon {
  width:36px; height:36px; border-radius:9px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
.tl-head h2 { font-size:0.95rem; font-weight:800; letter-spacing:-0.3px; }
.tl-head p  { font-size:0.72rem; color:var(--text-muted); }

.tl-actions {
  padding:12px 18px; border-top:1px solid var(--border);
  display:flex; flex-direction:column; gap:8px; flex-shrink:0;
}

/* Preview Panel */
.tl-preview {
  flex:1; display:flex; flex-direction:column; position:relative;
  background:var(--bg); overflow:hidden;
}
.tl-preview-empty {
  position:absolute; inset:0; z-index:2; pointer-events:none;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:12px;
  color:var(--text-dim); text-align:center;
  background:radial-gradient(ellipse 70% 50% at 50% 30%, rgba(14,14,26,0.95), var(--bg));
}
.tl-preview-empty.hidden { display:none; }
.tl-preview-empty svg { width:50px; height:50px; opacity:0.2; }
.tl-preview-empty p { font-size:0.875rem; max-width:240px; line-height:1.6; }
.tl-preview-label {
  position:absolute; top:12px; left:50%; transform:translateX(-50%);
  background:rgba(9,9,15,0.8); border:1px solid var(--border);
  border-radius:99px; padding:4px 14px; z-index:5;
  font-size:0.7rem; font-weight:600; color:var(--text-muted);
  backdrop-filter:blur(8px); white-space:nowrap;
}
.tl-iframe { width:100%; height:100%; border:none; opacity:0; transition:opacity 0.45s; background:#e5e7eb; }
.tl-iframe.visible { opacity:1; }

/* Image-only preview (for pdf-to-image) */
.tl-img-preview {
  flex:1; overflow-y:auto; padding:16px;
  display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:12px;
}
.tl-img-preview-item img { width:100%; border-radius:8px; border:1px solid var(--border); }
.tl-img-preview-item a {
  display:block; text-align:center; margin-top:6px; padding:6px;
  border-radius:var(--radius-xs); background:rgba(167,139,250,0.08);
  border:1px solid rgba(167,139,250,0.15); font-size:0.75rem; font-weight:600;
  color:var(--accent); transition:var(--transition);
}
.tl-img-preview-item a:hover { background:rgba(167,139,250,0.18); }

/* Loading */
.tl-loading {
  position:absolute; inset:0; z-index:10;
  background:rgba(9,9,15,0.75); backdrop-filter:blur(6px);
  display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:12px; color:var(--text-muted);
}
.tl-loading.hidden { display:none; }
.tl-spinner {
  width:32px; height:32px;
  border:3px solid rgba(167,139,250,0.2);
  border-left-color:var(--accent); border-radius:50%;
  animation:tl-spin 0.85s linear infinite;
}
@keyframes tl-spin { to { transform:rotate(360deg); } }

/* Compact upload zone */
.tl-upload {
  border:2px dashed rgba(167,139,250,0.28); border-radius:var(--radius-sm);
  padding:18px 12px; text-align:center; cursor:pointer; position:relative;
  transition:var(--transition); background:rgba(167,139,250,0.03);
}
.tl-upload:hover,.tl-upload.drag-over { border-color:var(--accent); background:rgba(167,139,250,0.07); }
.tl-upload input[type="file"] { position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%; }
.tl-upload .tl-up-icon { font-size:1.6rem; margin-bottom:5px; }
.tl-upload strong { display:block; font-size:0.85rem; color:var(--text); margin-bottom:2px; }
.tl-upload span { font-size:0.75rem; color:var(--text-muted); }

/* File badge */
.tl-file-badge {
  display:flex; align-items:center; gap:7px;
  background:rgba(167,139,250,0.06); border:1px solid rgba(167,139,250,0.15);
  border-radius:var(--radius-xs); padding:7px 10px; font-size:0.78rem;
}
.tl-fn { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--text); }
.tl-fs { color:var(--text-dim); flex-shrink:0; }

/* Thumbnails grid in sidebar */
.tl-thumbs { display:grid; grid-template-columns:repeat(auto-fill,minmax(82px,1fr)); gap:8px; }
.tl-thumb {
  background:var(--bg3); border:2px solid var(--border);
  border-radius:var(--radius-sm); overflow:hidden;
  cursor:pointer; position:relative;
  transition:var(--transition); aspect-ratio:3/4;
}
.tl-thumb canvas { width:100% !important; height:100% !important; }
.tl-thumb .tl-pnum {
  position:absolute; bottom:0; left:0; right:0;
  background:rgba(9,9,15,0.88); font-size:0.62rem; font-weight:600;
  padding:3px; text-align:center; backdrop-filter:blur(4px);
}
.tl-thumb.selected { border-color:var(--accent); box-shadow:0 0 12px rgba(167,139,250,0.35); }
.tl-thumb.selected::after {
  content:'✓'; position:absolute; top:4px; right:4px;
  width:17px; height:17px; border-radius:50%;
  background:var(--accent); color:#fff; font-size:0.6rem; font-weight:800;
  display:flex; align-items:center; justify-content:center;
}
.tl-thumb:hover { border-color:rgba(167,139,250,0.4); }

/* Labels */
.tl-label { font-size:0.68rem; font-weight:700; text-transform:uppercase; letter-spacing:0.8px; color:var(--text-dim); }

/* Inputs */
.tl-select {
  appearance:none; width:100%; background:var(--bg3); border:1px solid var(--border);
  color:var(--text); border-radius:var(--radius-xs);
  padding:9px 28px 9px 12px; font-family:inherit; font-size:0.85rem;
}
.tl-select:focus { outline:none; border-color:rgba(167,139,250,0.4); }
.tl-input {
  width:100%; background:var(--bg3); border:1px solid var(--border);
  border-radius:var(--radius-xs); padding:9px 12px;
  color:var(--text); font-family:inherit; font-size:0.85rem;
}
.tl-input:focus { outline:none; border-color:rgba(167,139,250,0.4); }

/* Slider card */
.tl-slider-card { background:var(--bg3); border:1px solid var(--border); border-radius:var(--radius-xs); padding:11px 13px; }
.tl-slider-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:7px; }
.tl-slider-head label { font-size:0.7rem; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; }
.tl-slider-head .tl-val { font-size:0.7rem; font-weight:700; color:var(--accent); background:rgba(167,139,250,0.12); padding:1px 7px; border-radius:99px; }

/* Buttons */
.tl-btn-primary {
  width:100%; padding:12px; border-radius:var(--radius-sm);
  background:linear-gradient(135deg,var(--accent),var(--accent3));
  color:#fff; font-size:0.88rem; font-weight:700;
  display:flex; align-items:center; justify-content:center; gap:7px;
  font-family:inherit; border:none; cursor:pointer;
  box-shadow:0 0 18px rgba(167,139,250,0.2); transition:var(--transition);
}
.tl-btn-primary:hover:not(:disabled) { transform:translateY(-2px); box-shadow:0 0 28px rgba(167,139,250,0.35); }
.tl-btn-primary:disabled { background:var(--bg3); color:var(--text-dim); box-shadow:none; cursor:not-allowed; }
.tl-btn-secondary {
  width:100%; padding:9px; border-radius:var(--radius-xs);
  background:rgba(255,255,255,0.04); border:1px solid var(--border);
  color:var(--text-muted); font-size:0.83rem; font-weight:600;
  font-family:inherit; cursor:pointer; transition:var(--transition);
  display:flex; align-items:center; justify-content:center; gap:5px;
}
.tl-btn-secondary:hover { border-color:var(--border-hover); color:var(--text); }
.tl-btn-danger {
  width:100%; padding:9px; border-radius:var(--radius-xs);
  background:rgba(239,68,68,0.08); border:1px solid rgba(239,68,68,0.2);
  color:#f87171; font-size:0.83rem; font-weight:600;
  font-family:inherit; cursor:pointer; transition:var(--transition);
  display:flex; align-items:center; justify-content:center; gap:5px;
}
.tl-btn-danger:hover { background:rgba(239,68,68,0.15); }
.tl-btn-danger:disabled { opacity:0.35; cursor:not-allowed; }

/* Progress bar */
.tl-progress { margin-top:4px; }
.tl-prog-outer { height:4px; background:var(--border); border-radius:99px; overflow:hidden; }
.tl-prog-inner { height:100%; background:linear-gradient(90deg,var(--accent),var(--accent3)); border-radius:99px; width:0%; transition:width 0.3s; }
.tl-prog-text { font-size:0.72rem; color:var(--text-dim); margin-top:4px; }

/* Toggle checkbox */
.tl-toggle {
  display:flex; align-items:center; gap:9px;
  background:var(--bg3); border:1px solid var(--border);
  border-radius:var(--radius-xs); padding:9px 12px; cursor:pointer;
}
.tl-toggle input { accent-color:var(--accent); cursor:pointer; width:14px; height:14px; }
.tl-toggle span { font-size:0.83rem; color:var(--text); font-weight:500; }

/* Responsive */
@media (max-width:900px) {
  .tl-wrap { flex-direction:column; height:auto; }
  .tl-sidebar { width:100%; max-width:100%; border-right:none; border-bottom:1px solid var(--border); max-height:52vh; }
  .tl-preview { min-height:48vh; }
}
