/* ==========================================================================
   Label Cropper Pro — Dark/Light Theme, Enhanced Animations & Cropper UI
   ========================================================================== */

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --brand-primary: #4f46e5;
  --brand-accent: #10b981;
  --card-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.07);
}

html.dark {
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #1f2937;
  --brand-primary: #6366f1;
  --brand-accent: #10b981;
  --card-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Dark Mode Surface Overrides */
html.dark .theme-card {
  background-color: #111827 !important;
  border-color: #1f2937 !important;
  color: #f8fafc !important;
}

html.dark .theme-subcard {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

html.dark .theme-header {
  background-color: rgba(17, 24, 39, 0.88) !important;
  border-color: #1f2937 !important;
}

html.dark .theme-input {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark .theme-text-main {
  color: #f8fafc !important;
}

html.dark .theme-text-sub {
  color: #94a3b8 !important;
}

/* Animated Hero Ambient Background Orbs */
.hero-glow-wrap {
  position: relative;
}

.ambient-orb {
  position: absolute;
  border-radius: 9999px;
  filter: blur(72px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  animation: floatOrb 9s ease-in-out infinite alternate;
}

html.dark .ambient-orb {
  opacity: 0.22;
}

.orb-1 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  top: -60px;
  left: -80px;
}

.orb-2 {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, #10b981 0%, transparent 70%);
  top: 20px;
  right: -60px;
  animation-delay: -4s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(24px, -18px) scale(1.08); }
}

/* Smooth Entrance & Hover Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-up {
  animation: fadeInUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hover-lift {
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px -10px rgba(79, 70, 229, 0.16);
}

/* Top Navbar Platform Switcher Bar (E-Cropper Style) */
.top-platform-tab {
  position: relative;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.top-platform-tab:hover {
  transform: translateY(-1px);
}

.top-platform-tab.active {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 14px -2px rgba(79, 70, 229, 0.45);
}

/* Marketplace Grid Cards */
.platform-pill {
  transition: all 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
}

.platform-pill:hover {
  transform: translateY(-3px);
  border-color: #6366f1;
  box-shadow: 0 10px 22px -6px rgba(79, 70, 229, 0.16);
}

.platform-pill.active {
  border-color: #4f46e5;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.09) 0%, rgba(99, 102, 241, 0.16) 100%);
  box-shadow: 0 10px 24px -6px rgba(79, 70, 229, 0.25);
}

html.dark .platform-pill.active {
  border-color: #818cf8;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.25) 0%, rgba(55, 48, 163, 0.35) 100%);
}

.platform-pill.active .platform-check {
  opacity: 1;
  transform: scale(1);
}

.platform-check {
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Animated Dropzone */
.dropzone-area {
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  background-image: radial-gradient(rgba(99, 102, 241, 0.16) 1px, transparent 1px);
  background-size: 20px 20px;
}

.dropzone-area:hover {
  border-color: #6366f1;
  box-shadow: 0 16px 36px -12px rgba(79, 70, 229, 0.18);
}

.dropzone-area.drag-over {
  border-color: #10b981 !important;
  background-color: rgba(16, 185, 129, 0.08) !important;
  transform: scale(1.012);
  box-shadow: 0 20px 40px -12px rgba(16, 185, 129, 0.25);
}

/* Interactive PDF Preview Stage & Crop Box */
.preview-stage {
  position: relative;
  display: inline-block;
  user-select: none;
  box-shadow: 0 14px 36px -6px rgba(15, 23, 42, 0.28);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.preview-stage canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.crop-box {
  position: absolute;
  border: 2.5px dashed #4f46e5;
  background-color: rgba(79, 70, 229, 0.06);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.58);
  pointer-events: auto;
  cursor: move;
  transition: border-color 0.15s ease;
}

.crop-box:hover,
.crop-box.dragging {
  border-color: #10b981;
  background-color: rgba(16, 185, 129, 0.05);
}

.crop-box-badge {
  position: absolute;
  top: -26px;
  left: 0;
  background: #4f46e5;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 5px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.crop-sku-preview-banner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(16, 185, 129, 0.92);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  text-align: center;
  pointer-events: none;
}

/* 8 Resize Handles */
.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2.5px solid #4f46e5;
  border-radius: 50%;
  pointer-events: auto;
  z-index: 10;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.crop-handle:hover {
  transform: scale(1.25);
  border-color: #10b981;
}

.handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.handle-n  { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.handle-s  { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.handle-w  { left: -6px; top: calc(50% - 6px); cursor: ew-resize; }
.handle-e  { right: -6px; top: calc(50% - 6px); cursor: ew-resize; }

/* Shimmer & Pulse CTA Button */
@keyframes softPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45); }
  50% { box-shadow: 0 0 0 9px rgba(79, 70, 229, 0); }
}

.btn-pulse {
  animation: softPulse 2.4s infinite;
}

/* Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 8px;
}
