/**
 * ROI Calculator Modern SaaS UI Styles
 * Premium interface with gradients, animations, and glassmorphism
 * All classes namespaced with .roi-widget-
 *
 * Design Tokens are defined at :root for easy Dark Mode / brand overrides.
 */

/* ===================================================================
   DESIGN TOKENS
   =================================================================== */

:root {
  /* Brand primaries — Indigo */
  --roi-color-primary-50: #eef2ff;
  --roi-color-primary-100: #e0e7ff;
  --roi-color-primary-400: #818cf8;
  --roi-color-primary-500: #6366f1;
  --roi-color-primary-600: #4f46e5;
  --roi-color-primary-700: #4338ca;
  --roi-color-primary-800: #3730a3;

  /* Accent / Teal */
  --roi-color-accent-400: #2dd4bf;
  --roi-color-accent-500: #14b8a6;

  /* Success / Green */
  --roi-color-success-400: #34D399;
  --roi-color-success-500: #10B981;
  --roi-color-success-600: #059669;
  --roi-color-success-700: #047857;

  /* Danger */
  --roi-color-danger-500: #f43f5e;

  /* Purple */
  --roi-color-purple-500: #a78bfa;
  --roi-color-purple-600: #8b5cf6;
  --roi-color-purple-700: #7c3aed;

  /* Pink */
  --roi-color-pink-500: #f472b6;

  /* Amber / Gold */
  --roi-color-amber-500: #fbbf24;
  --roi-color-amber-600: #f59e0b;
  --roi-color-amber-700: #d97706;

  /* Neutrals */
  --roi-color-white: #ffffff;
  --roi-color-gray-50: #F8FAFC;
  --roi-color-gray-100: #F1F5F9;
  --roi-color-gray-200: #E2E8F0;
  --roi-color-gray-300: #CBD5E1;
  --roi-color-gray-400: #94A3B8;
  --roi-color-gray-500: #64748B;
  --roi-color-gray-600: #475569;
  --roi-color-gray-700: #334155;
  --roi-color-gray-800: #1E293B;
  --roi-color-gray-900: #0F172A;

  /* Surfaces — Dark theme */
  --roi-surface-bg: #0c1222;
  --roi-surface-card: #111a2e;
  --roi-surface-results: linear-gradient(160deg, #0a1628 0%, #0d1117 50%, #0a0f1e 100%);

  /* Typography */
  --roi-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --roi-font-size-xs: 0.75rem;
  --roi-font-size-sm: 0.85rem;
  --roi-font-size-base: 0.95rem;
  --roi-font-size-lg: 1.1rem;
  --roi-font-size-xl: 1.25rem;
  --roi-font-size-2xl: 1.5rem;
  --roi-font-size-3xl: 3.25rem;

  /* Spacing */
  --roi-space-1: 0.25rem;
  --roi-space-2: 0.5rem;
  --roi-space-3: 0.75rem;
  --roi-space-4: 1rem;
  --roi-space-5: 1.25rem;
  --roi-space-6: 1.5rem;
  --roi-space-8: 2rem;
  --roi-space-10: 2.5rem;
  --roi-space-12: 3rem;

  /* Radii */
  --roi-radius-sm: 8px;
  --roi-radius-md: 10px;
  --roi-radius-lg: 14px;
  --roi-radius-xl: 16px;
  --roi-radius-2xl: 20px;
  --roi-radius-full: 100px;

  /* Shadows — deeper for dark surfaces */
  --roi-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --roi-shadow-md: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --roi-shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --roi-shadow-results: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);

  /* Transitions */
  --roi-transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --roi-transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================================================
   INTER FONT IMPORT (subset: latin)
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ===================================================================
   MODERN CALCULATOR CONTAINER
   =================================================================== */

.roi-widget-modern {
  max-width: 1200px;
  margin: var(--roi-space-12) auto;
  font-family: var(--roi-font-family);
  background: var(--roi-surface-bg);
  border-radius: var(--roi-radius-2xl);
  box-shadow: var(--roi-shadow-lg);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Modern Header */
.roi-widget-header-modern {
  background: linear-gradient(135deg, #312e81 0%, var(--roi-color-primary-700) 40%, var(--roi-color-purple-700) 100%);
  color: var(--roi-color-white);
  padding: var(--roi-space-12) var(--roi-space-12);
  position: relative;
  overflow: hidden;
}

.roi-widget-header-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.2) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(139, 92, 246, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(16, 185, 129, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

@keyframes roi-header-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.roi-widget-header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--roi-space-3);
  position: relative;
  z-index: 1;
}

.roi-widget-title-modern {
  margin: 0 0 var(--roi-space-1) 0;
  font-size: var(--roi-font-size-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}

.roi-widget-description-modern {
  margin: 0;
  font-size: var(--roi-font-size-base);
  opacity: 0.95;
  font-weight: 400;
  position: relative;
  z-index: 1;
}

/* ===================================================================
   CURRENCY SWITCHER
   =================================================================== */

.roi-widget-currency-switcher {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--roi-radius-md);
  padding: 2px;
  position: relative;
  z-index: 1;
}

.roi-widget-currency-btn {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: none;
  padding: var(--roi-space-1) var(--roi-space-3);
  border-radius: var(--roi-radius-sm);
  font-family: var(--roi-font-family);
  font-size: var(--roi-font-size-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--roi-transition-fast);
  white-space: nowrap;
}

.roi-widget-currency-btn:hover {
  color: var(--roi-color-white);
  background: rgba(255, 255, 255, 0.1);
}

.roi-widget-currency-btn--active {
  background: var(--roi-color-white) !important;
  color: var(--roi-color-primary-700) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* ===================================================================
   CONTENT GRID LAYOUT
   =================================================================== */

.roi-widget-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--roi-space-12);
  padding: var(--roi-space-12);
  background: var(--roi-surface-card);
}

@media (max-width: 968px) {
  .roi-widget-content-grid {
    grid-template-columns: 1fr;
    gap: var(--roi-space-8);
    padding: var(--roi-space-8);
  }
}

/* ===================================================================
   LEFT PANEL - INPUTS
   =================================================================== */

.roi-widget-inputs-panel {
  display: flex;
  flex-direction: column;
  gap: var(--roi-space-6);
}

.roi-widget-panel-title {
  font-size: var(--roi-font-size-xl);
  font-weight: 700;
  color: var(--roi-color-gray-200);
  margin-bottom: var(--roi-space-2);
  letter-spacing: -0.01em;
}

.roi-widget-form-modern {
  display: flex;
  flex-direction: column;
  gap: var(--roi-space-8);
}

/* Modern Field Styling */
.roi-widget-field-modern {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--roi-radius-xl);
  padding: var(--roi-space-6);
  box-shadow: var(--roi-shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all var(--roi-transition-fast);
}

.roi-widget-field-modern:hover {
  box-shadow: var(--roi-shadow-md);
  border-color: rgba(99, 102, 241, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.roi-widget-field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--roi-space-4);
}

.roi-widget-label-modern {
  font-weight: 600;
  font-size: var(--roi-font-size-base);
  color: var(--roi-color-gray-300);
  display: flex;
  align-items: center;
  gap: var(--roi-space-2);
}

.roi-widget-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  color: var(--roi-color-gray-500);
  transition: color var(--roi-transition-fast);
}

