/**
 * Calculateur LTV - Styles Mobile-First
 * Design conforme à la charte Vendoprone
 */

/* Variables CSS - Couleurs Vendoprone */
:root {
    --color-orange: #F07E3D;
    --color-violet: #8E387F;
    --color-black: #1a1a1a;
    --color-white: #ffffff;
    --color-gray-light: #f5f5f5;
    --color-gray-medium: #e0e0e0;
    --color-gray-dark: #666666;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f7f5f9;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: var(--color-black);
    line-height: 1.6;
}

/* Container principal - Mobile First */
.simulator-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    min-height: 100vh;
}

/* Phases */
.phase {
    display: none;
    animation: fadeIn 0.4s ease-in;
}

.phase.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Phase I - Fond blanc pur (comme simulateur ROI) */
#phase-inputs {
    background: var(--color-white);
    padding: 32px 20px;
    min-height: 100vh;
    color: var(--color-black);
}

/* En-tête de phase */
.phase-header {
    text-align: center;
    margin-bottom: 32px;
}

.phase-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-violet);
    line-height: 1.3;
    margin-bottom: 8px;
}

#phase-inputs .phase-header h1 {
    color: var(--color-violet);
}

.phase-header .subtitle {
    font-size: 14px;
    color: var(--color-gray-dark);
    margin-top: 8px;
}

/* Formulaire */
.ltv-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#phase-inputs .ltv-form {
    background: transparent;
    border-radius: 0;
    padding: 0;
}

/* Groupes d'inputs - Style simulateur ROI (fond blanc pur) */
.input-group {
    background: var(--color-white);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.12);
    margin-bottom: 0;
    box-shadow: none;
}

#phase-inputs .input-group {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    margin-bottom: 12px;
}

.label-text {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--color-violet);
    font-size: 14px;
    line-height: 1.4;
}

/* Tooltip Icon */
.tooltip-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-violet);
    color: var(--color-white);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-weight: normal;
    line-height: 1;
}

/* Inputs texte */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    font-size: 16px;
    transition: var(--transition);
    background: var(--color-white);
    color: var(--color-black);
    -webkit-appearance: none;
    appearance: none;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--color-orange);
    box-shadow: 0 0 0 3px rgba(240, 126, 61, 0.1);
}

.input-wrapper input::placeholder {
    color: var(--color-gray-dark);
    opacity: 0.6;
}

.input-wrapper .currency-symbol {
    position: absolute;
    right: 16px;
    font-weight: 600;
    color: var(--color-violet);
    pointer-events: none;
}

/* Select de devise */
.currency-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--color-gray-medium);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
    background: var(--color-white);
    color: var(--color-black);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238E387F' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    padding-right: 40px;
}

.currency-select:focus {
    outline: none;
    border-color: var(--color-orange);
    box-shadow: 0 0 0 3px rgba(240, 126, 61, 0.1);
}

/* Sliders - Orange */
.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--color-gray-light);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-orange);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 3px solid var(--color-white);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--color-orange);
    cursor: pointer;
    border: 3px solid var(--color-white);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.slider-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-orange);
    min-width: 60px;
    text-align: right;
}

/* Bouton principal - Orange */
.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: var(--color-orange);
    color: var(--color-white);
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 12px 24px rgba(240, 126, 61, 0.35);
    margin-top: 8px;
}

.btn-primary:hover {
    background: #e06d2d;
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(240, 126, 61, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
}

.gating-section .btn-primary {
    margin-top: 24px;
    box-shadow: 0 12px 24px rgba(240, 126, 61, 0.4);
}

/* Phase II - Aperçu des résultats - FOND BLANC */
#phase-preview {
    background: var(--color-white);
    padding: 32px 20px;
    min-height: 100vh;
    color: var(--color-black);
}

.preview-main {
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: 28px 20px;
    color: var(--color-black);
}

.preview-header {
    text-align: center;
    margin-bottom: 24px;
}

