/* main.css - custom styles for the TrueCell landing page.
 * Contains global theming and small utility classes (glass cards, switches, etc.).
 */

:root {
  color-scheme: light dark;
}

/* Global body typography tuned to General Sans from Fontshare */
body {
  font-family: 'General Sans', system-ui, -apple-system, BlinkMacSystemFont,
    "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif;
}

/* Glassmorphism background treatments for dark/light cards */
.glass {
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.18), transparent 55%),
    rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(22px);
}

.glass-light {
  background: radial-gradient(circle at top left, rgba(248, 250, 252, 0.9), rgba(241, 245, 249, 0.92));
  backdrop-filter: blur(22px);
}

/* ============================================
   PREMIUM SWITCH CONTROL
   Used for auto-sync and workflow toggles
   ============================================ */

/* Hide checkbox but keep it accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Switch track - the background rail */
.switch-track {
  position: relative;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 2px;
}

/* Switch thumb - the sliding button */
.switch-thumb {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.2),
    inset 0 -1px 1px rgba(0, 0, 0, 0.1),
    inset 0 1px 1px rgba(255, 255, 255, 0.8);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* Start position - left side */
  transform: translateX(0);
}

/* Checked state - enabled */
.switch-input:checked ~ .switch-track {
  background: linear-gradient(135deg, #4f46e5, #22c55e);
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    0 0 12px rgba(34, 197, 94, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

.switch-input:checked ~ .switch-track .switch-thumb {
  /* Move to right side - width of track (32px) minus thumb (12px) minus padding (4px) = 16px */
  transform: translateX(16px);
  background: linear-gradient(135deg, #ffffff, #f0fdf4);
  box-shadow:
    0 2px 6px rgba(34, 197, 94, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.3),
    inset 0 -1px 1px rgba(34, 197, 94, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.9);
}

/* Hover states */
.switch-track:hover {
  border-color: rgba(148, 163, 184, 0.5);
}

.switch-input:checked ~ .switch-track:hover {
  border-color: rgba(34, 197, 94, 0.7);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.2),
    0 0 16px rgba(34, 197, 94, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Active/pressed state */
button:active .switch-thumb {
  transform: translateX(0) scale(0.95);
}

.switch-input:checked ~ .switch-track .switch-thumb:active,
button:active .switch-input:checked ~ .switch-track .switch-thumb {
  transform: translateX(16px) scale(0.95);
}

/* Focus state for accessibility */
.switch-input:focus-visible ~ .switch-track {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* Disabled state */
.switch-input:disabled ~ .switch-track {
  opacity: 0.5;
  cursor: not-allowed;
}

.switch-input:disabled ~ .switch-track .switch-thumb {
  background: linear-gradient(135deg, #94a3b8, #cbd5e1);
}

/* ============================================
   WORKFLOW TOGGLES (using peer pattern)
   ============================================ */

/* Workflow switch thumb animation */
.peer:checked ~ span .switch-thumb {
  transform: translateX(12px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ensure workflow thumbs start at left */
.peer ~ span .switch-thumb {
  transform: translateX(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   HERO LIVE COMPONENT ENHANCEMENTS
   ============================================ */

/* Smooth transitions for all hero metrics */
#stockPercent,
#stockB2C,
#stockB2B,
#scenarioRevenue,
#scenarioAging,
#scenarioMargin {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mode indicator badge animations */
#modeIndicator {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#modeIndicatorDot {
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pulse animation when auto-sync is active */
@keyframes auto-sync-pulse {
  0%, 100% {
    box-shadow:
      inset 0 2px 4px rgba(0, 0, 0, 0.2),
      0 0 12px rgba(34, 197, 94, 0.4),
      0 1px 2px rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow:
      inset 0 2px 4px rgba(0, 0, 0, 0.2),
      0 0 20px rgba(34, 197, 94, 0.6),
      0 1px 2px rgba(0, 0, 0, 0.2);
  }
}

.switch-input:checked ~ .switch-track {
  animation: auto-sync-pulse 2s ease-in-out infinite;
}

/* Enhanced button states for scenario toggles */
#modeB2C,
#modeB2B,
#scenarioToggle {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#modeB2C:active,
#modeB2B:active,
#scenarioToggle:active {
  transform: scale(0.97);
}

/* Realtime indicator enhancement */
.animate-ping {
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* ============================================
   SELL-THROUGH CHART
   ============================================ */

/* Ensure canvas always has proper dimensions */
#sellThroughChart {
  min-height: 160px;
  display: block;
}



/* ============================================
   INVENTORY BRAIN ORBIT CARD
   Responsive circle with orbiting pills
   ============================================ */

/* Container for the entire brain visualization */
.inventory-brain-container {
  width: 100%;
  /* Add extra padding to accommodate pills on the sides */
  padding: clamp(2rem, 5vw, 3rem) clamp(3rem, 8vw, 5rem);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Main orbit circle - fluid responsive sizing */
.inventory-orbit {
  /* Fluid sizing using clamp for smooth scaling across all devices */
  width: clamp(10rem, 30vw, 14rem);
  height: clamp(10rem, 30vw, 14rem);
  /* Ensure it stays circular */
  aspect-ratio: 1;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Content inside the circle - responsive text sizing */
.inventory-orbit-content {
  padding: clamp(0.5rem, 2vw, 1rem);
}

.inventory-orbit-content #inventoryModuleLabel {
  font-size: clamp(0.65rem, 1.8vw, 0.75rem);
  line-height: 1.3;
}

.inventory-orbit-content #inventoryOrbitDetail {
  font-size: clamp(0.55rem, 1.5vw, 0.65rem);
  line-height: 1.4;
}

/* Container for pills - responsive layout */
.inventory-orbit-pills {
  /* On mobile, pills are positioned absolutely on the sides */
  position: absolute;
  inset: 0;
  pointer-events: none; /* Allow clicks to pass through container */
}

/* Pill styling - responsive sizing and interactive states */
.inventory-orbit-pill {
  position: absolute;
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.98));
  color: #cbd5f5;
  border: 1px solid rgba(148, 163, 184, 0.55);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.85),
    0 8px 18px rgba(15, 23, 42, 0.9);
  white-space: nowrap;
  cursor: pointer;
  background-clip: padding-box;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto; /* Re-enable clicks on pills */
  /* Ensure consistent sizing */
  min-width: fit-content;
  max-width: max-content;
}

/* Mobile layout: pills on the sides of the circle */
/* Top-left position */
.inventory-orbit-pill-top {
  top: 15%;
  left: -15%;
  transform: translate(-50%, -50%);
}

/* Top-right position */
.inventory-orbit-pill-right {
  top: 15%;
  right: -15%;
  transform: translate(50%, -50%);
}

/* Bottom-left position */
.inventory-orbit-pill-left {
  bottom: 15%;
  left: -15%;
  transform: translate(-50%, 50%);
}

/* Bottom-right position */
.inventory-orbit-pill-bottom {
  bottom: 15%;
  right: -15%;
  transform: translate(50%, 50%);
}

/* Interactive hover/touch states with subtle movement */
.inventory-orbit-pill:hover {
  border-color: rgba(56, 189, 248, 0.9);
  color: #e5f2ff;
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.9),
    0 12px 28px rgba(8, 47, 73, 0.9);
  transform: scale(1.05) translateY(-2px);
}

.inventory-orbit-pill:active {
  transform: scale(0.98) translateY(0);
  transition-duration: 0.1s;
}

/* Active state for selected pill */
.inventory-orbit-pill-active {
  border-color: rgba(56, 189, 248, 0.9);
  color: #e5f2ff;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.15), rgba(15, 23, 42, 0.98));
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.9),
    0 12px 28px rgba(8, 47, 73, 0.9),
    inset 0 1px 3px rgba(56, 189, 248, 0.3);
  /* Don't set transform here - it will be handled by position-specific rules */
}

/* Tablet and up: transition to orbital layout with more spacing */
@media (min-width: 768px) {
  /* Orbital positioning - moved further away from circle to prevent overlap */
  .inventory-orbit-pill-top {
    top: -1.5rem;
    left: 50%;
    bottom: auto;
    right: auto;
    transform: translate(-50%, -50%);
  }

  .inventory-orbit-pill-top:hover {
    transform: translate(-50%, calc(-50% - 3px)) scale(1.05);
  }

  .inventory-orbit-pill-bottom {
    bottom: -1.5rem;
    left: 50%;
    top: auto;
    right: auto;
    transform: translate(-50%, 50%);
  }

  .inventory-orbit-pill-bottom:hover {
    transform: translate(-50%, calc(50% + 3px)) scale(1.05);
  }

  .inventory-orbit-pill-right {
    right: -1.5rem;
    top: 50%;
    left: auto;
    bottom: auto;
    transform: translate(50%, -50%);
  }

  .inventory-orbit-pill-right:hover {
    transform: translate(calc(50% + 3px), -50%) scale(1.05);
  }

  .inventory-orbit-pill-left {
    left: -1.5rem;
    top: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
  }

  .inventory-orbit-pill-left:hover {
    transform: translate(calc(-50% - 3px), -50%) scale(1.05);
  }

  /* Active state adjustments for orbital layout */
  .inventory-orbit-pill-top.inventory-orbit-pill-active {
    transform: translate(-50%, -50%) scale(1.02);
  }

  .inventory-orbit-pill-top.inventory-orbit-pill-active:hover {
    transform: translate(-50%, calc(-50% - 3px)) scale(1.05);
  }

  .inventory-orbit-pill-bottom.inventory-orbit-pill-active {
    transform: translate(-50%, 50%) scale(1.02);
  }

  .inventory-orbit-pill-bottom.inventory-orbit-pill-active:hover {
    transform: translate(-50%, calc(50% + 3px)) scale(1.05);
  }

  .inventory-orbit-pill-right.inventory-orbit-pill-active {
    transform: translate(50%, -50%) scale(1.02);
  }

  .inventory-orbit-pill-right.inventory-orbit-pill-active:hover {
    transform: translate(calc(50% + 3px), -50%) scale(1.05);
  }

  .inventory-orbit-pill-left.inventory-orbit-pill-active {
    transform: translate(-50%, -50%) scale(1.02);
  }

  .inventory-orbit-pill-left.inventory-orbit-pill-active:hover {
    transform: translate(calc(-50% - 3px), -50%) scale(1.05);
  }
}

/* Large tablets and desktop: even more spacing */
@media (min-width: 1024px) {
  .inventory-orbit-pill-top {
    top: -2rem;
  }

  .inventory-orbit-pill-bottom {
    bottom: -2rem;
  }

  .inventory-orbit-pill-right {
    right: -2rem;
  }

  .inventory-orbit-pill-left {
    left: -2rem;
  }
}

/* Large desktop: optimize sizing and spacing */
@media (min-width: 1280px) {
  .inventory-orbit {
    width: 14rem;
    height: 14rem;
  }

  .inventory-orbit-pill-top {
    top: -2.5rem;
  }

  .inventory-orbit-pill-bottom {
    bottom: -2.5rem;
  }

  .inventory-orbit-pill-right {
    right: -2.5rem;
  }

  .inventory-orbit-pill-left {
    left: -2.5rem;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .inventory-orbit-pill {
    /* Larger touch targets on mobile */
    padding: 0.45rem 1.1rem;
    font-size: 0.75rem;
  }

  /* Adjust mobile positioning for better touch access */
  .inventory-orbit-pill-top {
    top: 10%;
    left: -18%;
  }

  .inventory-orbit-pill-right {
    top: 10%;
    right: -18%;
  }

  .inventory-orbit-pill-left {
    bottom: 10%;
    left: -18%;
  }

  .inventory-orbit-pill-bottom {
    bottom: 10%;
    right: -18%;
  }
}

/* Subtle pulse animation for active pill */
@keyframes pill-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(59, 130, 246, 0.9),
      0 12px 28px rgba(8, 47, 73, 0.9),
      inset 0 1px 3px rgba(56, 189, 248, 0.3);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(59, 130, 246, 1),
      0 12px 32px rgba(8, 47, 73, 1),
      inset 0 1px 3px rgba(56, 189, 248, 0.4),
      0 0 20px rgba(56, 189, 248, 0.3);
  }
}

.inventory-orbit-pill-active {
  animation: pill-pulse 2s ease-in-out infinite;
}

/* Gentle float animation for the orbit circle */
@keyframes orbit-float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.inventory-orbit {
  animation: orbit-float 6s ease-in-out infinite;
}

/* Fade-in animation for detail text changes */
@keyframes text-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.inventory-orbit-content #inventoryOrbitDetail {
  animation: text-fade-in 0.4s ease-out;
}

/* Ripple effect on pill click */
.inventory-orbit-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.4) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0);
  transition: transform 0.5s ease-out, opacity 0.5s ease-out;
  pointer-events: none;
}

