/* ==========================================================================
   Calculator Layout & Base Styles
   ========================================================================== */
.calculator-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 40px;
    background: none;
    border-radius: none;
    border: none;
    box-shadow: none;
}

.calculator-form, .calculator-results {
    flex: 1;
    min-width: 300px;
    padding: 0;
}

.section-title {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0dcd0;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */
.form-group { margin-bottom: 24px; }

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #444;
}

.small-note {
    font-size: 11px;
    color: #777;
    margin-top: 4px;
    line-height: 1.4;
}

input[type="number"], select, input[type="text"], input[type="range"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
}

input[type="number"]:focus, select:focus, input[type="text"]:focus {
    outline: 2px solid #4CAF50;
    outline-offset: -1px;
}

input[type="range"] {
    padding: 8px 12px;
    height: 40px;
}

.range-value {
    display: inline-block;
    width: 40px;
    text-align: center;
    font-weight: bold;
    color: #4CAF50;
    margin-left: 10px;
}

.range-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.range-container input[type="range"] { flex: 1; }

/* ==========================================================================
   Buttons & Controls
   ========================================================================== */
.btn {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.2s;
    width: 100%;
    margin-top: 10px;
}

.btn:hover { background-color: #388E3C; transform: translateY(-2px); }

.btn-secondary { background-color: #7a7a7a; margin-top: 5px; }
.btn-secondary:hover { background-color: #666; }

.export-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.export-btn {
    padding: 10px 20px;
    background-color: #7a7a7a;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.export-btn:hover { background-color: #666; }
.export-btn.csv { background-color: #2e7d32; }
.export-btn.csv:hover { background-color: #1b5e20; }
.export-btn.print { background-color: #1565c0; }
.export-btn.print:hover { background-color: #0d47a1; }

/* ==========================================================================
   Results Header & Main Values
   ========================================================================== */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.results-title { font-size: 18px; color: #333; font-weight: 600; }

.result-value {
    font-size: 36px;
    font-weight: 800;
    color: #4CAF50;
    margin: 20px 0;
    text-align: center;
    padding: 15px;
    background-color: rgba(76, 175, 80, 0.05);
    border-radius: 4px;
}

.negative-roi {
    color: #f44336;
    background-color: rgba(244, 67, 54, 0.05);
}

.result-breakdown { margin-top: 25px; }

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.breakdown-item:last-child {
    border-bottom: none;
    font-weight: 700;
    color: #2e7d32;
}

/* ==========================================================================
   Grids & Metric Boxes
   ========================================================================== */
.impact-grid, .roi-grid, .cohort-metrics, .lifetime-metrics, .acquisition-metrics, 
.roi-insights-grid, .timeline-metrics, .cost-grid, .sensitivity-grid, 
.value-metrics, .retention-metrics, .monetization-metrics, .ltv-metrics, 
.conversion-metrics, .dropoff-metrics, .efficiency-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.trial-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.impact-item, .roi-item, .cohort-metric, .lifetime-metric, .acquisition-metric,
.roi-insight, .timeline-metric, .cost-metric, .sensitivity-metric,
.value-metric, .retention-metric, .monetization-metric, .ltv-metric,
.conversion-metric, .dropoff-metric, .efficiency-metric, .trial-metric {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.trial-metric { padding: 15px; border-left: 3px solid #ddd; }

/* Metric Values & Labels */
.impact-value, .sensitivity-value, .dropoff-value { font-size: 18px; font-weight: bold; color: #f44336; }
.roi-value, .cost-value { font-size: 18px; font-weight: bold; color: #4CAF50; }
.cohort-value { font-size: 16px; font-weight: bold; color: #FF9800; }
.lifetime-value, .timeline-value, .value-value, .retention-value, .ltv-value, .efficiency-value { font-size: 16px; font-weight: bold; color: #673AB7; }
.acquisition-value, .insight-value, .monetization-value, .conversion-value { font-size: 16px; font-weight: bold; color: #2196F3; }
.trial-metric-value { font-size: 24px; font-weight: 800; color: #d4af37; }

.impact-label, .roi-label, .cohort-label, .lifetime-label, .acquisition-label,
.insight-label, .timeline-label, .cost-label, .sensitivity-label,
.value-label, .retention-label, .monetization-label, .ltv-label,
.conversion-label, .dropoff-label, .efficiency-label {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.trial-metric-title { font-weight: 600; margin-bottom: 10px; color: #333; }

/* ==========================================================================
   Analysis Section Backgrounds & Alerts
   ========================================================================== */
.financial-impact, .dropoff-analysis, .sensitivity-analysis {
    background-color: rgba(244, 67, 54, 0.05); padding: 15px; border-radius: 4px; margin: 15px 0; border-left: 3px solid #f44336;
}
.roi-analysis, .cost-effectiveness, .optimization-recommendations, .optimization-strategies {
    background-color: rgba(76, 175, 80, 0.05); padding: 15px; border-radius: 4px; margin: 15px 0; border-left: 3px solid #4CAF50;
}
.cohort-analysis {
    margin-top: 20px; padding: 20px; background: #f9f9f9; border-radius: 4px; border-left: 3px solid #FF9800;
}
.lifetime-value-analysis, .roi-timeline, .retention-impact, .funnel-efficiency {
    background-color: rgba(103, 58, 183, 0.05); padding: 20px; border-radius: 4px; margin: 20px 0; border-left: 4px solid #673AB7;
}
.acquisition-efficiency, .acquisition-impact, .roi-insights, .monetization-impact, .conversion-analysis {
    background-color: rgba(33, 150, 243, 0.05); padding: 20px; border-radius: 4px; margin: 20px 0; border-left: 4px solid #2196F3;
}
.investment-strategies {
    background-color: rgba(255, 152, 0, 0.05); padding: 20px; border-radius: 4px; margin: 20px 0; border-left: 4px solid #FF9800;
}
.investment-scenario {
    background-color: rgba(156, 39, 176, 0.05); padding: 15px; border-radius: 4px; margin: 15px 0; border-left: 3px solid #9C27B0;
}
.time-sensitivity-analysis {
    background-color: rgba(255, 87, 34, 0.05); padding: 15px; border-radius: 4px; margin: 15px 0; border-left: 3px solid #FF5722;
}
.time-threshold {
    background-color: rgba(0, 150, 136, 0.05); padding: 15px; border-radius: 4px; margin: 15px 0; border-left: 3px solid #009688;
}

/* Alerts */
.critical-churn-alert, .critical-time-alert, .critical-opportunity-alert, .critical-step-alert, .critical-failure-alert, .low-roi-alert {
    background-color: rgba(255, 152, 0, 0.1); padding: 15px; border-radius: 4px; margin: 15px 0; border-left: 3px solid #FF9800;
}
.high-roi-alert {
    background-color: rgba(76, 175, 80, 0.1); padding: 15px; border-radius: 4px; margin: 15px 0; border-left: 3px solid #4CAF50;
}
.negative-roi-alert {
    background-color: rgba(244, 67, 54, 0.1); padding: 15px; border-radius: 4px; margin: 15px 0; border-left: 3px solid #f44336;
}

/* ==========================================================================
   Dynamic Form Steps & Stages (Retention, Value, Funnel, Trial, Goals)
   ========================================================================== */
.retention-stages-container, .value-steps-container, .funnel-steps-container, .success-goals-container, .trial-phase-analysis {
    margin-bottom: 20px;
}

.retention-stage, .value-step, .funnel-step, .success-goal, .trial-phase {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    border-left: 3px solid #ddd;
}

.stage-header, .step-header, .goal-header, .phase-header { 
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; 
}

.stage-number, .step-number, .goal-number, .phase-number {
    background: #4CAF50; color: white; width: 30px; height: 30px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold;
}
.step-number { background: #2196F3; }
.goal-number, .phase-number { background: #d4af37; }

.remove-stage, .remove-step, .remove-goal, .remove-phase, .remove-scenario {
    background: #ff4444; color: white; border: none; padding: 5px 10px; border-radius: 3px; cursor: pointer; font-size: 12px;
}

.stage-fields, .step-fields, .goal-fields, .phase-fields, .scenario-fields { 
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; 
}
.funnel-step .step-fields { grid-template-columns: 1fr 1fr; }

.add-stage-btn, .add-step-btn, .add-goal-btn, .add-phase-btn, .add-scenario-btn, .add-definition-btn {
    background: #4CAF50; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-size: 14px; margin-top: 10px;
}
.add-stage-btn { background: #2196F3; }

/* ==========================================================================
   Specific Components (Strategies, Definitions, Progress Bars)
   ========================================================================== */
.strategy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-top: 15px; }
.strategy-card { background: white; padding: 15px; border-radius: 4px; border: 1px solid #e0e0e0; }
.strategy-card h5, .strategy-card h6 { margin-bottom: 8px; font-size: 14px; color: #4CAF50; }
.strategy-card h6 { color: #FF9800; }
.strategy-card p { font-size: 12px; line-height: 1.5; color: #666; }

.activation-definition-container { margin-bottom: 20px; }
.definition-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.definition-card { background: #f9f9f9; padding: 20px; border-radius: 4px; margin-bottom: 15px; border-left: 3px solid #d4af37; }
.definition-type { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.type-option { padding: 8px 15px; background: #e0e0e0; border-radius: 4px; cursor: pointer; font-size: 13px; transition: all 0.3s; }
.type-option.active { background: #d4af37; color: white; }
.definition-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 15px; }
.definition-field { margin-bottom: 15px; }
.definition-field label { font-size: 13px; margin-bottom: 5px; }

.recommendation-list { list-style-type: none; padding-left: 0; }
.recommendation-list li { padding: 10px; margin-bottom: 10px; background: white; border-radius: 4px; border-left: 3px solid #4CAF50; }

.step-comparison { display: flex; align-items: center; justify-content: space-between; margin: 10px 0; padding: 10px; background: white; border-radius: 4px; }
.step-comparison-bar { flex-grow: 1; height: 8px; background: #e0e0e0; border-radius: 4px; margin: 0 15px; overflow: hidden; }
.step-comparison-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* ==========================================================================
   Visualizations (Funnel, ROI, Time, Session, Success)
   ========================================================================== */
.retention-curve-visualization, .roi-visualization, .rate-visualization, .time-visualization, 
.trial-funnel-visualization, .funnel-visualization, .session-visualization {
    display: flex; flex-direction: column; align-items: center; margin: 30px 0; padding: 20px; background: #f9f9f9; border-radius: 8px;
}

.retention-point, .time-visual-step, .trial-visual-phase, .session-visual-goal, .funnel-segment {
    width: 90%; padding: 15px; margin: 5px 0; text-align: center; border-radius: 4px; position: relative; border: 2px solid #e0e0e0; transition: all 0.3s ease;
}
.funnel-segment { width: 80%; }
.retention-point:hover, .time-visual-step:hover, .trial-visual-phase:hover, .session-visual-goal:hover, .funnel-segment:hover { 
    transform: scale(1.02); box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
}

/* Arrows and connections between visual steps */
.time-visual-step:after { content: '→'; position: absolute; right: -15px; top: 50%; transform: translateY(-50%); color: #2196F3; font-weight: bold; }
.trial-visual-phase:after { content: '↓'; position: absolute; left: 50%; transform: translateX(-50%); bottom: -20px; font-size: 20px; color: #d4af37; }
.session-visual-goal:after { content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: -12px; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 10px solid #e0e0e0; }
.time-visual-step:last-child:after, .trial-visual-phase:last-child:after, .session-visual-goal:last-child:after { display: none; }

.roi-visual-bar, .rate-visual-bar {
    width: 90%; height: 40px; margin: 5px 0; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-radius: 4px; position: relative; border: 2px solid #e0e0e0; transition: all 0.3s ease; overflow: hidden;
}
.roi-visual-bar:hover { transform: scale(1.02); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.roi-bar-fill { position: absolute; left: 0; top: 0; height: 100%; z-index: 1; opacity: 0.3; }
.rate-visual-fill { height: 100%; background: linear-gradient(90deg, #d4af37, #c19d2e); transition: width 0.5s ease; position: absolute; left: 0; top: 0; }
.roi-bar-content { position: relative; z-index: 2; display: flex; justify-content: space-between; width: 100%; }
.roi-tier-indicator { font-size: 24px; font-weight: bold; margin-right: 10px; }
.rate-visual-label { position: absolute; top: 50%; left: 10px; transform: translateY(-50%); color: white; font-weight: bold; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); z-index: 2; }

.rate-indicator { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.indicator-dot { width: 12px; height: 12px; border-radius: 50%; }
.indicator-text { font-size: 12px; color: #666; }
.rate-classification { text-align: center; margin-top: 10px; font-size: 14px; font-weight: 600; }

.success-level-indicator { display: flex; flex-direction: column; justify-content: center; align-items: center; margin: 20px 0; padding: 15px; background: #f9f9f9; border-radius: 8px; }
.success-meter { width: 100%; height: 30px; border-radius: 15px; position: relative; overflow: hidden; background: linear-gradient(90deg, #f44336 0%, #FF9800 50%, #4CAF50 100%); }
.success-level { position: absolute; top: 0; left: 0; height: 100%; background: rgba(255, 255, 255, 0.3); width: 0%; transition: width 1s ease; }
.meter-labels { display: flex; justify-content: space-between; width: 100%; margin-top: 10px; font-size: 12px; color: #666; }

/* ==========================================================================
   Charts & Tables
   ========================================================================== */
.chart-container, .comparison-table { margin-bottom: 40px; position: relative; width: 100%; }
.chart-title {
    font-size: 18px; margin-bottom: 20px; color: #333; font-weight: 600;
    padding-bottom: 10px; border-bottom: 1px solid #e0dcd0;
}
.chart-wrapper { width: 100%; height: 400px; position: relative; }
.comparison-table { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #e0dcd0; }
th { font-weight: 600; color: #444; background-color: rgba(76, 175, 80, 0.05); }
tr:hover { background-color: rgba(76, 175, 80, 0.03); }

/* ==========================================================================
   Editorial & Info Blocks
   ========================================================================== */
.explanation-section { margin-bottom: 40px; }
.explanation-title {
    font-size: 18px; margin-bottom: 15px; color: #333; font-weight: 600;
    padding-bottom: 10px; border-bottom: 1px solid #e0dcd0;
}
.explanation-content { font-size: 15px; line-height: 1.7; }
.formula {
    background-color: rgba(76, 175, 80, 0.05); padding: 15px; border-radius: 4px;
    margin: 15px 0; font-family: 'Courier New', monospace; font-size: 13px;
    border-left: 3px solid #4CAF50;
}
.data-sources { margin-top: 25px; padding-top: 15px; border-top: 1px solid #e0dcd0; }
.data-sources h4 { margin-bottom: 10px; color: #444; }
.data-sources ul { padding-left: 20px; font-size: 14px; }
.data-sources li { margin-bottom: 8px; line-height: 1.5; }
.disclaimer {
    font-size: 13px; color: #777; line-height: 1.6; padding-top: 20px;
    border-top: 1px solid #e0dcd0; margin-top: 40px;
}

.revenue-explanation, .time-explanation { background-color: rgba(33, 150, 243, 0.05); padding: 15px; border-radius: 4px; margin-top: 15px; font-size: 11px; line-height: 1.5; border-left: 3px solid #FF9800; }
.time-explanation { background-color: rgba(76, 175, 80, 0.05); border-left: 3px solid #4CAF50; }

.seo-explanation {
    background-color: rgba(249, 247, 242, 0.8); padding: 25px; border-radius: 4px;
    margin-bottom: 40px; border-left: 4px solid #4CAF50; font-size: 14px;
}
.seo-explanation h3 { color: #333; margin-bottom: 15px; font-size: 20px; }
.seo-explanation p { margin-bottom: 15px; line-height: 1.7; }
.seo-explanation ul { padding-left: 20px; margin-bottom: 15px; }
.seo-explanation li { margin-bottom: 8px; line-height: 1.5; }

.metric-highlight {
    background-color: rgba(76, 175, 80, 0.1); padding: 20px; border-radius: 4px;
    margin: 20px 0; border-left: 4px solid #2e7d32;
}

.benchmark-comparison {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px; margin: 25px 0;
}
.benchmark-card {
    background: white; padding: 20px; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.benchmark-card h5 { color: #4CAF50; margin-bottom: 10px; font-size: 16px; }

.retention-strategy-card {
    background: white; padding: 15px; border-radius: 4px; margin-bottom: 15px;
    border-left: 3px solid #4CAF50; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.strategy-title { font-weight: 600; color: #2e7d32; margin-bottom: 8px; }
.strategy-impact { font-size: 12px; color: #666; }

/* ==========================================================================
   Calculator Theme Overrides (For Gold-Themed Calcs)
   ========================================================================== */
input[type="number"]:focus, select:focus, input[type="text"]:focus { outline: 2px solid #d4af37; }
.btn { background-color: #d4af37; }
.btn:hover { background-color: #c19d2e; }
.result-value { color: #d4af37; background-color: rgba(212, 175, 55, 0.05); border: 2px solid rgba(212, 175, 55, 0.2); }
.formula { border-left: 3px solid #d4af37; background-color: rgba(212, 175, 55, 0.05); }
.seo-explanation { border-left: 4px solid #d4af37; }
.metric-highlight { background-color: rgba(212, 175, 55, 0.1); }
.benchmark-card h5 { color: #d4af37; }
th { background-color: rgba(212, 175, 55, 0.05); }
tr:hover { background-color: rgba(212, 175, 55, 0.03); }
.calculation-summary { background-color: rgba(212, 175, 55, 0.05); padding: 15px; border-radius: 4px; margin-top: 20px; font-size: 14px; line-height: 1.6; }

/* ==========================================================================
   Responsiveness
   ========================================================================== */
@media (max-width: 768px) {
    .calculator-container { flex-direction: column; gap: 20px; }
    .chart-wrapper { height: 350px; padding: 0; }
    .export-controls { width: 100%; }
    .export-btn { flex: 1; min-width: 120px; }
    .result-value { font-size: 28px; }
    
    .benchmark-comparison, .stage-fields, .lifetime-metrics, .acquisition-metrics, 
    .scenario-fields, .strategy-grid, .definition-options, .value-metrics, 
    .step-fields, .phase-fields, .trial-metrics-grid, .ltv-metrics, .goal-fields { 
        grid-template-columns: 1fr; 
    }
    
    .impact-grid, .roi-grid, .cohort-metrics, .cost-grid, .sensitivity-grid, 
    .roi-insights-grid, .timeline-metrics, .conversion-metrics, .dropoff-metrics, 
    .efficiency-metrics, .retention-metrics, .monetization-metrics { 
        grid-template-columns: repeat(2, 1fr); 
    }
}

@media (max-width: 480px) {
    .chart-wrapper { height: 300px; }
    .result-value { font-size: 24px; }
    .btn { padding: 12px 20px; }
    
    .impact-grid, .roi-grid, .cohort-metrics, .cost-grid, .sensitivity-grid, 
    .roi-insights-grid, .timeline-metrics, .conversion-metrics, .dropoff-metrics, 
    .efficiency-metrics, .retention-metrics, .monetization-metrics { 
        grid-template-columns: 1fr; 
    }
}