/* ==========================================================================
   PDF Merger & Page Numberer - Modern Clean Stylesheet
   ========================================================================== */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Light Theme Palette */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-active: #1e40af;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-hover: #dc2626;

  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --modal-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --header-height: 68px;
  --footer-height: 76px;
}

body.theme-dark {
  --bg-body: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-subtle: #1f2937;
  --bg-surface-hover: #374151;
  --border-color: #1f2937;
  --border-focus: #60a5fa;

  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-active: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.12);
  --primary-border: rgba(59, 130, 246, 0.3);

  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

html, body {
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Header
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
}

.header-container {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text .accent-text {
  color: var(--primary);
  font-weight: 800;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-pro {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.privacy-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface-subtle);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
}

.privacy-pill svg {
  color: var(--success);
}

.icon-btn {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

/* ==========================================================================
   Alert Banner
   ========================================================================== */
.alert-banner {
  background-color: #fffbeb;
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  padding: 10px 24px;
  font-size: 0.88rem;
}

.banner-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Main Layout & Panels
   ========================================================================== */
.main-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 20px 24px;
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 28px;
}

@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.panel-title-group h2 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.summary-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid var(--primary-border);
  white-space: nowrap;
}

/* ==========================================================================
   Left Panel: Dropzone & File List
   ========================================================================== */
.dropzone {
  margin: 20px 24px 16px 24px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface-subtle);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.dropzone:hover,