.roi-widget-tooltip:hover {
  color: var(--roi-color-accent-500);
  transform: scale(1.1);
}

.roi-widget-tooltip-content {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: var(--roi-color-white);
  padding: var(--roi-space-3) var(--roi-space-4);
  border-radius: var(--roi-radius-md);
  font-size: var(--roi-font-size-sm);
  font-weight: 400;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--roi-transition-fast);
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.roi-widget-tooltip:hover .roi-widget-tooltip-content {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
}

.roi-widget-tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
}

.roi-widget-field-value {
  display: flex;
  align-items: center;
  gap: var(--roi-space-2);
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--roi-radius-md);
  padding: var(--roi-space-2) var(--roi-space-3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all var(--roi-transition-fast);
}

.roi-widget-field-value:focus-within {
  border-color: var(--roi-color-primary-500);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 0 24px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.roi-widget-value-prefix,
.roi-widget-value-suffix {
  font-size: 0.9rem;
  color: var(--roi-color-gray-500);
  font-weight: 600;
}

.roi-widget-input-modern {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--roi-font-size-lg);
  font-weight: 700;
  color: var(--roi-color-gray-100);
  padding: var(--roi-space-1);
  text-align: right;
  min-width: 60px;
  outline: none;
  font-family: var(--roi-font-family);
  appearance: textfield;
  -moz-appearance: textfield;
}

