/* ==========================================================================
   Label Cropper Pro — Dynamic User Color Themes, Scroll-Reveal Bounce
   Animations, Interactive 3D Widgets, Ripple Effects & Dark/Light Mode
   ========================================================================== */

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #e2e8f0;

  /* User-Selectable Dynamic Brand Color Variables (Default: Royal Indigo) */
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-950: #1e1b4b;
  --brand-rgb: 79, 70, 229;

  --brand-primary: var(--brand-600);
  --brand-accent: #10b981;
  --card-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.07);
}

html.dark {
  --bg-primary: #080c14;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #1f2937;
  --brand-primary: var(--brand-500);
  --brand-accent: #10b981;
  --card-shadow: 0 14px 36px -8px rgba(0, 0, 0, 0.55);
}

* {
  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.35s ease, color 0.35s ease;
  overflow-x: hidden;
}

/* ==========================================================================
   Dynamic User Color Theme Overrides (Maps Tailwind Indigo to User's Choice)
   ========================================================================== */
.bg-indigo-600 {
  background-color: var(--brand-600) !important;
}
.hover\:bg-indigo-700:hover,
.hover\:bg-indigo-500:hover {
  background-color: var(--brand-700) !important;
}
.text-indigo-600 {
  color: var(--brand-600) !important;
}
.text-indigo-700 {
  color: var(--brand-700) !important;
}
html.dark .dark\:text-indigo-400,
html.dark .dark\:text-indigo-300 {
  color: var(--brand-400) !important;
}
.bg-indigo-50 {
  background-color: var(--brand-50) !important;
}
.border-indigo-200,
.border-indigo-300 {
  border-color: var(--brand-200) !important;
}
.from-indigo-600 {
  --tw-gradient-from: var(--brand-600) var(--tw-gradient-from-position) !important;
  --tw-gradient-to: var(--brand-700) var(--tw-gradient-to-position) !important;
}
.to-violet-600 {
  --tw-gradient-to: var(--brand-700) var(--tw-gradient-to-position) !important;
}
.shadow-indigo-600\/25,
.shadow-indigo-600\/20 {
  box-shadow: 0 10px 25px -5px rgba(var(--brand-rgb), 0.32) !important;
}
.selection\:bg-indigo-600 *::selection,
.selection\:bg-indigo-600::selection {
  background-color: var(--brand-600) !important;
  color: #ffffff !important;
}

/* ==========================================================================
   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(15, 23, 42, 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;
}

/* ==========================================================================
   Top Scroll Progress Bar
   ========================================================================== */
#scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--brand-500), #10b981, var(--brand-600));
  box-shadow: 0 0 12px rgba(var(--brand-rgb), 0.65);
  z-index: 9999;
  transition: width 0.08s ease-out;
  pointer-events: none;
}

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

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

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

.orb-1 {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, var(--brand-500) 0%, transparent 70%);
  top: -60px;
  left: -80px;
}

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

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(18px, -22px) scale(1.07); }
  100% { transform: translate(-12px, 14px) scale(0.96); }
}

/* ==========================================================================
   Scroll-Time Reveal & Spring Bounce Animations
   ========================================================================== */
