/* =============================================================
   PDFCraft Pro — Frontend Styles
   Design: Dark minimal, clean geometry, accent highlights
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --pc-bg:          #0f0f13;
  --pc-surface:     #18181f;
  --pc-surface-2:   #22222c;
  --pc-border:      #2e2e3a;
  --pc-text:        #e8e8f0;
  --pc-muted:       #7a7a95;
  --pc-accent:      #00d4aa;
  --pc-accent-rgb:  0, 212, 170;
  --pc-brand:       #1a1a2e;
  --pc-radius:      12px;
  --pc-radius-lg:   18px;
  --pc-shadow:      0 4px 24px rgba(0,0,0,0.35);
  --pc-transition:  0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --pc-font-body:   'DM Sans', system-ui, sans-serif;
  --pc-font-head:   'Space Grotesk', system-ui, sans-serif;
}

/* ── Reset ────────────────────────────────────────────── */
.pdfcraft-hub,
.pdfcraft-single-tool,
.pdfcraft-widget {
  box-sizing: border-box;
  font-family: var(--pc-font-body);
  color: var(--pc-text);
  -webkit-font-smoothing: antialiased;
}

.pdfcraft-hub *,
.pdfcraft-single-tool *,
.pdfcraft-widget * {
  box-sizing: border-box;
}

/* ── Hero ─────────────────────────────────────────────── */
.pdfcraft-hero {
  text-align: center;
  padding: 56px 24px 48px;
  background: linear-gradient(160deg, #0f0f13 0%, #1a1a2e 50%, #0f0f13 100%);
  border-radius: var(--pc-radius-lg);
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.pdfcraft-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(var(--pc-accent-rgb), 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.pdfcraft-hero-badge {
  display: inline-block;
  background: rgba(var(--pc-accent-rgb), 0.12);
  color: var(--pc-accent);
  border: 1px solid rgba(var(--pc-accent-rgb), 0.25);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.pdfcraft-hero-title {
  font-family: var(--pc-font-head);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 700;
  color: var(--pc-text);
  margin: 0 0 14px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.pdfcraft-hero-subtitle {
  font-size: 16px;
  color: var(--pc-muted);
  margin: 0;
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Tools Grid ───────────────────────────────────────── */
.pdfcraft-tools-grid-3,
.pdfcraft-tools-grid-2,
.pdfcraft-tools-grid-4 {
  display: grid;
  gap: 14px;
}

.pdfcraft-tools-grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pdfcraft-tools-grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.pdfcraft-tools-grid-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ── Tool Card ────────────────────────────────────────── */
.pdfcraft-tool-card {
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  cursor: pointer;
  transition: var(--pc-transition);
  transition-property: border-color, background, transform, box-shadow;
}

.pdfcraft-tool-card:hover {
  border-color: rgba(var(--pc-accent-rgb), 0.4);
  background: var(--pc-surface-2);
  transform: translateY(-2px);
  box-shadow: var(--pc-shadow);
}

.pdfcraft-tool-card-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
}

.pdfcraft-tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--tool-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tool-color) 30%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--tool-color);
}

.pdfcraft-tool-icon .pdfcraft-icon,
.pdfcraft-tool-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

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

.pdfcraft-tool-info h3 {
  font-family: var(--pc-font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--pc-text);
  margin: 0 0 4px;
  line-height: 1.3;
}

.pdfcraft-tool-info p {
  font-size: 12px;
  color: var(--pc-muted);
  margin: 0;
  line-height: 1.4;
}

.pdfcraft-tool-arrow {
  color: var(--pc-border);
  transition: color var(--pc-transition), transform var(--pc-transition);
  flex-shrink: 0;
}

.pdfcraft-tool-card:hover .pdfcraft-tool-arrow {
  color: var(--pc-accent);
  transform: translateX(3px);
}

/* ── Modal ────────────────────────────────────────────── */
.pdfcraft-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.pdfcraft-modal[aria-hidden="false"] {
  pointer-events: all;
  opacity: 1;
}

.pdfcraft-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.pdfcraft-modal-panel {
  position: relative;
  z-index: 1;
  background: var(--pc-surface);
  border-radius: var(--pc-radius-lg) var(--pc-radius-lg) 0 0;
  border: 1px solid var(--pc-border);
  border-bottom: none;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.pdfcraft-modal[aria-hidden="false"] .pdfcraft-modal-panel {
  transform: translateY(0);
}

@media (min-width: 768px) {
  .pdfcraft-modal {
    align-items: center;
  }
  .pdfcraft-modal-panel {
    border-radius: var(--pc-radius-lg);
    border-bottom: 1px solid var(--pc-border);
    max-height: 85vh;
  }
}

.pdfcraft-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--pc-border);
  position: sticky;
  top: 0;
  background: var(--pc-surface);
  z-index: 2;
}

.pdfcraft-modal-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--pc-border);
  border-radius: 8px;
  color: var(--pc-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  transition: var(--pc-transition);
  white-space: nowrap;
}

