:root {
  --bg-primary: #0b0f17;
  --bg-secondary: #131b2e;
  --bg-card: #161f33;
  --bg-card-hover: #1c2842;
  --bg-surface: #0f1626;
  --border-color: rgba(148, 163, 184, 0.14);
  --border-highlight: rgba(16, 185, 129, 0.45);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #10b981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --indigo-primary: #6366f1;
  --indigo-soft: rgba(99, 102, 241, 0.14);
  --amber-primary: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --rose-primary: #f43f5e;
  --rose-soft: rgba(244, 63, 94, 0.14);
  --cyan-primary: #06b6d4;
  --cyan-soft: rgba(6, 182, 212, 0.14);
  --shadow-lg: 0 20px 45px -15px rgba(0, 0, 0, 0.6);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-surface: #f1f5f9;
  --border-color: rgba(15, 23, 42, 0.1);
  --border-highlight: rgba(16, 185, 129, 0.5);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --shadow-lg: 0 16px 36px -12px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 23, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 0;
}

[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.85);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-primary), var(--indigo-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.74rem;
  color: var(--accent-primary);
  font-weight: 600;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border-highlight);
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

/* Hero Section */
.hero {
  padding: 48px 0 28px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--indigo-soft);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 18px;
}

[data-theme="light"] .hero-badge {
  color: #4f46e5;
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 14px;
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg, #10b981 0%, #38bdf8 50%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  max-width: 720px;
  margin: 0 auto 28px;
  color: var(--text-secondary);
  font-size: 1.03rem;
}

.trust-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 32px;
}

.trust-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.trust-item strong {
  color: var(--text-primary);
}

/* Filter & Search Bar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.tab-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
}

.search-box {
  position: relative;
  min-width: 260px;
  flex: 1;
  max-width: 340px;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: var(--accent-primary);
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
  gap: 18px;
  margin-bottom: 48px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

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

.tool-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.tool-icon.cat-office {
  background: var(--indigo-soft);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.tool-icon.cat-pdf {
  background: var(--rose-soft);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.tool-icon.cat-image {
  background: var(--cyan-soft);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.tool-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.tool-title {
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.tool-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.tool-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--accent-primary);
  font-weight: 600;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

/* Workspace Section (Active Tool View) */
.workspace-overlay {
  display: none;
  margin-bottom: 56px;
}

.workspace-overlay.active {
  display: block;
}

.workspace-card {
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.workspace-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.workspace-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.workspace-title {
  font-size: 1.35rem;
  font-weight: 800;
}

.workspace-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.btn-back {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.15s ease;
}

.btn-back:hover {
  border-color: var(--rose-primary);
  color: var(--rose-primary);
}

/* Dropzone */
.dropzone {
  border: 2px dashed rgba(16, 185, 129, 0.45);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 24px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
}

.dropzone-icon {
  font-size: 2.3rem;
  margin-bottom: 10px;
  display: block;
}

.dropzone-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.dropzone-hint {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
}

/* Selected Files List */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.file-ext-badge {
  background: var(--indigo-soft);
  color: #818cf8;
  font-weight: 800;
  font-size: 0.74rem;
  padding: 5px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.file-name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-mini {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.btn-mini:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.btn-mini.danger:hover {
  color: var(--rose-primary);
  border-color: var(--rose-primary);
}

/* Tool Options Panel */
.options-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.options-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-primary);
}

/* Progress & Result Panel */
.progress-box {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}

.progress-box.active {
  display: block;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: var(--bg-card);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-primary), var(--indigo-primary));
  transition: width 0.2s ease;
}

.results-box {
  display: none;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 20px;
}

.results-box.active {
  display: block;
}

.results-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.results-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-primary);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

.result-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-filename {
  font-weight: 700;
  font-size: 0.92rem;
}

.result-stats {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.toast {
  background: var(--bg-card);
  border-left: 4px solid var(--accent-primary);
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  font-weight: 600;
}

.toast.error {
  border-left-color: var(--rose-primary);
}

/* Hidden offscreen render stage for DOCX/XLSX to PDF */
.render-stage {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 794px;
  background: #ffffff;
  color: #0f172a;
  padding: 40px;
  font-family: Arial, Helvetica, sans-serif;
  z-index: -1;
}

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 28px 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .navbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .workspace-card {
    padding: 18px;
  }
}