.roi-widget-input-modern::-webkit-inner-spin-button,
.roi-widget-input-modern::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ===================================================================
   SLIDER CONTROLS
   =================================================================== */

.roi-widget-slider-container {
  margin-top: var(--roi-space-4);
  position: relative;
}

.roi-widget-slider-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--roi-radius-lg);
  transform: translateY(-50%);
  pointer-events: none;
}

.roi-widget-slider-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--roi-color-primary-500) 0%, var(--roi-color-accent-500) 50%, var(--roi-color-success-500) 100%);
  border-radius: var(--roi-radius-lg);
  transition: width var(--roi-transition-fast);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

@keyframes roi-slider-glow {
  0%, 100% { box-shadow: 0 2px 12px rgba(6, 182, 212, 0.5); }
  50% { box-shadow: 0 2px 16px rgba(16, 185, 129, 0.6); }
}

.roi-widget-slider-modern {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: transparent;
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 10;
}

/* Slider Thumb - Webkit */
.roi-widget-slider-modern::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--roi-color-primary-400) 0%, var(--roi-color-primary-600) 100%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.5), 0 0 0 3px rgba(99, 102, 241, 0.2);
  transition: all var(--roi-transition-fast);
}

.roi-widget-slider-modern::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.6), 0 0 0 5px rgba(99, 102, 241, 0.25);
}

.roi-widget-slider-modern::-webkit-slider-thumb:active {
  transform: scale(1.1);
}

/* Slider Thumb - Firefox */
.roi-widget-slider-modern::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--roi-color-primary-400) 0%, var(--roi-color-primary-600) 100%);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.5);
  transition: all var(--roi-transition-fast);
}

.roi-widget-slider-modern::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.6);
}

/* ===================================================================
   RIGHT PANEL - RESULTS
   =================================================================== */

.roi-widget-results-panel {
  display: flex;
  flex-direction: column;
  gap: var(--roi-space-6);
}

.roi-widget-results-card {
  background: var(--roi-surface-results);
  border-radius: var(--roi-radius-2xl);
  padding: var(--roi-space-12);
  color: var(--roi-color-white);
  position: relative;
  overflow: hidden;
  box-shadow: var(--roi-shadow-results);
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.roi-widget-results-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.06), transparent 70%);
  pointer-events: none;
}

.roi-widget-results-card::after {
  content: '';
  position: absolute;
  bottom: -80px;
  left: -40px;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08), transparent 70%);
  pointer-events: none;
}

/* Pulse Animation on Update */
.roi-widget-pulse {
  animation: roi-pulse 0.6s ease-out;
}

@keyframes roi-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); box-shadow: 0 24px 70px rgba(37, 99, 235, 0.4); }
}

/* Success Glow – activated when ROI exceeds threshold */
.roi-widget-success-glow {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow:
    var(--roi-shadow-results),
    0 0 40px rgba(16, 185, 129, 0.25),
    0 0 80px rgba(16, 185, 129, 0.1);
  animation: roi-success-border-glow 3s ease-in-out infinite;
}

@keyframes roi-success-border-glow {
  0%, 100% {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow:
      var(--roi-shadow-results),
      0 0 40px rgba(16, 185, 129, 0.25),
      0 0 80px rgba(16, 185, 129, 0.1);
  }
  50% {
    border-color: rgba(16, 185, 129, 0.55);
    box-shadow:
      var(--roi-shadow-results),
      0 0 50px rgba(16, 185, 129, 0.35),
      0 0 100px rgba(16, 185, 129, 0.15);
  }
}

/* Primary Result */
.roi-widget-primary-result {
  text-align: center;
  position: relative;
  z-index: 1;
  margin-bottom: var(--roi-space-8);
}

.roi-widget-result-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2), rgba(99, 102, 241, 0.1), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  animation: roi-glow-pulse 6s ease-in-out infinite;
}

@keyframes roi-glow-pulse {
  0%, 100% { 
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  50% { 
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.8;
  }
}

.roi-widget-result-label-modern {
  font-size: var(--roi-font-size-xs);
  font-weight: 600;
  color: var(--roi-color-gray-400);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--roi-space-2);
}