.pdfcraft-modal-back:hover {
  border-color: var(--pc-accent);
  color: var(--pc-accent);
}

.pdfcraft-modal-title {
  font-family: var(--pc-font-head);
  font-size: 18px;
  font-weight: 600;
  color: var(--pc-text);
  margin: 0;
}

.pdfcraft-modal-body {
  padding: 24px;
}

/* ── Single Tool Page ─────────────────────────────────── */
.pdfcraft-single-tool {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.pdfcraft-single-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--pc-border);
}

.pdfcraft-tool-icon-lg {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--tool-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tool-color) 30%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--tool-color);
}

.pdfcraft-tool-icon-lg .pdfcraft-icon,
.pdfcraft-tool-icon-lg svg {
  width: 32px;
  height: 32px;
  display: block;
}

.pdfcraft-single-title {
  font-family: var(--pc-font-head);
  font-size: 28px;
  font-weight: 700;
  color: var(--pc-text);
  margin: 0 0 8px;
  line-height: 1.2;
}

.pdfcraft-single-desc {
  font-size: 15px;
  color: var(--pc-muted);
  margin: 0;
}

/* ── Drop Zone ────────────────────────────────────────── */
.pdfcraft-dropzone {
  border: 2px dashed var(--pc-border);
  border-radius: var(--pc-radius);
  background: var(--pc-bg);
  text-align: center;
  cursor: pointer;
  transition: var(--pc-transition);
  transition-property: border-color, background;
  position: relative;
}

.pdfcraft-dropzone:hover,
.pdfcraft-dropzone.drag-over {
  border-color: var(--pc-accent);
  background: rgba(var(--pc-accent-rgb), 0.04);
}

.pdfcraft-drop-inner {
  padding: 52px 24px;
  pointer-events: none;
}

.pdfcraft-dropzone-sm .pdfcraft-drop-inner {
  padding: 24px 16px;
}

.pdfcraft-drop-icon {
  color: var(--pc-muted);
  margin-bottom: 16px;
}

.pdfcraft-drop-icon svg { display: block; margin: 0 auto; }

.pdfcraft-drop-title {
  font-family: var(--pc-font-head);
  font-size: 16px;
  font-weight: 600;
  color: var(--pc-text);
  margin: 0 0 8px;
}

.pdfcraft-drop-sub {
  font-size: 14px;
  color: var(--pc-muted);
  margin: 0 0 12px;
}

.pdfcraft-browse-btn {
  background: none;
  border: none;
  color: var(--pc-accent);
  font-size: inherit;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  pointer-events: all;
}

.pdfcraft-drop-types {
  font-size: 11px;
  color: var(--pc-border);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
}

.pdfcraft-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ── File List ────────────────────────────────────────── */
.pdfcraft-file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.pdfcraft-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--pc-surface-2);
  border: 1px solid var(--pc-border);
  border-radius: 10px;
  padding: 12px 16px;
  animation: fileSlideIn 0.2s ease;
}

