* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg: #f9fafb;
    --surface: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    scroll-behavior: smooth;
}

.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 800px;
    margin: 0 auto 2rem;
}

.cost-delta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.cost-box {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    border-radius: 12px;
    min-width: 150px;
}

.cost-label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cost-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.cost-arrow {
    font-size: 3rem;
    opacity: 0.8;
}

.savings-badge {
    display: inline-block;
    background: var(--danger);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.section {
    background: var(--surface);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.section h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.findings-grid {
    display: grid;
    gap: 1rem;
}

.finding-card {
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.finding-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.finding-card.high {
    border-left: 4px solid var(--danger);
}

.finding-card.medium {
    border-left: 4px solid var(--warning);
}

.finding-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.finding-title {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text);
}

.severity-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.high {
    background: #fee2e2;
    color: var(--danger);
}

.severity-badge.medium {
    background: #fef3c7;
    color: #d97706;
}

.finding-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.finding-detail strong {
    color: var(--text);
}

.change-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

.change-before {
    color: var(--primary);
}

.change-after {
    color: var(--danger);
}

.finding-details-expanded {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: none;
}

.finding-card.expanded .finding-details-expanded {
    display: block;
}

.rationale {
    background: var(--bg);
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.policy-tag {
    display: inline-block;
    background: #dbeafe;
    color: var(--info);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    margin: 0.25rem 0.25rem 0.25rem 0;
}

.cta-section {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: white;
    border-radius: 12px;
    margin: 2rem 0;
}

.cta-section h2 {
    color: white;
    margin-bottom: 1rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: white;
    color: var(--text);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg);
    border-radius: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.trend-chart {
    width: 100%;
    height: 300px;
    background: var(--bg);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.trend-chart.zoomed {
    height: 600px;
}

.trend-chart img {
    transition: transform 0.3s ease;
}

.trend-chart.zoomed img {
    transform: scale(1.5);
}

.trend-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    pointer-events: none;
    display: none;
    z-index: 1000;
    white-space: nowrap;
}

.expand-hint {
    color: var(--primary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

#mappingChart {
    height: auto !important;
    min-height: 300px !important;
    overflow: visible !important;
    text-align: center !important;
    padding: 1rem !important;
    background: var(--bg) !important;
    border-radius: 8px !important;
}

#mappingChart svg {
    max-width: 100% !important;
    height: auto !important;
}

/* ROI Calculator Styles */
.roi-calculator-section {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 3rem 0;
    margin: 2rem 0;
}

.roi-calculator {
    background: var(--surface);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
    max-width: 1000px;
    margin: 0 auto;
}

.roi-calculator h2 {
    text-align: center;
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
}

.roi-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.slider-hint {
    text-align: center;
    color: var(--primary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.8;
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    justify-items: center;
}

.slider-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.slider-group label {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.slider-container {
    position: relative;
    height: 220px;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1rem 0;
}

.slider-container input[type="range"] {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 80px;
    height: 220px;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
    margin: 0;
    position: relative;
    z-index: 2;
}

/* Custom track background */
.slider-container::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 180px;
    background: linear-gradient(to bottom, #e5e7eb 0%, #d1d5db 100%);
    border-radius: 6px;
    z-index: 1;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Progress fill */
.slider-container::after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: var(--progress-height, 0px);
    background: linear-gradient(to top, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 6px;
    z-index: 1;
    transition: height 0.1s ease;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

/* Tick marks */
.slider-container .tick-marks {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 20px;
    height: 180px;
    width: 20px;
    pointer-events: none;
    z-index: 0;
}

.slider-container .tick-marks::before,
.slider-container .tick-marks::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 180px;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 16px,
        rgba(0, 0, 0, 0.1) 16px,
        rgba(0, 0, 0, 0.1) 18px
    );
}

.slider-container .tick-marks::before {
    left: -4px;
}

.slider-container .tick-marks::after {
    right: -4px;
}

/* Webkit browsers (Chrome, Safari, Edge) */
.slider-container input[type="range"]::-webkit-slider-track {
    background: transparent;
    width: 12px;
    height: 180px;
    border-radius: 6px;
    border: none;
    margin: 20px 0;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 32px;
    height: 32px;
    background: #9ca3af;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    position: relative;
    z-index: 3;
    animation: sliderPulse 2s ease-in-out infinite;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(255, 255, 255, 0.9);
    cursor: grab;
    animation: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.05);
    animation: none;
}

/* Firefox */
.slider-container input[type="range"]::-moz-range-track {
    background: transparent;
    width: 12px;
    height: 180px;
    border-radius: 6px;
    border: none;
    margin: 20px 0;
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 32px;
    height: 32px;
    background: #9ca3af;
    border: 2px solid var(--primary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    position: relative;
    z-index: 3;
    animation: sliderPulse 2s ease-in-out infinite;
}

.slider-container input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(255, 255, 255, 0.9);
    cursor: grab;
    animation: none;
}

.slider-container input[type="range"]::-moz-range-thumb:active {
    cursor: grabbing;
    transform: scale(1.05);
    animation: none;
}

.slider-value {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    min-height: 1.5rem;
}

.roi-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    text-align: center;
}

.result-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}

.result-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

/* Color-coded sliders */
.spend-slider::after {
    background: linear-gradient(to top, #3b82f6 0%, #1d4ed8 100%) !important;
}

.waste-slider::after {
    background: linear-gradient(to top, #f59e0b 0%, #d97706 100%) !important;
}

.detection-slider::after {
    background: linear-gradient(to top, var(--primary) 0%, var(--primary-dark) 100%) !important;
}

.spend-slider input[type="range"]::-webkit-slider-thumb {
    border-color: #3b82f6 !important;
}

.waste-slider input[type="range"]::-webkit-slider-thumb {
    border-color: #f59e0b !important;
}

.detection-slider input[type="range"]::-webkit-slider-thumb {
    border-color: var(--primary) !important;
}

.spend-slider input[type="range"]::-moz-range-thumb {
    border-color: #3b82f6 !important;
}

.waste-slider input[type="range"]::-moz-range-thumb {
    border-color: #f59e0b !important;
}

.detection-slider input[type="range"]::-moz-range-thumb {
    border-color: var(--primary) !important;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .roi-calculator {
        padding: 1.5rem;
        margin: 0 1rem;
    }

    .roi-calculator h2 {
        font-size: 1.5rem;
    }

    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .slider-container {
        height: 180px;
        width: 60px;
    }

    .slider-container input[type="range"] {
        width: 180px;
        height: 60px;
    }

    .slider-container::before {
        width: 10px;
        height: 140px;
        top: 15px;
    }

    .slider-container::after {
        width: 10px;
        bottom: 15px;
    }

    .slider-container input[type="range"]::-webkit-slider-track {
        width: 10px;
        height: 140px;
        margin: 15px 0;
    }

    .slider-container input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }

    .slider-container input[type="range"]::-moz-range-track {
        width: 10px;
        height: 140px;
        margin: 15px 0;
    }

    .slider-container input[type="range"]::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }

    .roi-results {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .result-value {
        font-size: 1.5rem;
    }
}

@keyframes sliderPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 0 4px rgba(16, 185, 129, 0.1);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 0 6px rgba(16, 185, 129, 0.2);
    }
}

/* Terminal Demo Styles */
.terminal-demo {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 4rem 2rem;
    color: white;
    text-align: center;
}

.terminal-demo h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.terminal-demo p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.terminal-window {
    background: #000;
    border-radius: 8px;
    margin: 0 auto;
    max-width: 1200px;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    line-height: 1.5;
    color: #00ff00;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: block;
}

.terminal-header {
    background: #333;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.terminal-title {
    font-size: 0.875rem;
    color: #ccc;
}

.terminal-controls {
    display: flex;
    gap: 0.5rem;
}

.control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.red { background: #ff5f57; }
.yellow { background: #ffbd2e; }
.green { background: #28ca42; }

.terminal-body {
    padding: 1.5rem;
    text-align: left;
}

.prompt {
    color: #00ff00;
    display: inline;
}

.command {
    color: #fff;
}

.output {
    color: #00ff00;
    margin-top: 1rem;
    white-space: pre-line;
}

.run-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 2rem;
    transition: background 0.3s;
}

.run-btn:hover {
    background: var(--primary-dark);
}

.typing::after {
    content: '|';
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}