.roi-widget-result-value-modern {
  font-size: var(--roi-font-size-3xl);
  font-weight: 800;
  background: linear-gradient(135deg, #34d399 0%, #2dd4bf 30%, #818cf8 60%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: roi-gradient-shift 4s ease infinite;
  margin: var(--roi-space-2) 0;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

@keyframes roi-gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.roi-widget-result-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.1);
  color: var(--roi-color-success-400);
  padding: 0.4rem var(--roi-space-4);
  border-radius: var(--roi-radius-full);
  font-size: var(--roi-font-size-xs);
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.2);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.12);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.roi-widget-result-badge svg {
  color: var(--roi-color-success-500);
  filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.6));
}

@keyframes roi-badge-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }
  50% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.5); }
}

/* Placeholder State */
.roi-widget-results-placeholder {
  text-align: center;
  padding: var(--roi-space-12) var(--roi-space-8);
  color: var(--roi-color-gray-500);
}

.roi-widget-placeholder-icon {
  margin-bottom: var(--roi-space-4);
  opacity: 0.3;
}

.roi-widget-placeholder-icon svg {
  stroke: currentColor;
}

.roi-widget-placeholder-text {
  font-size: var(--roi-font-size-lg);
  margin: 0;
  opacity: 0.7;
}

/* ===================================================================
   SVG DONUT CHART
   =================================================================== */

.roi-widget-donut-container {
  display: flex;
  align-items: center;
  gap: var(--roi-space-6);
  margin-bottom: var(--roi-space-6);
  position: relative;
  z-index: 1;
}

.roi-widget-donut-svg {
  flex-shrink: 0;
}

.roi-widget-donut-segment {
  opacity: 0;
  animation: roi-donut-draw 0.6s ease-out forwards;
  transition: stroke-dasharray 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes roi-donut-draw {
  from { opacity: 0; stroke-dashoffset: 60; }
  to   { opacity: 1; stroke-dashoffset: 0; }
}

.roi-widget-donut-legend {
  display: flex;
  flex-direction: column;
  gap: var(--roi-space-2);
  flex: 1;
  min-width: 0;
}

.roi-widget-donut-legend-item {
  display: flex;
  align-items: center;
  gap: var(--roi-space-2);
  font-size: var(--roi-font-size-xs);
  color: var(--roi-color-gray-300);
}

.roi-widget-donut-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.roi-widget-donut-legend-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roi-widget-donut-legend-pct {
  font-weight: 700;
  color: var(--roi-color-white);
}

/* Breakdown Section */
.roi-widget-breakdown-modern {
  position: relative;
  z-index: 1;
}

.roi-widget-breakdown-title-modern {
  font-size: var(--roi-font-size-xs);
  font-weight: 700;
  color: var(--roi-color-gray-400);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--roi-space-3);
  padding-bottom: var(--roi-space-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.roi-widget-breakdown-item {
  display: flex;
  align-items: center;
  gap: var(--roi-space-3);
  padding: var(--roi-space-2) 0;
  animation: roi-fade-in 0.4s ease-out backwards;
}

@keyframes roi-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.roi-widget-breakdown-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--roi-radius-sm);
  background: rgba(56, 189, 248, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #38BDF8;
  transition: all var(--roi-transition-normal);
}

/* Colorful breakdown icons - different vibrant color for each item */
.roi-widget-breakdown-item:nth-child(1) .roi-widget-breakdown-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3));
  color: var(--roi-color-success-500);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.roi-widget-breakdown-item:nth-child(2) .roi-widget-breakdown-icon {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(8, 145, 178, 0.3));
  color: var(--roi-color-accent-500);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.roi-widget-breakdown-item:nth-child(3) .roi-widget-breakdown-icon {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.3));
  color: var(--roi-color-purple-500);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.roi-widget-breakdown-item:nth-child(4) .roi-widget-breakdown-icon {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(219, 39, 119, 0.3));
  color: var(--roi-color-pink-500);
  box-shadow: 0 0 15px rgba(236, 72, 153, 0.3);
}

.roi-widget-breakdown-item:hover .roi-widget-breakdown-icon {
  transform: scale(1.15) rotate(5deg);
  box-shadow: 0 0 25px currentColor;
}

.roi-widget-breakdown-content {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.roi-widget-breakdown-label {
  font-size: 0.8rem;
  color: var(--roi-color-gray-300);
}

.roi-widget-breakdown-value {
  font-size: var(--roi-font-size-base);
  font-weight: 700;
  color: var(--roi-color-white);
}

/* ===================================================================
   CTA BUTTONS
   =================================================================== */

.roi-widget-cta-section-modern {
  display: flex;
  flex-direction: column;
  gap: var(--roi-space-4);
}

.roi-widget-btn-cta {
  padding: var(--roi-space-4) var(--roi-space-6);
  border-radius: var(--roi-radius-lg);
  font-size: var(--roi-font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--roi-transition-normal);
  font-family: var(--roi-font-family);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--roi-space-3);
  border: none;
}