@keyframes fileSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.pdfcraft-file-icon {
  color: var(--pc-accent);
  flex-shrink: 0;
}

.pdfcraft-file-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--pc-text);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdfcraft-file-size {
  font-size: 11px;
  color: var(--pc-muted);
  flex-shrink: 0;
}

.pdfcraft-file-remove {
  background: none;
  border: none;
  color: var(--pc-border);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: var(--pc-transition);
}

.pdfcraft-file-remove:hover { color: #ff6b6b; background: rgba(255,107,107,0.1); }

/* ── Tool-Specific Options ────────────────────────────── */
.pdfcraft-tool-options {
  margin-bottom: 20px;
}

.pdfcraft-option-group {
  background: var(--pc-surface-2);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  padding: 18px;
  margin-bottom: 12px;
}

.pdfcraft-option-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--pc-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.pdfcraft-option-group input[type="text"],
.pdfcraft-option-group input[type="number"],
.pdfcraft-option-group input[type="password"],
.pdfcraft-option-group select,
.pdfcraft-option-group textarea {
  width: 100%;
  background: var(--pc-bg);
  border: 1px solid var(--pc-border);
  border-radius: 8px;
  color: var(--pc-text);
  font-family: var(--pc-font-body);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--pc-transition);
}

.pdfcraft-option-group input:focus,
.pdfcraft-option-group select:focus,
.pdfcraft-option-group textarea:focus {
  border-color: var(--pc-accent);
}

.pdfcraft-rotate-btns {
  display: flex;
  gap: 8px;
}

.pdfcraft-rotate-btn {
  flex: 1;
  background: var(--pc-bg);
  border: 1px solid var(--pc-border);
  border-radius: 8px;
  color: var(--pc-muted);
  font-size: 13px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--pc-transition);
}

.pdfcraft-rotate-btn:hover,
.pdfcraft-rotate-btn.active {
  border-color: var(--pc-accent);
  color: var(--pc-accent);
  background: rgba(var(--pc-accent-rgb), 0.06);
}

.pdfcraft-compress-levels {
  display: flex;
  gap: 8px;
}

.pdfcraft-compress-level {
  flex: 1;
  background: var(--pc-bg);
  border: 1px solid var(--pc-border);
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--pc-transition);
}

.pdfcraft-compress-level .level-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--pc-text);
  display: block;
  margin-bottom: 4px;
}

.pdfcraft-compress-level .level-desc {
  font-size: 10px;
  color: var(--pc-muted);
  display: block;
}

.pdfcraft-compress-level.active {
  border-color: var(--pc-accent);
  background: rgba(var(--pc-accent-rgb), 0.06);
}

.pdfcraft-compress-level.active .level-name { color: var(--pc-accent); }

/* ── Actions ──────────────────────────────────────────── */
.pdfcraft-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.pdfcraft-btn-primary,
.pdfcraft-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  font-family: var(--pc-font-head);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 22px;
  cursor: pointer;
  transition: var(--pc-transition);
}

.pdfcraft-btn-primary {
  background: var(--pc-accent);
  color: #0a1512;
  flex: 1;
  justify-content: center;
}

.pdfcraft-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(var(--pc-accent-rgb), 0.3);
}

.pdfcraft-btn-primary:active { transform: none; filter: brightness(0.95); }

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

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

.pdfcraft-btn-secondary:hover {
  border-color: var(--pc-muted);
  background: var(--pc-surface);
}

/* ── Progress ─────────────────────────────────────────── */
.pdfcraft-progress {
  text-align: center;
  padding: 40px 24px;
}

.pdfcraft-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--pc-border);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 16px;
}

.pdfcraft-progress-fill {
  height: 100%;
  background: var(--pc-accent);
  border-radius: 100px;
  width: 0;
  transition: width 0.4s ease;
  animation: progressIndeterminate 1.5s ease-in-out infinite;
}