.preview-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-violet);
    margin: 0;
}

/* Hero - Gain Potentiel en ORANGE VIF */
.preview-hero {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--color-gray-light);
}

.preview-hero-label {
    font-size: 14px;
    color: var(--color-violet);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    font-weight: 600;
}

.preview-hero-value {
    font-size: 48px;
    font-weight: 700;
    color: var(--color-orange);
    line-height: 1.2;
    margin-bottom: 8px;
}

.preview-hero-subtitle {
    font-size: 14px;
    color: var(--color-gray-dark);
    margin-top: 8px;
}

/* Donut Chart Preview */
.preview-chart-container {
    display: flex;
    justify-content: center;
    margin: 32px 0;
}

.preview-chart {
    position: relative;
    width: 200px;
    height: 200px;
}

.preview-chart-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--color-violet) calc(var(--preview-ratio, 0.5) * 1turn),
        var(--color-orange) 0deg
    );
    display: grid;
    place-items: center;
    padding: 16px;
}

.preview-chart-ring::after {
    content: "";
    width: 100%;
    height: 100%;
    background: var(--color-white);
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preview-chart-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
}

.preview-chart-label {
    font-size: 12px;
    color: var(--color-violet);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    font-weight: 600;
}

.preview-chart-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-orange);
    line-height: 1.2;
}

/* Métriques preview */
.preview-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.preview-metric {
    background: var(--color-gray-light);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.preview-metric-label {
    font-size: 12px;
    color: var(--color-violet);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    font-weight: 600;
}

.preview-metric-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-black);
}

.preview-metric-value.orange {
    color: var(--color-orange);
}

/* Phase III - Gating et Rapport */
#phase-report {
    background: #f7f5f9;
    padding: 20px;
    min-height: 100vh;
    color: var(--color-black);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gating-section {
    width: 100%;
    max-width: 100%;
    background: var(--color-white);
    padding: 28px 20px;
    border-radius: var(--border-radius);
    margin: 0 auto;
    color: var(--color-black);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.gating-section .phase-header {
    text-align: center;
    margin-bottom: 28px;
}

.gating-section .phase-header h1 {
    color: var(--color-violet);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.3;
}

.gating-section .phase-header .subtitle {
    color: var(--color-gray-dark);
    font-size: 14px;
    margin-top: 8px;
    line-height: 1.5;
}

.gating-section .ltv-form {
    gap: 20px;
    max-width: 100%;
}

.gating-section .input-group {
    background: var(--color-white);
    border: 1px solid rgba(0, 0, 0, 0.12);
    margin-bottom: 0;
    box-shadow: none;
}

.gating-section .input-group:first-of-type {
    margin-top: 0;
}

.gating-section .label-text {
    color: var(--color-violet);
    font-weight: 600;
}

.gating-section .input-wrapper input {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: var(--color-white);
}

.gating-section .input-wrapper input:focus {
    border-color: var(--color-orange);
    box-shadow: 0 0 0 3px rgba(240, 126, 61, 0.1);
}

.gating-section .btn-primary {
    margin-top: 8px;
}

.report-section {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* Rapport principal - Fond blanc */
.report-main {
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: 28px 20px;
    color: var(--color-black);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--color-gray-light);
}

.report-header {
    text-align: center;
    margin-bottom: 24px;
}

.report-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-violet);
    margin: 0;
}

/* Hero - Gain Potentiel (Point focal) */
.report-hero {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--color-gray-light);
}

.report-hero-label {
    font-size: 14px;
    color: var(--color-violet);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    font-weight: 600;
}

.report-hero-value {
    font-size: 56px;
    font-weight: 700;
    color: var(--color-orange);
    line-height: 1.2;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(240, 126, 61, 0.2);
}

.report-hero-subtitle {
    font-size: 14px;
    color: var(--color-gray-dark);
    margin-top: 8px;
}