.roi-widget-btn-primary {
  background: linear-gradient(135deg, var(--roi-color-primary-500) 0%, var(--roi-color-primary-600) 50%, var(--roi-color-purple-600) 100%);
  color: var(--roi-color-white);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
  position: relative;
  overflow: hidden;
}

.roi-widget-btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.roi-widget-btn-primary:hover::before {
  left: 100%;
}

.roi-widget-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.45), 0 0 40px rgba(99, 102, 241, 0.2);
}

.roi-widget-btn-primary:active {
  transform: translateY(0);
}

.roi-widget-btn-secondary {
  background: transparent;
  color: var(--roi-color-gray-200);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.roi-widget-btn-secondary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.06));
  opacity: 0;
  transition: opacity var(--roi-transition-normal);
}

.roi-widget-btn-secondary:hover::before {
  opacity: 1;
}

.roi-widget-btn-secondary:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}

/* Reset Button */
.roi-widget-btn-reset-modern {
  padding: 0.6rem var(--roi-space-5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  border-radius: var(--roi-radius-md);
  font-size: var(--roi-font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--roi-transition-fast);
  font-family: var(--roi-font-family);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--roi-space-2);
  color: var(--roi-color-gray-500);
}

.roi-widget-btn-reset-modern:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--roi-color-gray-300);
}

.roi-widget-btn-reset-modern svg {
  transition: transform var(--roi-transition-normal);
}

.roi-widget-btn-reset-modern:hover svg {
  transform: rotate(-180deg);
}

/* ===================================================================
   ERROR STATES
   =================================================================== */

.roi-widget-field-error {
  border-color: var(--roi-color-danger-500) !important;
}

.roi-widget-field-error .roi-widget-field-value {
  border-color: var(--roi-color-danger-500) !important;
}

.roi-widget-error-message-modern {
  display: block;
  margin-top: var(--roi-space-2);
  font-size: var(--roi-font-size-sm);
  color: var(--roi-color-danger-500);
  font-weight: 500;
}

/* ===================================================================
   SKELETON LOADING
   =================================================================== */

.roi-widget-skeleton .roi-widget-skeleton-header {
  background: linear-gradient(135deg, #312e81 0%, var(--roi-color-purple-700) 100%);
  padding: var(--roi-space-12) var(--roi-space-12);
  display: flex;
  flex-direction: column;
  gap: var(--roi-space-3);
}

.roi-widget-skeleton-line {
  height: 14px;
  border-radius: var(--roi-radius-sm);
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.08) 25%,
    rgba(255, 255, 255, 0.18) 50%,
    rgba(255, 255, 255, 0.08) 75%);
  background-size: 400% 100%;
  animation: roi-shimmer 1.8s ease-in-out infinite;
}

.roi-widget-skeleton-line--short  { width: 30%; }
.roi-widget-skeleton-line--medium { width: 60%; }
.roi-widget-skeleton-line--long   { width: 85%; }
.roi-widget-skeleton-line--full   { width: 100%; }

.roi-widget-skeleton-field {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--roi-radius-xl);
  padding: var(--roi-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--roi-space-3);
}

.roi-widget-skeleton-field .roi-widget-skeleton-line {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%);
  background-size: 400% 100%;
  animation: roi-shimmer 1.8s ease-in-out infinite;
}

.roi-widget-skeleton-result {
  background: linear-gradient(135deg, var(--roi-color-gray-800) 0%, var(--roi-color-gray-900) 100%);
  border-radius: var(--roi-radius-2xl);
  padding: var(--roi-space-10);
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--roi-space-4);
}

.roi-widget-skeleton-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 75%);
  background-size: 400% 100%;
  animation: roi-shimmer 1.8s ease-in-out infinite;
}

@keyframes roi-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ===================================================================
   RESPONSIVE DESIGN
   =================================================================== */