.dropzone.drag-active {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.dropzone.drag-active {
  transform: scale(0.99);
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.upload-icon-wrapper {
  width: 60px;
  height: 60px;
  background-color: var(--bg-surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
}

.dropzone h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.dropzone-hint {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

.dropzone-tags {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 9999px;
  font-weight: 500;
}

/* Files Toolbar */
.files-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 12px 24px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* File List */
.file-list {
  padding: 0 24px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 540px;
  overflow-y: auto;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: all 0.2s ease;
  user-select: none;
}

.file-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--card-shadow);
}

.file-card.dragging {
  opacity: 0.4;
  border-style: dashed;
}

.drag-handle {
  cursor: grab;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  padding: 4px;
}

.drag-handle:active {
  cursor: grabbing;
}

.file-order-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--bg-surface-subtle);
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-thumb-container {
  width: 44px;
  height: 56px;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.file-thumb-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-thumb-fallback {
  color: var(--primary);
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.meta-pill {
  background-color: var(--bg-surface-subtle);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-icon-btn:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

.action-icon-btn.danger-hover:hover {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.action-icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Empty State */
.empty-state {
  padding: 32px 24px 40px 24px;
  text-align: center;
  color: var(--text-dim);
}

.empty-art {
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state p {
  font-size: 0.9rem;
}

/* ==========================================================================
   Right Panel: Page Numbering Settings
   ========================================================================== */
.settings-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.settings-content.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sub-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.help-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.help-text strong {
  color: var(--primary);
  font-family: var(--font-mono);
}

/* Position Grid */
.position-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pos-btn {
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.pos-btn:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--primary-border);
}

.pos-btn.active {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.pos-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background-color: transparent;
}

.pos-btn.active .pos-dot {
  background-color: currentColor;
}

/* Inputs & Form Elements */
.form-select, .form-input {
  width: 100%;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select-sm {
  padding: 8px 10px;
  font-size: 0.82rem;
}

.form-select:focus, .form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  background-color: var(--bg-surface);
}

.custom-format-row {
  margin-top: 6px;
}

.input-hint {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.input-hint code {
  font-family: var(--font-mono);
  background: var(--bg-surface-subtle);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--primary);
}

.setting-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.setting-row-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.form-slider {
  width: 100%;
  accent-color: var(--primary);
  height: 6px;
  border-radius: 3px;
  background-color: var(--border-color);
  cursor: pointer;
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: transparent;
  padding: 0;
}

.color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input::-webkit-color-swatch {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.color-hex {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.divider-top {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

/* Checkbox */
.checkbox-group {
  margin-top: -4px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

/* Switch */
.switch-control {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch-control input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .switch-slider {
  background-color: var(--primary);
}

input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* Live Simulation Sheet */
.preview-card {
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px;
}

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

.preview-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.preview-status {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
}

.preview-sheet-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

.simulated-page {
  width: 180px;
  height: 240px;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  position: relative;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

body.theme-dark .simulated-page {
  background-color: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sim-line {
  height: 5px;
  background-color: #e2e8f0;
  border-radius: 3px;
  width: 100%;
}

body.theme-dark .sim-line {
  background-color: #334155;
}

.sim-title {
  width: 60%;
  height: 8px;
  background-color: #94a3b8;
  margin-bottom: 6px;
}

.sim-short {
  width: 45%;
}

.sim-page-number {
  position: absolute;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  transition: all 0.2s ease;
}

/* Simulated Page Position Classes */
.sim-page-number.pos-bottom-center {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}
.sim-page-number.pos-bottom-right {
  bottom: 8px;
  right: 12px;
  transform: none;
}
.sim-page-number.pos-bottom-left {
  bottom: 8px;
  left: 12px;
  transform: none;
}
.sim-page-number.pos-top-center {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}
.sim-page-number.pos-top-right {
  top: 8px;
  right: 12px;
  transform: none;
}
.sim-page-number.pos-top-left {
  top: 8px;
  left: 12px;
  transform: none;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  background-color: var(--primary-active);
  transform: translateY(0);
}

.btn-primary:disabled {
  background-color: var(--bg-surface-hover);
  color: var(--text-dim);
  box-shadow: none;
  cursor: not-allowed;
}

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

.btn-secondary:hover {
  background-color: var(--bg-surface-subtle);
  border-color: var(--border-focus);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background-color: var(--bg-surface-subtle);
  color: var(--text-main);
}

.btn-danger-ghost:hover {
  background-color: var(--danger-bg);
  color: var(--danger);
}

/* ==========================================================================
   Sticky Bottom Action Footer
   ========================================================================== */
.action-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-height);
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
  z-index: 40;
}

.footer-container {
  max-width: 1400px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-status {
  display: flex;
  align-items: center;
}

.footer-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-dim);
}

.footer-text.ready .status-indicator {
  background-color: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.footer-text.ready {
  color: var(--text-main);
  font-weight: 600;
}

.footer-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
  opacity: 0;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--modal-shadow);
  text-align: center;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.modal-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal-subtext {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background-color: var(--bg-surface-subtle);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  border-radius: 4px;
  transition: width 0.2s ease;
}

.progress-stats {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-mono);
}

/* Success Modal Details */
.success-icon-wrap {
  width: 68px;
  height: 68px;
  background-color: var(--success-bg);
  color: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}

.result-details-box {
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 20px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.detail-value {
  font-size: 0.95rem;
  font-weight: 700;
}

.text-success {
  color: var(--success);
}

.detail-divider {
  width: 1px;
  height: 28px;
  background-color: var(--border-color);
}

.filename-input-group {
  text-align: left;
  margin-bottom: 24px;
}

.filename-input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-with-extension {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.input-with-extension .form-input {
  border: none;
  background: transparent;
  flex: 1;
}

.input-with-extension .form-input:focus {
  box-shadow: none;
}

.extension-badge {
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  background-color: var(--bg-surface-hover);
  height: 100%;
  display: flex;
  align-items: center;
  border-left: 1px solid var(--border-color);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-actions-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ==========================================================================
   Privacy Hero Banner
   ========================================================================== */
.privacy-hero-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(16, 185, 129, 0.08));
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
}

body.theme-dark .privacy-hero-banner {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(16, 185, 129, 0.1));
}

.privacy-hero-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.privacy-hero-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.privacy-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

body.theme-dark .privacy-hero-badge {
  background-color: rgba(16, 185, 129, 0.15);
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.privacy-hero-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.privacy-hero-desc strong {
  color: var(--text-main);
}

.btn-privacy-learn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  color: var(--primary);
  border: 1px solid var(--primary-border);
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-privacy-learn:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
}

/* Dropzone Privacy Tag */
.tag-privacy {
  background-color: var(--success-bg) !important;
  color: var(--success) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

body.theme-dark .tag-privacy {
  background-color: rgba(16, 185, 129, 0.15) !important;
}

/* ==========================================================================
   Privacy Trust & Comparison Section
   ========================================================================== */
.privacy-trust-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px calc(var(--footer-height) + 54px) 24px;
}

.privacy-trust-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  box-shadow: var(--card-shadow);
}

.privacy-trust-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.trust-badge-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.privacy-trust-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.privacy-trust-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.privacy-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .privacy-comparison-grid {
    grid-template-columns: 1fr;
  }
}

.comparison-card {
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cloud-tool-card {
  background-color: rgba(239, 68, 68, 0.03);
  border-color: rgba(239, 68, 68, 0.2);
}

body.theme-dark .cloud-tool-card {
  background-color: rgba(239, 68, 68, 0.08);
}

.local-tool-card {
  background-color: rgba(16, 185, 129, 0.04);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.06);
}

body.theme-dark .local-tool-card {
  background-color: rgba(16, 185, 129, 0.1);
}

.comp-card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comp-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 9999px;
  align-self: flex-start;
}

.badge-cloud {
  background-color: #fee2e2;
  color: #b91c1c;
}

body.theme-dark .badge-cloud {
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.badge-local {
  background-color: #d1fae5;
  color: #047857;
}

body.theme-dark .badge-local {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.comp-card-header h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.comp-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comp-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.comp-item strong {
  color: var(--text-main);
}

.comp-icon {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.2;
}

.comp-item.danger .comp-icon {
  color: var(--danger);
}

.comp-item.success .comp-icon {
  color: var(--success);
}

/* Footer Privacy Tag */
.footer-privacy-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--success);
  font-weight: 600;
  background-color: var(--success-bg);
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  margin-left: 12px;
}

body.theme-dark .footer-privacy-tag {
  background-color: rgba(16, 185, 129, 0.15);
}

.privacy-dot-green {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
}

/* Success Modal Privacy Seal */
.success-privacy-seal {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #065f46;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.8rem;
  margin-bottom: 20px;
  text-align: left;
}

body.theme-dark .success-privacy-seal {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.success-privacy-seal svg {
  color: var(--success);
  flex-shrink: 0;
}

/* Privacy Explainer Modal */
.modal-privacy-explainer {
  max-width: 580px;
  text-align: left;
}

.modal-privacy-icon-wrap {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
}

.modal-privacy-explainer h3 {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal-privacy-explainer .modal-subtext {
  text-align: center;
  margin-bottom: 24px;
}

.privacy-points-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.privacy-point-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.point-number {
  width: 28px;
  height: 28px;
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.point-content h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.point-content p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.point-content code {
  font-family: var(--font-mono);
  background-color: var(--bg-surface-hover);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.8em;
}

/* ==========================================================================
   High-Profit AdSense Monetization Styles
   ========================================================================== */
.ad-outer-wrapper {
  max-width: 1400px;
  margin: 16px auto 0 auto;
  padding: 0 24px;
}

.ad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  text-align: center;
  overflow: hidden;
  margin: 12px auto;
  width: 100%;
}

.ad-label {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 4px;
  user-select: none;
  display: none;
}

/* Show the label only when an actual ad iframe has rendered or filled */
.ad-container:has(ins.adsbygoogle[data-ad-status="filled"]) .ad-label,
.ad-container:has(ins.adsbygoogle iframe) .ad-label {
  display: block;
}

/* Collapse ad container cleanly when unfilled or pending */
ins.adsbygoogle[data-ad-status="unfilled"],
.ad-container:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
  display: none !important;
}

.ad-top-banner {
  max-width: 970px;
}

.ad-sidebar-banner {
  margin-top: 14px;
  max-width: 336px;
}

.ad-modal-banner {
  margin: 14px 0 18px 0;
  max-width: 336px;
}

/* ==========================================================================
   Footer Legal & Policy Navigation
   ========================================================================== */
.site-footer-nav {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.legal-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.legal-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.link-dot {
  color: var(--text-dim);
}

/* Responsive Helper Elements */
.pill-text-desktop,
.privacy-text-desktop,
.btn-text-desktop,
.merge-text-desktop {
  display: inline;
}

.pill-text-mobile,
.privacy-text-mobile,
.btn-text-mobile,
.merge-text-mobile {
  display: none;
}

/* Smooth Scrolling & Anchor Clearance */
html {
  scroll-padding-bottom: 140px;
}

/* ==========================================================================
   Mobile & Smartphone Responsive Styles (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  :root {
    --header-height: 58px;
    --footer-height: 114px;
  }

  /* Toggle desktop / mobile text spans */
  .pill-text-desktop,
  .privacy-text-desktop,
  .btn-text-desktop,
  .merge-text-desktop {
    display: none !important;
  }

  .pill-text-mobile,
  .privacy-text-mobile,
  .btn-text-mobile,
  .merge-text-mobile {
    display: inline !important;
  }

  /* Footer clearance so bottom sticky bar never overlaps content or legal links */
  .privacy-trust-section {
    padding: 0 16px calc(var(--footer-height) + 36px) 16px;
  }

  /* Sticky Action Footer Ergonomics for Smartphones */
  .action-footer {
    height: auto;
    padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px)) 14px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  }

  .footer-container {
    flex-direction: column;
    gap: 8px;
    height: auto;
    padding: 0;
  }

  .footer-status {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .footer-text {
    font-size: 0.78rem;
    max-width: 62%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .footer-privacy-tag {
    margin-left: 0;
    padding: 2px 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .footer-buttons {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  #generateTestFilesBtn {
    flex: 0 0 auto;
    padding: 10px 12px;
    font-size: 0.8rem;
    height: 44px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface-subtle);
    border-radius: var(--radius-md);
  }

  #mergeBtn {
    flex: 1;
    min-height: 44px;
    padding: 0 16px;
    font-size: 0.92rem;
    font-weight: 700;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  }

  /* Mobile Header Adjustments */
  .app-header {
    height: var(--header-height);
  }

  .header-container {
    padding: 0 14px;
  }

  .logo-icon {
    width: 34px;
    height: 34px;
  }

  .logo-icon svg {
    width: 20px;
    height: 20px;
  }

  .brand-text h1 {
    font-size: 1.1rem;
  }

  .badge-pro {
    font-size: 0.65rem;
    padding: 1px 6px;
  }

  .privacy-pill {
    padding: 4px 8px;
    font-size: 0.74rem;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  /* Privacy Hero Banner */
  .privacy-hero-banner {
    padding: 10px 14px;
  }

  .privacy-hero-container {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .privacy-hero-desc {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .btn-privacy-learn {
    width: 100%;
    justify-content: center;
    padding: 8px;
    font-size: 0.8rem;
  }

  /* Main Layout & Panels */
  .main-layout {
    padding: 16px 12px 16px 12px;
    gap: 16px;
  }

  .panel {
    border-radius: var(--radius-lg);
  }

  .panel-header {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .panel-title-group h2 {
    font-size: 1.05rem;
  }

  .panel-subtitle {
    font-size: 0.8rem;
  }

  /* Dropzone on Mobile */
  .dropzone {
    margin: 14px 14px 12px 14px;
    padding: 22px 14px;
  }

  .upload-icon-wrapper {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
  }

  .upload-icon-wrapper svg {
    width: 24px;
    height: 24px;
  }

  .dropzone-title {
    font-size: 0.95rem;
  }

  .dropzone-desc {
    font-size: 0.78rem;
  }

  /* File cards */
  .file-list {
    padding: 0 14px 14px 14px;
    gap: 8px;
    max-height: 420px;
  }

  .file-card {
    padding: 8px 10px;
    gap: 8px;
  }

  .file-thumb-container {
    width: 36px;
    height: 48px;
  }

  .file-name {
    font-size: 0.84rem;
  }

  .file-meta {
    font-size: 0.72rem;
    gap: 6px;
  }

  .action-icon-btn {
    width: 32px;
    height: 32px;
  }

  /* Settings body */
  .settings-body {
    padding: 16px 14px;
    gap: 16px;
  }

  .setting-group-title {
    font-size: 0.85rem;
  }

  .setting-row-2col,
  .setting-row-3col {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .position-grid {
    gap: 6px;
  }

  .pos-btn {
    padding: 8px 4px;
    font-size: 0.74rem;
  }

  .pos-dot {
    width: 10px;
    height: 10px;
  }

  .simulated-page {
    width: 140px;
    height: 186px;
  }

  /* Trust section */
  .privacy-trust-container {
    padding: 20px 16px;
    border-radius: var(--radius-lg);
  }

  .privacy-trust-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }

  .privacy-trust-header h3 {
    font-size: 1.15rem;
  }

  .comp-box {
    padding: 16px 14px;
    border-radius: var(--radius-md);
  }

  .comp-item {
    font-size: 0.82rem;
    gap: 8px;
  }

  /* Legal navigation footer */
  .site-footer-nav {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding-top: 16px;
  }

  .legal-nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
  }

  .legal-link {
    font-size: 0.82rem;
    padding: 4px 6px;
  }

  /* Modals */
  .modal-card {
    padding: 24px 18px;
    max-width: 95%;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
  }

  .modal-privacy-explainer {
    padding: 22px 14px;
  }

  .privacy-point-card {
    padding: 12px 10px;
    gap: 10px;
  }
}

/* ==========================================================================
   Ultra-Small Phones (max-width: 420px)
   ========================================================================== */
@media (max-width: 420px) {
  .badge-pro {
    display: none;
  }

  .privacy-pill span {
    display: none !important;
  }

  .privacy-pill {
    padding: 6px;
  }

  .footer-text {
    max-width: 52%;
    font-size: 0.72rem;
  }

  .footer-privacy-tag {
    font-size: 0.68rem;
    padding: 2px 6px;
  }

  #mergeBtn {
    font-size: 0.86rem;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}