.inventory-orbit-pill:active::before {
  transform: scale(1.5);
  opacity: 1;
  transition: transform 0s, opacity 0s;
}

/* ============================================
   DASHBOARD SHOWCASE ANIMATIONS
   ============================================ */

/* Browser frame subtle float animation */
.dashboard-browser-frame {
  animation: dashboard-float 8s ease-in-out infinite;
}

@keyframes dashboard-float {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.002);
  }
}

/* Mobile frame subtle float animation */
.dashboard-mobile-frame {
  animation: mobile-float 6s ease-in-out infinite;
}

@keyframes mobile-float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-6px) rotate(0.5deg);
  }
}

/* Fade-in animation for dashboard on scroll */
#dashboard-showcase {
  opacity: 0;
  animation: fadeInUp 0.8s ease-out 0.2s forwards;
}

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

/* Subtle glow effect on dashboard */
.dashboard-browser-frame::before {
  content: '';
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15), transparent 60%);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  z-index: -1;
}

.dashboard-browser-frame:hover::before {
  opacity: 1;
}

/* Mobile frame glow */
.dashboard-mobile-frame::before {
  content: '';
  position: absolute;
  inset: -15px;
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.12), transparent 60%);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  z-index: -1;
}

.dashboard-mobile-frame:hover::before {
  opacity: 1;
}

.inventory-orbit-pill:active::before {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  to {
    transform: scale(1.5);
    opacity: 0;
  }
}