@media (max-width: 768px) {
  .roi-widget-modern {
    margin: var(--roi-space-6);
    border-radius: var(--roi-radius-xl);
  }

  .roi-widget-header-modern {
    padding: var(--roi-space-8) var(--roi-space-6);
  }

  .roi-widget-header-top-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .roi-widget-title-modern {
    font-size: var(--roi-font-size-2xl);
  }

  .roi-widget-description-modern {
    font-size: var(--roi-font-size-base);
  }

  .roi-widget-content-grid {
    padding: var(--roi-space-6);
  }

  .roi-widget-result-value-modern {
    font-size: 2.5rem;
  }

  .roi-widget-donut-container {
    flex-direction: column;
    text-align: center;
  }

  .roi-widget-cta-section-modern {
    flex-direction: column;
  }
}

/* ===================================================================
   ACCESSIBILITY
   =================================================================== */

.roi-widget-btn-cta:focus-visible,
.roi-widget-btn-reset-modern:focus-visible,
.roi-widget-input-modern:focus-visible,
.roi-widget-slider-modern:focus-visible,
.roi-widget-currency-btn:focus-visible {
  outline: 2px solid var(--roi-color-primary-600);
  outline-offset: 2px;
}

/* ===================================================================
   PRINT STYLES – Business Case layout
   =================================================================== */

@media print {
  body {
    background: white !important;
  }

  .roi-widget-modern {
    box-shadow: none;
    border: 1px solid var(--roi-color-gray-200);
    margin: 0;
    max-width: 100%;
    border-radius: 0;
  }

  .roi-widget-header-modern {
    background: var(--roi-color-gray-800) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .roi-widget-cta-section-modern,
  .roi-widget-btn-reset-modern,
  .roi-widget-currency-switcher {
    display: none !important;
  }

  .roi-widget-slider-container {
    display: none !important;
  }

  .roi-widget-content-grid {
    display: block;
    padding: var(--roi-space-8);
  }

  .roi-widget-results-card {
    background: var(--roi-color-gray-800) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    box-shadow: none;
    margin-top: var(--roi-space-8);
    page-break-inside: avoid;
  }

  .roi-widget-result-value-modern {
    -webkit-text-fill-color: var(--roi-color-success-500);
    color: var(--roi-color-success-500);
  }

  /* Add business case footer in print */
  .roi-widget-modern::after {
    content: 'ROI Business Case • Generated ' attr(data-print-date);
    display: block;
    text-align: center;
    padding: var(--roi-space-4);
    font-size: var(--roi-font-size-xs);
    color: var(--roi-color-gray-400);
    border-top: 1px solid var(--roi-color-gray-200);
  }
}

/* ===================================================================
   CATEGORY-BASED COLOR SCHEMES
   =================================================================== */

/* Waste Reduction - Deep Emerald */
.roi-widget-calculator[data-category="waste-reduction"] .roi-widget-header-modern {
  background: linear-gradient(135deg, #065f46 0%, #047857 50%, #064e3b 100%);
}

/* Production Efficiency - Deep Indigo */
.roi-widget-calculator[data-category="production-efficiency"] .roi-widget-header-modern {
  background: linear-gradient(135deg, var(--roi-color-primary-700) 0%, #312e81 50%, #1e1b4b 100%);
}

/* Cost Optimization - Rich Purple */
.roi-widget-calculator[data-category="cost-optimization"] .roi-widget-header-modern {
  background: linear-gradient(135deg, var(--roi-color-purple-700) 0%, #5b21b6 50%, #4c1d95 100%);
}

/* Risk & Compliance - Deep Amber */
.roi-widget-calculator[data-category="risk-compliance"] .roi-widget-header-modern {
  background: linear-gradient(135deg, #92400e 0%, var(--roi-color-amber-700) 50%, #78350f 100%);
}

/* Calculator Icon Styling */
.roi-widget-calculator-icon {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--roi-radius-xl);
  margin-right: var(--roi-space-4);
  flex-shrink: 0;
}

.roi-widget-calculator-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
}

.roi-widget-header-content {
  display: flex;
  align-items: center;
  margin-top: var(--roi-space-4);
  position: relative;
  z-index: 1;
}

/* Category Badge */
.roi-widget-category-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--roi-space-2);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 0.35rem var(--roi-space-3);
  border-radius: var(--roi-radius-full);
  font-size: var(--roi-font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* ===================================================================
   DARK MODE (opt-in via class or prefers-color-scheme)
   =================================================================== */

/* Dark mode is the default theme.
   To support a light-mode toggle, add a .roi-widget-light class override here. */