/* Donut Chart */
.ltv-chart-container {
    display: flex;
    justify-content: center;
    margin: 32px 0;
}

.ltv-chart {
    position: relative;
    width: 200px;
    height: 200px;
}

.ltv-chart-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--color-violet) calc(var(--ltv-ratio, 0.5) * 1turn),
        var(--color-orange) 0deg
    );
    display: grid;
    place-items: center;
    padding: 16px;
}

.ltv-chart-ring::after {
    content: "";
    width: 100%;
    height: 100%;
    background: var(--color-white);
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ltv-chart-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
}

.ltv-chart-label {
    font-size: 12px;
    color: var(--color-violet);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    font-weight: 600;
}

.ltv-chart-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-orange);
    line-height: 1.2;
}

/* Grille de métriques */
.report-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 32px 0;
}

.report-metric-card {
    background: var(--color-white);
    border: 2px solid var(--color-gray-light);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.report-metric-label {
    font-size: 11px;
    color: var(--color-violet);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.report-metric-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-black);
    line-height: 1.2;
}

.report-metric-value.orange {
    color: var(--color-orange);
}

.report-metric-subtitle {
    font-size: 11px;
    color: var(--color-gray-dark);
    margin-top: 4px;
}

/* Bouton Audit */
.btn-audit {
    margin-top: 24px;
    font-size: 16px;
    padding: 16px 24px;
}

/* Desktop adjustments */
@media (min-width: 768px) {
    .preview-hero-value {
        font-size: 64px;
    }
    
    .preview-chart {
        width: 220px;
        height: 220px;
    }
    
    .preview-chart-value {
        font-size: 24px;
    }
    
    .report-hero-value {
        font-size: 64px;
    }
    
    .ltv-chart {
        width: 220px;
        height: 220px;
    }
    
    .ltv-chart-value {
        font-size: 24px;
    }
    
    .report-metric-value {
        font-size: 22px;
    }
}

/* Overlay pour le tooltip */
.tooltip-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tooltip-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* Tooltip mobile */
.mobile-tooltip {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -100%;
    background: var(--color-white);
    color: var(--color-black);
    padding: 20px;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.3);
    transition: bottom 0.3s ease;
    z-index: 10000;
    max-width: 100%;
    touch-action: none;
}

.mobile-tooltip.visible {
    bottom: 0;
}

.tooltip-content {
    position: relative;
    padding-right: 30px;
}

.tooltip-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-violet);
    color: var(--color-white);
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    line-height: 1;
    padding: 0;
    z-index: 1;
}

.tooltip-close:hover {
    background: var(--color-orange);
    transform: scale(1.1);
}

.tooltip-close:active {
    transform: scale(0.95);
}

#tooltip-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--color-black);
    margin: 0;
}

/* Desktop - Centrer avec largeur max */
@media (min-width: 768px) {
    body {
        padding: 20px;
        background: #f7f5f9;
    }
    
    .simulator-container {
        max-width: 420px;
        margin: 0 auto;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
        background: var(--color-white);
    }
    
    #phase-inputs {
        border-radius: 16px 16px 0 0;
    }
    
    #phase-report {
        border-radius: 0 0 16px 16px;
        padding: 32px 28px;
    }
    
    .gating-section {
        border-radius: 16px;
        margin: 0 auto;
        max-width: 100%;
        padding: 32px 28px;
    }
    
    .gating-section .phase-header h1 {
        font-size: 24px;
    }

    .phase-header h1 {
        font-size: 28px;
    }

    .result-value {
        font-size: 40px;
    }

    .report-value {
        font-size: 42px;
    }

    .report-value.large {
        font-size: 56px;
    }

    .chart-wrapper {
        height: 350px;
    }

    .mobile-tooltip {
        max-width: 400px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 18px;
    }
}

@media (min-width: 1024px) {
    .simulator-container {
        max-width: 480px;
    }
}