/* ROI Calculator - IBM Design Style */

/* Calculator Header */
.calc-header {
    background: #ffffff;
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-04) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.calc-header .logo {
    font-size: var(--text-heading-04);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    text-decoration: none;
}

.calc-title {
    font-size: var(--text-heading-03);
    font-weight: var(--font-weight-light);
    color: var(--color-text-primary);
    margin: 0;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 18px;
}

.btn-close:hover {
    background: var(--color-background-subtle);
    color: var(--color-text-primary);
}

/* Progress Bar */
.progress-bar {
    height: 4px;
    background: var(--color-background-subtle);
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, #0353e9 100%);
    width: 30%;
    transition: width 0.3s ease;
}

/* Main Layout */
.calculator-main {
    background: var(--color-background-subtle);
    min-height: calc(100vh - 80px);
    padding: var(--spacing-05) 0;
}

.calc-grid {
    display: grid;
    grid-template-columns: minmax(450px, 1fr) minmax(550px, 1.2fr);
    gap: var(--spacing-05);
    max-width: 1600px;
    margin: 0 auto;
}

/* Input Section */
.calc-inputs {
    background: var(--color-background);
    padding: var(--spacing-05);
    border: 1px solid var(--color-border);
    height: calc(100vh - 140px);
    overflow-y: auto;
    border-radius: 4px;
    scroll-behavior: smooth;
}

.calc-inputs::-webkit-scrollbar {
    width: 10px;
}

.calc-inputs::-webkit-scrollbar-track {
    background: var(--color-background-subtle);
    border-radius: 5px;
}

.calc-inputs::-webkit-scrollbar-thumb {
    background: #c1c7cd;
    border-radius: 5px;
    border: 2px solid var(--color-background-subtle);
}

.calc-inputs::-webkit-scrollbar-thumb:hover {
    background: #8d95a1;
}

.calc-section {
    margin-bottom: var(--spacing-06);
}

.section-title {
    font-size: var(--text-heading-04);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-04);
}

/* Form Elements */
.form-group {
    margin-bottom: var(--spacing-04);
}

.form-group label {
    display: block;
    font-size: var(--text-body-small);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-02);
}

.form-input,
.form-select {
    width: 100%;
    padding: var(--spacing-02) var(--spacing-03);
    border: 1px solid var(--color-border);
    background: var(--color-background);
    color: var(--color-text-primary);
    font-size: var(--text-body);
    transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
}

.input-hint {
    display: block;
    font-size: var(--text-body-small);
    color: var(--color-text-tertiary);
    margin-top: var(--spacing-01);
}

/* Slider Inputs */
.form-slider {
    width: calc(100% - 60px);
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--color-border);
    outline: none;
    transition: background 0.3s;
}

.form-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    cursor: pointer;
    border-radius: 50%;
}

.form-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    cursor: pointer;
    border-radius: 50%;
}

.slider-value {
    display: inline-block;
    width: 50px;
    text-align: right;
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
}

/* Agent Tabs */
.agent-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-02);
}

.agent-tab {
    padding: var(--spacing-03) var(--spacing-02);
    border: 1px solid var(--color-border);
    background: var(--color-background);
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-01);
    font-size: var(--text-body-small);
}

.agent-tab:hover {
    background: var(--color-background-subtle);
}

.agent-tab.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.tab-icon {
    font-size: 24px;
}

/* Agent Configuration Sections */
.agent-config {
    display: none;
    padding: var(--spacing-04);
    background: var(--color-background-subtle);
    border: 1px solid var(--color-border);
}

.agent-config.active {
    display: block;
}

.config-title {
    font-size: var(--text-heading-04);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-02);
}

.config-desc {
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-04);
}

/* Metric Preview */
.metric-preview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-03);
    margin-top: var(--spacing-04);
    padding: var(--spacing-03);
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0ff 100%);
    border-left: 3px solid var(--color-primary);
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-01);
}

.metric-label {
    font-size: var(--text-body-small);
    color: var(--color-text-secondary);
}

.metric-value {
    font-size: var(--text-heading-04);
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
}

/* Results Section */
.calc-results {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-04);
    height: calc(100vh - 140px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-03);
    scroll-behavior: smooth;
    background: #f8f9fa;
}

/* Custom Scrollbar */
.calc-results::-webkit-scrollbar {
    width: 10px;
}

.calc-results::-webkit-scrollbar-track {
    background: var(--color-background-subtle);
    border-radius: 5px;
}

.calc-results::-webkit-scrollbar-thumb {
    background: #c1c7cd;
    border-radius: 5px;
    border: 2px solid var(--color-background-subtle);
}

.calc-results::-webkit-scrollbar-thumb:hover {
    background: #8d95a1;
}

.result-card {
    background: var(--color-background);
    padding: var(--spacing-05);
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow var(--transition-base);
    border-radius: 4px;
}

.result-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Chart Containers - Fixed Heights */
.result-card canvas {
    max-height: 300px !important;
    width: 100% !important;
}

.summary-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-left: 4px solid var(--color-primary);
    margin-bottom: var(--spacing-04);
}

