@import "tailwindcss";
/* -------------------------------------------------- */
/* PDFKIT CUSTOM STYLES & OVERRIDES                   */
/* -------------------------------------------------- */

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: clip;
}

body {
  font-family: 'IBM Plex Sans', sans-serif;
  @apply bg-gradient-to-br from-sky-50 via-indigo-50/30 to-white min-h-screen transition-colors duration-300;
  max-width: 100%;
  overflow-x: clip;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* WCAG 2.2 AA Focus Appearance & Visibility */
:focus-visible {
  outline: 2px solid #7c3aed !important;
  outline-offset: 2px !important;
  border-radius: 4px;
}

/* Reduced Motion Compliance */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Mobile Touch Target Standards (Apple HIG & Material 44px min target) */
@media (max-width: 768px) {
  button, 
  [role="button"],
  input[type="button"],
  input[type="submit"],
  .touch-target {
    min-height: 44px;
    touch-action: manipulation;
  }
}

.font-mono {
  font-family: 'IBM Plex Mono', monospace;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #CFCCC2;
  border-radius: 8px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #3A4048;
}

/* Modern Sidebar Styling */
.glass-sidebar {
  @apply backdrop-blur-md bg-white/70 dark:bg-zinc-900/70 border-r border-slate-200/50 dark:border-zinc-800/50;
}

.nav-btn-active {
  @apply bg-gradient-to-r from-indigo-50 to-transparent dark:from-indigo-900/20 dark:to-transparent border-l-4 border-indigo-500 shadow-sm text-indigo-700 dark:text-indigo-300;
}

/* Floating Card Layout */
.main-card {
  @apply bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl rounded-2xl shadow-xl border border-slate-200/40 dark:border-zinc-800/40;
}

/* Overhauled Dropzone */
.dropzone-container {
  @apply transition-all duration-300 border-2 border-dashed border-indigo-400/40 dark:border-indigo-500/30 rounded-2xl bg-slate-50/50 dark:bg-zinc-800/50 p-10 text-center cursor-pointer;
}

.dropzone-container:hover {
  @apply scale-[1.01] backdrop-blur-lg bg-indigo-50/50 dark:bg-indigo-900/10 border-indigo-500;
}

/* Decorative Stamp Badge */
.stamp-badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.35rem 0.85rem;
  border: 2px solid #3454D1;
  color: #3454D1;
  border-radius: 3px;
  transform: rotate(-1.5deg);
  position: relative;
}

.stamp-badge::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px dashed #3454D1;
  border-radius: 2px;
  opacity: 0.5;
}

.dark .stamp-badge {
  color: #5B78E0;
  border-color: #5B78E0;
}

.dark .stamp-badge::after {
  border-color: #5B78E0;
}

/* Animation on Tool Switching */
.tool-section {
  animation: fadein .2s ease;
}

@keyframes fadein {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Page Organizer */
.page-card {
  @apply transition-all duration-200 bg-white border border-slate-200 dark:border-zinc-700 rounded-lg p-2 flex items-center justify-center cursor-move hover:border-indigo-400 hover:shadow-md;
}

.page-card.dragging {
  @apply opacity-50;
}

/* Activity Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(52, 84, 209, 0.25);
  border-top-color: #3454D1;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.dark .spinner {
  border-color: rgba(91, 120, 224, 0.25);
  border-top-color: #5B78E0;
}

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

/* Reorderable File Rows */
.file-row[draggable="true"] {
  cursor: grab;
}

.file-row.dragging {
  opacity: 0.4;
}

body.is-dragging-row .file-row * {
  pointer-events: none;
}

/* Animated Toast Notifications */
.toast {
  animation: slidein .18s ease;
}

@keyframes slidein {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Smooth fluid animated transitions for Crop Box */
#crop-box {
  transition-property: left, top, width, height;
  transition-duration: 0.22s;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  transition: left 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              top 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: left, top, width, height;
}

#crop-box.is-dragging {
  transition-property: left, top, width, height !important;
  transition-duration: 0.22s !important;
  transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1) !important;
  transition: left 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              top 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Mobile-First Touch Optimization for Crop Tool */
.crop-handle {
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* 44px minimum touch target size (Apple HIG / Material Design) for mobile fingers */
.crop-handle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  pointer-events: auto;
  z-index: 10;
}

@media (max-width: 768px) {
  .crop-handle {
    transform: scale(1.25);
  }
}

#crop-box {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#crop-canvas-wrapper {
  touch-action: none;
}
