/* =============================================
   PDF Tools — Shared Design System
   ============================================= */

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

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

:root {
  --bg-deep:        #0a0812;
  --bg-surface:     #100e1a;
  --bg-card:        rgba(255,255,255,0.04);
  --bg-card-hover:  rgba(255,255,255,0.08);
  --border:         rgba(255,255,255,0.08);
  --border-accent:  rgba(124,58,237,0.5);

  --violet:         #7c3aed;
  --violet-light:   #a78bfa;
  --cyan:           #06b6d4;
  --cyan-light:     #67e8f9;
  --pink:           #ec4899;
  --green:          #10b981;
  --red:            #ef4444;
  --orange:         #f59e0b;

  --grad-primary: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  --grad-bg:      radial-gradient(ellipse 80% 60% at 50% -10%, rgba(124,58,237,0.3) 0%, transparent 70%),
                  radial-gradient(ellipse 60% 40% at 90% 80%, rgba(6,182,212,0.15) 0%, transparent 60%),
                  #0a0812;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-card: 0 4px 32px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.06) inset;
  --shadow-glow: 0 0 40px rgba(124,58,237,0.25);
  --shadow-cyan: 0 0 40px rgba(6,182,212,0.2);

  --transition: all 0.22s cubic-bezier(0.4,0,0.2,1);
  --transition-spring: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--grad-bg);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--violet); border-radius: 99px; }

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(10,8,18,0.7);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text-primary);
  flex-shrink: 0;
}

.nav-logo .logo-icon {
  width: 34px;
  height: 34px;
  background: var(--grad-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 0 16px rgba(124,58,237,0.5);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  flex: 1;
  overflow-x: auto;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.nav-links a.active {
  background: rgba(124,58,237,0.2);
  color: var(--violet-light);
}

/* ── Page Layout ── */
.page-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

/* ── Page Header ── */
.page-header {
  text-align: center;
  margin-bottom: 3rem;
}

.page-header .tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}

.badge-violet { background: rgba(124,58,237,0.15); border-color: rgba(124,58,237,0.4); color: var(--violet-light); }
.badge-cyan   { background: rgba(6,182,212,0.15);  border-color: rgba(6,182,212,0.4);  color: var(--cyan-light); }
.badge-pink   { background: rgba(236,72,153,0.15); border-color: rgba(236,72,153,0.4); color: #f9a8d4; }
.badge-green  { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.4); color: #6ee7b7; }

.page-header h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.75rem;
  line-height: 1.15;
}

.page-header p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
}

/* ── Glass Card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}

.card:hover { border-color: var(--border-accent); }

/* ── Drop Zone ── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-primary);
  opacity: 0;
  transition: opacity 0.3s;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--violet);
  box-shadow: 0 0 30px rgba(124,58,237,0.2);
}

.dropzone:hover::before,
.dropzone.drag-over::before { opacity: 0.04; }

.dropzone.drag-over { border-style: solid; }

.dropzone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  background: rgba(124,58,237,0.12);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  position: relative;
  z-index: 1;
  transition: var(--transition-spring);
}

.dropzone:hover .dropzone-icon { transform: scale(1.1) translateY(-2px); }

.dropzone-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  position: relative;
  z-index: 1;
}

.dropzone-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
}

.dropzone-sub span {
  color: var(--violet-light);
  font-weight: 500;
}

input[type="file"] { display: none; }

/* ── File List ── */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: grab;
}

.file-item:active { cursor: grabbing; }
.file-item.dragging { opacity: 0.4; }
.file-item.drag-target { border-color: var(--violet); background: rgba(124,58,237,0.08); }

.file-item:hover { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.15); }

.file-icon { font-size: 1.4rem; flex-shrink: 0; }

.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 0.875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.file-drag-handle {
  color: var(--text-muted);
  cursor: grab;
  padding: 4px;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.file-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 1rem;
  transition: var(--transition);
  flex-shrink: 0;
}
.file-remove:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ── Options / Controls ── */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.option-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.option-group select,
.option-group input[type="range"] {
  width: 100%;
}

select {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.6rem 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  cursor: pointer;
  margin: 8px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--grad-primary);
  box-shadow: 0 0 8px rgba(124,58,237,0.6);
  transition: transform 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(124,58,237,0.5); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; pointer-events: none; }

.btn-secondary {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2); }

.btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 4px 20px rgba(16,185,129,0.35);
}
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(16,185,129,0.45); }

.btn-danger {
  background: rgba(239,68,68,0.12);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }
.btn-lg { padding: 1rem 2.5rem; font-size: 1rem; }
.btn-full { width: 100%; }

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

/* ── Progress ── */
.progress-wrapper { margin-top: 1.5rem; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.progress-bar-bg {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: 99px;
  transition: width 0.3s ease;
  width: 0%;
  box-shadow: 0 0 12px rgba(124,58,237,0.6);
}

/* ── Stats Row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.stat-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}
.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Result / Preview ── */
.result-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: none;
}
.result-section.visible { display: block; }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.preview-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}
.preview-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.3); }

.preview-card canvas,
.preview-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.preview-card-footer {
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.preview-card-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  backdrop-filter: blur(12px);
  border: 1px solid transparent;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  max-width: 360px;
}

.toast-success { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.toast-error   { background: rgba(239,68,68,0.15);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.toast-info    { background: rgba(124,58,237,0.15); border-color: rgba(124,58,237,0.3); color: var(--violet-light); }

@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slideOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(120%); opacity: 0; }
}
.toast.out { animation: slideOut 0.25s ease forwards; }

/* ── Spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Section Headings ── */
.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ── Home Page Cards ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem 1.75rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition-spring);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.tool-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-primary);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 0;
}
.tool-card:hover::after { opacity: 0.06; }
.tool-card:hover { transform: translateY(-6px); border-color: var(--border-accent); box-shadow: var(--shadow-glow); }
.tool-card > * { position: relative; z-index: 1; }

.tool-card-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.tool-card-icon.violet { background: rgba(124,58,237,0.2); }
.tool-card-icon.cyan   { background: rgba(6,182,212,0.2); }
.tool-card-icon.pink   { background: rgba(236,72,153,0.2); }
.tool-card-icon.green  { background: rgba(16,185,129,0.2); }

.tool-card h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.tool-card p  { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; flex: 1; }

.tool-card-arrow {
  align-self: flex-start;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: transform 0.3s;
}
.tool-card:hover .tool-card-arrow { transform: translate(4px, -4px); color: var(--violet-light); }

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 5rem 1.5rem 0;
  max-width: 720px;
  margin: 0 auto;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 99px;
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.25);
  color: var(--violet-light);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}
.hero h1 .grad {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto;
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}
footer a { color: var(--violet-light); text-decoration: none; }

/* ── Thumbnail image preview ── */
.img-thumb {
  width: 60px; height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .nav-inner { gap: 1rem; }
  .page-wrapper { padding: 2rem 1rem 4rem; }
  .card { padding: 1.25rem; }
  .btn-group { flex-direction: column; }
  .btn-group .btn { width: 100%; }
}
