/* =====================================================
   FuseLidar.com - Calculator & Interactive Elements Stylesheet
   Styles for demos, calculators, and visualizations
   ===================================================== */

/* =====================================================
   Calculator Widget Base Styles
   ===================================================== */

.calculator-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.calculator-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

.calculator-widget h3 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calculator-widget h3::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
}

/* =====================================================
   Sensor Fusion Visualizer
   ===================================================== */

.visualizer-container {
    margin-top: 1.5rem;
}

.sensor-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.sensor-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.sensor-toggle:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.sensor-toggle input[type="checkbox"] {
    width: 0;
    height: 0;
    opacity: 0;
    position: absolute;
}

.sensor-toggle span {
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.sensor-toggle input:checked + span {
    color: var(--primary);
}

.sensor-toggle::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    left: 0.625rem;
    transition: var(--transition);
}

.sensor-toggle input:checked ~ ::after {
    background: var(--gradient-primary);
    border-color: var(--primary);
}

.visualizer-display {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: relative;
}

#fusionCanvas {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

/* =====================================================
   Confidence Bar
   ===================================================== */

.confidence-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
}

.confidence-bar span {
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.confidence-meter {
    flex: 1;
    height: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.confidence-fill {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.confidence-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.confidence-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 60px;
    text-align: right;
}

/* =====================================================
   Fusion Confidence Calculator
   ===================================================== */

.calc-inputs {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9375rem;
}

.input-group input[type="range"] {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    outline: none;
    -webkit-appearance: none;
    position: relative;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.4);
    transition: var(--transition);
}

.input-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.6);
}

.input-group input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.4);
    transition: var(--transition);
    border: none;
}

.input-group select {
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.input-group select:hover {
    border-color: var(--primary);
}

.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

/* =====================================================
   Sensor Accuracies
   ===================================================== */

.sensor-accuracies {
    display: grid;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin: 1rem 0;
}

.sensor-accuracies label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.sensor-accuracies label span {
    color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
}

.sensor-accuracies input[type="range"] {
    margin-top: 0.5rem;
}

/* =====================================================
   Calculate Button
   ===================================================== */

.btn-generate,
.btn-calculate {
    background: var(--gradient-primary);
    color: white;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1.5rem;
    width: 100%;
}

.btn-generate:hover,
.btn-calculate:hover {
    background: var(--gradient-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(147, 51, 234, 0.3);
}

.btn-generate:active,
.btn-calculate:active {
    transform: translateY(0);
}

/* =====================================================
   Results Display
   ===================================================== */

.calc-results {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--primary);
}

.calc-results h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.result-item {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
}

.result-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#reliability-grade {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    display: inline-block;
    margin-top: 0.5rem;
}

#reliability-grade.excellent {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

#reliability-grade.good {
    background: rgba(6, 182, 212, 0.2);
    color: var(--info);
}

#reliability-grade.fair {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

#reliability-grade.low {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.result-recommendation {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    margin-top: 1.5rem;
}

.result-recommendation p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.result-recommendation strong {
    color: var(--primary);
}

/* =====================================================
   Kalman Filter Simulator
   ===================================================== */

.kalman-container {
    margin-top: 1.5rem;
}

.kalman-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.kalman-display {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    position: relative;
}

#kalmanCanvas {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.03) 0%, rgba(236, 72, 153, 0.03) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.kalman-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-item::before {
    content: '';
    width: 20px;
    height: 3px;
    border-radius: var(--radius-full);
}

.legend-item.predicted::before {
    background: var(--primary);
    border: 1px dashed var(--primary);
}

.legend-item.measured::before {
    background: var(--accent);
    opacity: 0.5;
}

.legend-item.fused::before {
    background: var(--success);
}

/* =====================================================
   Sensor Coverage Map
   ===================================================== */

.coverage-container {
    margin-top: 1.5rem;
}

.coverage-display {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#coverageCanvas {
    width: 100%;
    max-width: 500px;
    height: 500px;
    background: radial-gradient(circle at center, rgba(147, 51, 234, 0.05) 0%, transparent 70%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.coverage-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    width: 100%;
    justify-content: center;
}

.coverage-stats .stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.coverage-stats span:first-child {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.coverage-stats span:last-child {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.125rem;
}

.sensor-specs {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    width: 100%;
}

.sensor-specs h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.sensor-specs ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.sensor-specs li {
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
}

/* =====================================================
   Demo Descriptions
   ===================================================== */

.demo-desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.6;
}

/* =====================================================
   Calculator Disclaimer
   ===================================================== */

.calculator-disclaimer {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(239, 68, 68, 0.1) 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--warning);
}

.calculator-disclaimer p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.calculator-disclaimer strong {
    color: var(--warning);
    font-weight: 600;
}

/* =====================================================
   Loading States
   ===================================================== */

.calculator-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.calculator-loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   Interactive Hover Effects
   ===================================================== */

.calculator-widget:hover {
    box-shadow: 0 10px 30px rgba(147, 51, 234, 0.1);
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(147, 51, 234, 0.1);
}

/* =====================================================
   Responsive Adjustments
   ===================================================== */

@media screen and (max-width: 768px) {
    .calculator-widget {
        padding: 1.5rem;
    }

    .calc-results {
        padding: 1.5rem;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .kalman-controls {
        grid-template-columns: 1fr;
    }

    .coverage-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .sensor-specs ul {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 480px) {
    .calculator-widget {
        padding: 1rem;
    }

    .calculator-widget h3 {
        font-size: 1.25rem;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .confidence-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .sensor-controls {
        flex-direction: column;
    }

    .sensor-toggle {
        width: 100%;
        justify-content: center;
    }
}