.result-title {
    font-size: var(--text-heading-03);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-04);
}

.result-subtitle {
    font-size: var(--text-heading-04);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-03);
}

/* ROI Display */
.roi-headline {
    text-align: center;
    padding: var(--spacing-04) 0;
    background: linear-gradient(135deg, rgba(15, 98, 254, 0.05) 0%, rgba(3, 83, 233, 0.03) 100%);
    border-radius: 8px;
    margin-bottom: var(--spacing-03);
}

.roi-label {
    font-size: var(--text-body);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-02);
}

.roi-value {
    font-size: clamp(42px, 4vw, 64px);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.roi-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-03);
}

.roi-metric {
    padding: var(--spacing-03);
    background: var(--color-background-subtle);
}

.roi-metric.negative .metric-value {
    color: #da1e28;
}

/* Breakdown Table */
.breakdown-table {
    width: 100%;
    border-collapse: collapse;
}

.breakdown-table th,
.breakdown-table td {
    padding: var(--spacing-03);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.breakdown-table th {
    background: var(--color-background-subtle);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-secondary);
    font-size: var(--text-body-small);
}

.breakdown-table td {
    color: var(--color-text-primary);
}

.breakdown-table tr:last-child td {
    border-bottom: none;
    font-weight: var(--font-weight-medium);
}

/* Benefits Grid */
.benefits-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-03);
}

.benefit-item {
    display: flex;
    gap: var(--spacing-03);
    padding: var(--spacing-03);
    background: var(--color-background-subtle);
}

.benefit-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.benefit-text {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-01);
}

.benefit-text strong {
    color: var(--color-text-primary);
    font-size: var(--text-body);
}

.benefit-text span {
    color: var(--color-text-secondary);
    font-size: var(--text-body-small);
}

/* CTA Card */
.cta-card {
    background: linear-gradient(135deg, var(--color-primary) 0%, #0353e9 100%);
    color: white;
    text-align: center;
}

.cta-title {
    font-size: var(--text-heading-03);
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--spacing-02);
}

.cta-text {
    margin-bottom: var(--spacing-04);
    opacity: 0.9;
}

.cta-actions {
    display: flex;
    gap: var(--spacing-03);
    justify-content: center;
    margin-bottom: var(--spacing-04);
}

.cta-card .btn {
    min-width: 150px;
}

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

.cta-card .btn-secondary {
    background: transparent;
    color: white;
    border: 1px solid white;
}

.cta-contact {
    padding-top: var(--spacing-03);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0.9;
}

/* Advanced Controls */
.advanced-controls {
    background: var(--color-background-subtle);
    padding: var(--spacing-04);
    margin-bottom: var(--spacing-05);
    border: 1px solid var(--color-border);
}

.control-group {
    margin-bottom: var(--spacing-03);
}

.control-group label {
    font-size: var(--text-body);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-02);
    display: block;
}

.help-text {
    font-size: var(--text-caption);
    color: var(--color-text-tertiary);
    margin-left: var(--spacing-02);
}

/* Adoption Ramp Selection */
.adoption-ramp {
    padding: var(--spacing-04);
    background: var(--color-background-subtle);
    border-radius: 4px;
}

.ramp-label {
    font-size: var(--text-body);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-03);
}

.ramp-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-03);
}

.ramp-option {
    padding: var(--spacing-03);
    background: var(--color-background);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
}

.ramp-option:hover {
    border-color: var(--color-primary);
    background: var(--color-background-hover);
}

.ramp-option.active {
    border-color: var(--color-primary);
    background: rgba(15, 98, 254, 0.05);
}

.ramp-name {
    display: block;
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-02);
}

.ramp-values {
    display: block;
    font-size: var(--text-caption);
    color: var(--color-text-secondary);
}

/* Scenario Selector */
.scenario-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-03);
    margin-top: var(--spacing-04);
}

.scenario-selector label {
    margin: 0;
    font-weight: var(--font-weight-medium);
}

.scenario-btn {
    padding: var(--spacing-02) var(--spacing-03);
    background: var(--color-background);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.scenario-btn:hover {
    border-color: var(--color-primary);
}

.scenario-btn.active {
    background: var(--color-primary);
    color: var(--color-background);
    border-color: var(--color-primary);
}

/* ROI Secondary Stats */
.roi-secondary {
    display: flex;
    justify-content: center;
    gap: var(--spacing-06);
    margin-top: var(--spacing-04);
    padding-top: var(--spacing-04);
    border-top: 1px solid var(--color-border);
}

.roi-stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: var(--text-caption);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-02);
}

.stat-value {
    display: block;
    font-size: var(--text-heading-04);
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
}

/* Key Assumptions Display */
#keyAssumptions {
    display: flex;
    gap: var(--spacing-04);
    padding: var(--spacing-03);
    background: var(--color-background-subtle);
    border-radius: 4px;
    margin-top: var(--spacing-04);
}

.assumption-item {
    flex: 1;
    text-align: center;
}

.assumption-item .label {
    display: block;
    font-size: var(--text-caption);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-01);
}