.scroll-reveal {
  opacity: 0;
  will-change: transform, opacity;
  transition:
    opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.72s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-reveal.reveal-up {
  transform: translateY(36px) scale(0.97);
}

.scroll-reveal.reveal-bounce {
  transform: translateY(44px) scale(0.92);
}

.scroll-reveal.reveal-scale {
  transform: scale(0.88) translateY(20px);
}

.scroll-reveal.reveal-left {
  transform: translateX(-38px) scale(0.97);
}

.scroll-reveal.reveal-right {
  transform: translateX(38px) scale(0.97);
}

.scroll-reveal.is-visible {
  opacity: 1 !important;
  transform: translate(0, 0) scale(1) !important;
}

/* Staggered Cascade Delays for Grid Children */
.delay-1 { transition-delay: 0.06s !important; }
.delay-2 { transition-delay: 0.12s !important; }
.delay-3 { transition-delay: 0.18s !important; }
.delay-4 { transition-delay: 0.24s !important; }
.delay-5 { transition-delay: 0.30s !important; }
.delay-6 { transition-delay: 0.36s !important; }
.delay-7 { transition-delay: 0.42s !important; }
.delay-8 { transition-delay: 0.48s !important; }

/* ==========================================================================
   Enhanced Widget Bounce, Hover Lift & Tactile Press Micro-Animations
   ========================================================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-up {
  animation: fadeInUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes gentleBounceFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.float-badge {
  animation: gentleBounceFloat 3.2s ease-in-out infinite;
}

.hover-lift,
.theme-card {
  transition:
    transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.32s ease,
    border-color 0.25s ease;
}

.hover-lift:hover {
  transform: translateY(-6px) scale(1.012);
  box-shadow: 0 20px 38px -12px rgba(var(--brand-rgb), 0.22);
  border-color: rgba(var(--brand-rgb), 0.45) !important;
}

.hover-lift:active {
  transform: translateY(-1px) scale(0.985);
}

/* Keyframe Pop-Bounce when clicking interactive cards or widgets */
@keyframes widgetClickBounce {
  0% { transform: scale(1); }
  35% { transform: scale(0.94); }
  70% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

.click-bounce-anim {
  animation: widgetClickBounce 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Button Ripple Wave Effect */
.ripple-host {
  position: relative;
  overflow: hidden;
}

.ui-ripple-wave {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.42);
  pointer-events: none;
  animation: rippleExpand 0.55s ease-out forwards;
}

@keyframes rippleExpand {
  to {
    transform: scale(3.8);
    opacity: 0;
  }
}

/* ==========================================================================
   Top Navbar Platform Switcher Bar (E-Cropper Style)
   ========================================================================== */
.top-platform-tab {
  position: relative;
  transition: all 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.top-platform-tab:hover {
  transform: translateY(-2px) scale(1.03);
}

.top-platform-tab.active {
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 100%);
  color: #ffffff !important;
  box-shadow: 0 6px 16px -2px rgba(var(--brand-rgb), 0.48);
  transform: translateY(-1px);
}

/* ==========================================================================
   Marketplace Grid Cards
   ========================================================================== */
.platform-pill {
  transition: all 0.3s 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(-5px) scale(1.025);
  border-color: var(--brand-500);
  box-shadow: 0 14px 26px -8px rgba(var(--brand-rgb), 0.22);
}

.platform-pill.active {
  border-color: var(--brand-600);
  background: linear-gradient(
    135deg,
    rgba(var(--brand-rgb), 0.09) 0%,
    rgba(var(--brand-rgb), 0.17) 100%
  );
  box-shadow: 0 12px 26px -6px rgba(var(--brand-rgb), 0.28);
  transform: translateY(-2px);
}

html.dark .platform-pill.active {
  border-color: var(--brand-400);
  background: linear-gradient(
    135deg,
    rgba(var(--brand-rgb), 0.24) 0%,
    rgba(var(--brand-rgb), 0.36) 100%
  );
}

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

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

/* ==========================================================================
   Animated Dropzone
   ========================================================================== */
.dropzone-area {
  transition: all 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  background-image: radial-gradient(rgba(var(--brand-rgb), 0.16) 1px, transparent 1px);
  background-size: 20px 20px;
}

.dropzone-area:hover {
  border-color: var(--brand-500);
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -12px rgba(var(--brand-rgb), 0.2);
}

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

/* ==========================================================================
   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 var(--brand-600);
  background-color: rgba(var(--brand-rgb), 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: var(--brand-600);
  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(var(--brand-rgb), 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 var(--brand-600);
  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.3);
  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(var(--brand-rgb), 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(var(--brand-rgb), 0); }
}

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

/* ==========================================================================
   Floating Interactive Experience Dock (Color Picker, Sound FX, Scroll Top)
   ========================================================================== */
.ui-customizer-dock {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dock-pill {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 12px 32px -6px rgba(15, 23, 42, 0.18);
  border-radius: 9999px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html.dark .dock-pill {
  background: rgba(17, 24, 39, 0.92);
  border-color: rgba(51, 65, 85, 0.8);
  box-shadow: 0 12px 32px -6px rgba(0, 0, 0, 0.6);
}

.color-swatch-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.color-swatch-btn:hover {
  transform: scale(1.25);
}

.color-swatch-btn.active {
  transform: scale(1.22);
  box-shadow: 0 0 0 2.5px var(--brand-600);
}

/* 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;
}
