/* ==========================================
   DocCraftr — Shared Tool Styles (tools.css)
   Navbar styles have been moved to nav.css
   ========================================== */

/* @import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap'); */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap');

:root {
  --bg: #f4f2ee;
  --bg2: #ffffff;
  --bg3: #ede9e2;
  --surface: #ffffff;
  --surface2: #f9f7f4;
  --border: #e2ddd6;
  --border2: #ccc7bf;
  --text: #1a1714;
  --text2: #5a534c;
  --text3: #8a8178;
  --accent: #e8450a;
  --accent2: #ff6b35;
  --accent-bg: #fef0eb;
  --accent-border: #f5c4b0;
  --success: #2d8a4e;
  --success-bg: #eaf7ef;
  --warning: #c4830a;
  --warning-bg: #fef8e7;
  --error: #d63f3f;
  --error-bg: #fdf0f0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --nav-h: 64px;
  /* --font-display: 'Syne', sans-serif; */
  /* --font-body: 'DM Sans', sans-serif; */
  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme='dark'] {
  --bg: #111008;
  --bg2: #1a1714;
  --bg3: #221f1a;
  --surface: #1e1b17;
  --surface2: #252119;
  --border: #2e2b25;
  --border2: #3d3930;
  --text: #f0ece4;
  --text2: #a09890;
  --text3: #706860;
  --accent: #ff6b35;
  --accent2: #ff8c5a;
  --accent-bg: #2a1508;
  --accent-border: #5a2a12;
  --success: #4cad6c;
  --success-bg: #0d2b18;
  --warning: #d4930a;
  --warning-bg: #2a1e05;
  --error: #e05555;
  --error-bg: #2a1010;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  transition:
    background var(--transition),
    color var(--transition);
}

/* ==========================================
   PAGE LAYOUT
   ========================================== */

.page-wrap {
  padding-top: calc(var(--nav-h) + 2.5rem);
  padding-bottom: 4rem;
  min-height: 100vh;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================
   PAGE HEADER
   ========================================== */

.tool-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.tool-header .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  margin-bottom: 1rem;
}

.tool-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0.6rem;
  line-height: 1.15;
}

.tool-header p {
  font-size: 1rem;
  color: var(--text2);
  max-width: 520px;
  margin: 0 auto;
  font-weight: 300;
}

/* ==========================================
   DROP ZONE
   ========================================== */

.dropzone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, var(--accent-bg) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition);
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
}

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

.dropzone-icon {
  font-size: 2.8rem;
  margin-bottom: 1rem;
  display: block;
  position: relative;
}

.dropzone h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text);
  position: relative;
}

.dropzone p {
  color: var(--text3);
  font-size: 0.875rem;
  position: relative;
}

.dropzone input[type='file'] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(232, 69, 10, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary:hover {
  background: var(--bg3);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg3);
  color: var(--text);
}

.btn-lg {
  font-size: 1rem;
  padding: 0.8rem 1.75rem;
  border-radius: var(--radius);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ==========================================
   CARD
   ========================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 1.25rem;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ==========================================
   FILE LIST
   ========================================== */

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.file-item:hover {
  border-color: var(--border2);
}

.file-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 16px;
  flex-shrink: 0;
}

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

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

.file-size {
  font-size: 0.75rem;
  color: var(--text3);
}

.file-remove {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 14px;
}

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

/* ==========================================
   OPTIONS / FORM
   ========================================== */

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  margin-bottom: 0.45rem;
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: all var(--transition);
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ==========================================
   PROGRESS BAR
   ========================================== */

.progress-wrap {
  display: none;
  margin-top: 1.5rem;
}

.progress-wrap.show {
  display: block;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text2);
}

.progress-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 100px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 100px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ==========================================
   RESULT ZONE
   ========================================== */

.result-zone {
  display: none;
  margin-top: 1.5rem;
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.result-zone.show {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.result-icon {
  font-size: 1.8rem;
}

.result-info {
  flex: 1;
}

.result-info h4 {
  font-weight: 600;
  color: var(--success);
  margin-bottom: 0.2rem;
}

.result-info p {
  font-size: 0.85rem;
  color: var(--text2);
}

/* ==========================================
   TOAST
   ========================================== */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 9999;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  color: var(--text);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}

.toast.success {
  border-color: var(--success);
}

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

.toast.warning {
  border-color: var(--warning);
}

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

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==========================================
   PREVIEW AREA
   ========================================== */

.preview-container {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 1.25rem;
  min-height: 400px;
  position: relative;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.preview-toolbar-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text2);
  margin-right: auto;
}

.preview-body {
  overflow: auto;
  max-height: 600px;
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-start;
}

.preview-page {
  background: #fff;
  box-shadow: var(--shadow-md);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  transition: all var(--transition);
}

.preview-page canvas {
  display: block;
}

.preview-page .page-num {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 10px;
  color: #999;
  background: rgba(255, 255, 255, 0.85);
  padding: 1px 4px;
  border-radius: 3px;
}

.preview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  gap: 0.75rem;
  font-size: 0.9rem;
}

.preview-empty .icon {
  font-size: 2.5rem;
}

/* ==========================================
   THUMBNAILS
   ========================================== */

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  padding: 1rem;
}

.thumb-item {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: grab;
  transition: all var(--transition);
  position: relative;
}

.thumb-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.thumb-item.selected {
  border-color: var(--accent);
}

.thumb-item canvas {
  width: 100% !important;
  height: auto !important;
  display: block;
}

.thumb-label {
  padding: 0.35rem 0.5rem;
  font-size: 0.72rem;
  color: var(--text2);
  text-align: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.thumb-check {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  display: none;
  align-items: center;
  justify-content: center;
}

.thumb-item.selected .thumb-check {
  display: flex;
}

/* ==========================================
   RANGE SLIDER
   ========================================== */

.range-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.range-group input[type='range'] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
}

.range-val {
  min-width: 42px;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

/* ==========================================
   STEPS INDICATOR
   ========================================== */

.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text3);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.step-label {
  font-size: 0.85rem;
  color: var(--text3);
}

.step.active .step-num {
  background: var(--accent);
  color: #fff;
}

.step.active .step-label {
  color: var(--text);
  font-weight: 500;
}

.step.done .step-num {
  background: var(--success);
  color: #fff;
}

.step-sep {
  flex: 1;
  min-width: 1.5rem;
  height: 1px;
  background: var(--border);
  margin: 0 0.25rem;
}

/* ==========================================
   ALERTS
   ========================================== */

.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.alert-info {
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  color: var(--text);
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: var(--success);
}

.alert-error {
  background: var(--error-bg);
  border: 1px solid var(--error);
  color: var(--error);
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  color: var(--warning);
}

/* ==========================================
   SERVER NOTICE
   ========================================== */

.server-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 1.5rem;
}

.server-notice strong {
  color: var(--accent);
  display: block;
  margin-bottom: 0.15rem;
}

/* ==========================================
   MISC UTILITIES
   ========================================== */

.multi-upload-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* ==========================================
   FOOTER
   ========================================== */

.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text2);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--text2);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
  .container,
  .container-wide {
    padding: 0 1rem;
  }

  .tool-header h1 {
    font-size: 1.6rem;
  }

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

  .thumb-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }

  .preview-body {
    max-height: 400px;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .page-wrap {
    padding-top: calc(var(--nav-h) + 1.5rem);
  }

  .dropzone {
    padding: 2.5rem 1.25rem;
  }

  .card {
    padding: 1.25rem;
  }
}