@keyframes progressIndeterminate {
  0%   { width: 0%; margin-left: 0%; }
  50%  { width: 60%; margin-left: 20%; }
  100% { width: 0%; margin-left: 100%; }
}

.pdfcraft-progress-fill.determinate {
  animation: none;
}

.pdfcraft-progress-label {
  font-size: 14px;
  color: var(--pc-muted);
  margin: 0;
}

/* ── Result ───────────────────────────────────────────── */
.pdfcraft-result {
  text-align: center;
  padding: 48px 24px;
}

.pdfcraft-result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(var(--pc-accent-rgb), 0.1);
  border: 2px solid rgba(var(--pc-accent-rgb), 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  color: var(--pc-accent);
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

.pdfcraft-result h3 {
  font-family: var(--pc-font-head);
  font-size: 24px;
  font-weight: 700;
  color: var(--pc-text);
  margin: 0 0 8px;
}

.pdfcraft-result p {
  font-size: 14px;
  color: var(--pc-muted);
  margin: 0 0 28px;
}

.pdfcraft-result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Widget ───────────────────────────────────────────── */
.pdfcraft-widget {
  background: var(--pc-surface);
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  overflow: hidden;
}

.pdfcraft-widget-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--pc-surface-2);
  border-bottom: 1px solid var(--pc-border);
}

.pdfcraft-widget-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--tool-color) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tool-color) 25%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--tool-color);
}

.pdfcraft-widget-icon .pdfcraft-icon,
.pdfcraft-widget-icon svg { width: 18px; height: 18px; display: block; }

.pdfcraft-widget-header strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--pc-text);
}

.pdfcraft-widget-header span {
  font-size: 12px;
  color: var(--pc-muted);
}

.pdfcraft-widget-body { padding: 16px; }

/* ── Notifications ────────────────────────────────────── */
.pdfcraft-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 999999;
  background: var(--pc-surface-2);
  border: 1px solid var(--pc-border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  color: var(--pc-text);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--pc-shadow);
  opacity: 0;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.pdfcraft-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.pdfcraft-toast.error { border-color: rgba(255, 107, 107, 0.5); }
.pdfcraft-toast.error .toast-icon { color: #ff6b6b; }
.pdfcraft-toast.success { border-color: rgba(var(--pc-accent-rgb), 0.4); }
.pdfcraft-toast.success .toast-icon { color: var(--pc-accent); }

/* ── Drag Handle (multi-file reorder) ─────────────────── */
.pdfcraft-file-item[draggable] { cursor: grab; }
.pdfcraft-file-item.dragging { opacity: 0.4; }

/* ── Page list for split ──────────────────────────────── */
.pdfcraft-page-range-input {
  width: 100%;
  background: var(--pc-bg);
  border: 1px solid var(--pc-border);
  border-radius: 8px;
  color: var(--pc-text);
  font-family: var(--pc-font-body);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
}

.pdfcraft-page-range-input:focus { border-color: var(--pc-accent); }

/* ── Error message ────────────────────────────────────── */
.pdfcraft-error {
  background: rgba(255,107,107,0.1);
  border: 1px solid rgba(255,107,107,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  color: #ff6b6b;
  font-size: 14px;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 600px) {
  .pdfcraft-hero { padding: 36px 20px 32px; }
  .pdfcraft-tool-card-inner { padding: 14px 16px; }
  .pdfcraft-single-header { flex-direction: column; text-align: center; }
  .pdfcraft-actions { flex-direction: column; }
  .pdfcraft-btn-primary, .pdfcraft-btn-secondary { justify-content: center; }
  .pdfcraft-compress-levels { flex-direction: column; }
  .pdfcraft-rotate-btns { flex-wrap: wrap; }
}

/* ── Scrollbar ────────────────────────────────────────── */
.pdfcraft-modal-panel::-webkit-scrollbar { width: 6px; }
.pdfcraft-modal-panel::-webkit-scrollbar-track { background: transparent; }
.pdfcraft-modal-panel::-webkit-scrollbar-thumb { background: var(--pc-border); border-radius: 3px; }
