/* ============================================
   PDF Tools Matrix - Design System
   Taste-skill: Clean, professional, trust-first
   Dials: VARIANCE=6, MOTION=4, DENSITY=3
   ============================================ */

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

:root {
  /* Color System - Neutral base with blue accent */
  --color-bg: #fafbfc;
  --color-surface: #ffffff;
  --color-surface-hover: #f6f8fa;
  --color-border: #e1e4e8;
  --color-border-light: #eaeef2;

  /* Text */
  --color-text: #1a1a2e;
  --color-text-secondary: #586069;
  --color-text-tertiary: #8b949e;

  /* Accent - Professional Blue */
  --color-accent: #0969da;
  --color-accent-hover: #0860ca;
  --color-accent-subtle: #ddf4ff;
  --color-accent-glow: rgba(9, 105, 218, 0.12);

  /* Semantic */
  --color-success: #1a7f37;
  --color-error: #cf222e;
  --color-warning: #bf8700;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Typography */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 0 3px var(--color-accent-glow);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

/* === Base Styles === */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-accent-hover);
}

/* === Layout === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

/* === Navbar === */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 251, 252, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border-light);
  padding: var(--space-md) 0;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--color-accent);
  border-radius: 2px;
  transform: rotate(45deg);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: var(--space-xs);
}

.nav-links a {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
}

.nav-links a:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

/* === Hero Section === */
.hero {
  padding: var(--space-4xl) 0 var(--space-3xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    ellipse at center,
    var(--color-accent-subtle) 0%,
    transparent 60%
  );
  opacity: 0.5;
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(var(--text-4xl), 5vw, var(--text-6xl));
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: var(--space-lg);
  position: relative;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--color-accent), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  max-width: 540px;
  margin: 0 auto var(--space-2xl);
  position: relative;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  position: relative;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.badge-icon {
  width: 16px;
  height: 16px;
  color: var(--color-success);
}

/* === Tools Section === */
.tools-section {
  padding: var(--space-3xl) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-header h2 {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
}

.section-header p {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
}

/* === Tools Grid === */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

/* === Tool Card === */
.tool-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease-out);
}

.tool-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-icon-wrapper {
  width: 48px;
  height: 48px;
  background: var(--color-accent-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  font-size: 24px;
}

.tool-card h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-xs);
  letter-spacing: -0.01em;
}

.tool-card p {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-bottom: var(--space-lg);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  border: none;
  text-decoration: none;
  line-height: 1.5;
}

.btn-primary {
  background: var(--color-accent);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  color: white;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-text-tertiary);
}

.btn-block {
  width: 100%;
}

/* === Features Section === */
.features-section {
  padding: var(--space-3xl) 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-xl);
}

.feature-item {
  text-align: center;
  padding: var(--space-lg);
}

.feature-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto var(--space-md);
  background: var(--color-accent-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.feature-item h3 {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.feature-item p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* === Footer === */
.footer {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border-light);
  text-align: center;
}

.footer p {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

/* === Upload Area === */
.upload-area {
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-4xl) var(--space-xl);
  text-align: center;
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  position: relative;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.upload-area.dragover {
  transform: scale(1.01);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.8;
}

.upload-text {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.upload-hint {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
}

.file-input {
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  z-index: -1;
}

/* === File List === */
.file-list {
  margin: var(--space-lg) 0;
}

.file-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--duration-fast) var(--ease-out);
}

.file-item:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.file-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.file-size {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-left: var(--space-sm);
}

.file-remove {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--duration-fast) var(--ease-out);
}

.file-remove:hover {
  background: var(--color-error);
  color: white;
}

/* === Progress Bar === */
.progress-container {
  margin: var(--space-lg) 0;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-out);
  width: 0%;
}

.progress-text {
  text-align: center;
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* === Process Button === */
.process-btn {
  width: 100%;
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-sans);
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.process-btn:hover:not(:disabled) {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.process-btn:disabled {
  background: var(--color-border);
  color: var(--color-text-tertiary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* === Tool Page === */
.tool-page {
  padding: var(--space-3xl) 0;
  min-height: calc(100vh - 200px);
}

.tool-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.tool-header h1 {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
}

.tool-header p {
  color: var(--color-text-secondary);
  font-size: var(--text-base);
}

/* === Messages === */
.message {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  color: white;
  font-weight: 600;
  font-size: var(--text-sm);
  z-index: 10000;
  animation: slideIn var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-lg);
}

.message-success {
  background: var(--color-success);
}

.message-error {
  background: var(--color-error);
}

.message-info {
  background: var(--color-accent);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* === Responsive === */
@media (max-width: 1024px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .navbar .container {
    flex-direction: column;
    gap: var(--space-md);
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  .hero {
    padding: var(--space-3xl) 0 var(--space-2xl);
  }

  .hero h1 {
    font-size: var(--text-3xl);
  }

  .hero-badges {
    flex-direction: column;
    align-items: center;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .upload-area {
    padding: var(--space-2xl) var(--space-lg);
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-md);
  }

  .hero h1 {
    font-size: var(--text-2xl);
  }

  .tool-card {
    padding: var(--space-lg);
  }
}