.assumption-item .value {
    display: block;
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--color-background);
    padding: var(--spacing-06);
    max-width: 500px;
    border: 1px solid var(--color-border);
}

.modal-content h3 {
    margin-bottom: var(--spacing-04);
}

.modal-content ul {
    margin-bottom: var(--spacing-04);
    padding-left: var(--spacing-04);
}

.modal-content li {
    margin-bottom: var(--spacing-02);
    color: var(--color-text-secondary);
}

/* Chart-specific styling */
#roiChart {
    height: 350px !important;
    max-height: 350px !important;
}

#agentChart {
    height: 280px !important;
    max-height: 280px !important;
}

#categoryChart {
    height: 320px !important;
    max-height: 320px !important;
}

/* Chart wrapper for better control */
.chart-wrapper {
    position: relative;
    height: 100%;
    width: 100%;
    padding: var(--spacing-02);
}

/* Improve table styling */
.breakdown-table {
    width: 100%;
    font-size: var(--text-body);
}

.breakdown-table th {
    background: var(--color-background-subtle);
    padding: var(--spacing-03);
    text-align: left;
    font-weight: var(--font-weight-medium);
    border-bottom: 2px solid var(--color-border);
}

.breakdown-table td {
    padding: var(--spacing-03);
    border-bottom: 1px solid var(--color-border);
}

.breakdown-table tr:hover {
    background: var(--color-background-hover);
}

/* Process Type Selector */
.process-type-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-03);
    margin-bottom: var(--spacing-04);
}

.process-type-btn {
    padding: var(--spacing-04);
    background: var(--color-background);
    border: 2px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: center;
}

.process-type-btn:hover:not(.disabled) {
    border-color: var(--color-primary);
    background: var(--color-background-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.15);
}

.process-type-btn.active {
    background: linear-gradient(135deg, rgba(15, 98, 254, 0.1) 0%, rgba(3, 83, 233, 0.05) 100%);
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.2);
}

.process-type-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.type-label {
    display: block;
    font-size: var(--text-heading-04);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-02);
}

.type-count {
    display: block;
    font-size: var(--text-body-small);
    color: var(--color-text-secondary);
}

/* Processes Grid */
.processes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-03);
    margin-bottom: var(--spacing-04);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--spacing-03);
    background: var(--color-background-subtle);
    border-radius: 8px;
}

.process-card {
    background: var(--color-background);
    border: 2px solid var(--color-border);
    border-radius: 6px;
    padding: var(--spacing-03);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.process-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.15);
}

.process-card.selected {
    background: linear-gradient(135deg, rgba(15, 98, 254, 0.08) 0%, rgba(3, 83, 233, 0.04) 100%);
    border-color: var(--color-primary);
}

.process-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.process-id {
    font-size: var(--text-caption);
    color: var(--color-text-tertiary);
    font-family: monospace;
    margin-bottom: var(--spacing-01);
}

.process-name {
    font-size: var(--text-body);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-02);
}

.process-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-02);
    padding-top: var(--spacing-02);
    border-top: 1px solid var(--color-border);
}

.process-kpi {
    display: flex;
    align-items: center;
    gap: var(--spacing-01);
}

.kpi-label {
    font-size: var(--text-caption);
    color: var(--color-text-secondary);
}

.kpi-value {
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
}

.process-model {
    font-size: var(--text-caption);
    color: var(--color-text-tertiary);
    background: var(--color-background-subtle);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Process Summary */
.process-summary {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-03);
    background: linear-gradient(135deg, rgba(15, 98, 254, 0.05) 0%, rgba(3, 83, 233, 0.02) 100%);
    border-radius: 6px;
    margin-top: var(--spacing-03);
}

.summary-item {
    text-align: center;
}

.summary-item .label {
    display: block;
    font-size: var(--text-body-small);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-01);
}

.summary-item .value {
    display: block;
    font-size: var(--text-heading-04);
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
}

/* Improve form elements */
.form-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--color-background-subtle);
    outline: none;
    -webkit-appearance: none;
}

.form-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 98, 254, 0.3);
    transition: all var(--transition-base);
}

.form-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(15, 98, 254, 0.4);
}

.form-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 98, 254, 0.3);
    transition: all var(--transition-base);
}

/* Section headers */
.section-title {
    font-size: var(--text-heading-04);
    font-weight: var(--font-weight-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-04);
    padding-bottom: var(--spacing-02);
    border-bottom: 2px solid var(--color-primary);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .calc-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 1200px) {
    .calc-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-04);
    }
    
    .calc-inputs,
    .calc-results {
        max-height: none;
        height: auto;
        position: static;
    }
    
    .roi-metrics {
        grid-template-columns: 1fr;
    }
    
    .agent-tabs {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .agent-tabs {
        grid-template-columns: 1fr;
    }
    
    .benefits-grid {
        grid-template-columns: 1fr;
    }
    
    .cta-actions {
        flex-direction: column;
    }
    
    .calc-title {
        font-size: var(--text-heading-04);
    }
    
    .roi-value {
        font-size: var(--text-heading-01);
    }
}