@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: #0891b2;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --ink: #0a2540;
    --ink-soft: #425466;
    --surface: #ffffff;
    --surface-soft: #f6f9fc;
    --border: #e3e8ee;

    --shadow-sm: 0 1px 2px 0 rgb(10 37 64 / 0.04);
    --shadow: 0 1px 3px 0 rgb(10 37 64 / 0.06), 0 1px 2px -1px rgb(10 37 64 / 0.04);
    --shadow-lg: 0 8px 16px -4px rgb(10 37 64 / 0.08), 0 4px 6px -2px rgb(10 37 64 / 0.04);
    --shadow-xl: 0 12px 24px -6px rgb(10 37 64 / 0.10), 0 6px 12px -4px rgb(10 37 64 / 0.05);

    --radius: 0.5rem;
    --radius-lg: 0.75rem;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--surface-soft);
    min-height: 100vh;
    line-height: 1.6;
    color: var(--gray-700);
    font-size: 14px;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 2rem 0;
    margin-bottom: 2rem;
    width: 100%;
}

.header-content {
    max-width: none;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.header p {
    font-size: 1.125rem;
    color: var(--gray-600);
    font-weight: 400;
}

/* Main layout */
.main-container {
    flex: 1;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0 2rem 2rem 2rem;
}

.layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    align-items: start;
    width: 100%;
}

/* Burger menu */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    cursor: pointer;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    z-index: 1000;
    position: relative;
}

.burger-menu:hover {
    background: var(--gray-50);
    box-shadow: var(--shadow-lg);
}

.burger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--gray-700);
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.burger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-menu.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Sidebar */
.sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--ink);
    letter-spacing: -0.01em;
}

.form-section {
    margin-bottom: 1.5rem;
}

.section-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.section-header svg,
.result-title svg,
.reset-button svg {
    flex-shrink: 0;
    color: currentColor;
}

.reset-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group.inline-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.8rem;
    transition: all 0.2s ease;
    background: white;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgb(10 37 64 / 0.1);
}

.form-input:hover {
    border-color: var(--gray-400);
}

.reset-button {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--ink);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 1rem;
    font-family: inherit;
}

.reset-button:hover {
    background: #0f3055;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.reset-button:active {
    transform: translateY(0);
}

/* Content area */
.content-area {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Couleurs cohérentes pour les 3 stratégies (sobre, finance) */
:root {
    --remuneration-color: #00875a;
    --dividendes-color: #b45309;
    --holding-color: #3b3a8c;
}

/* Results grid - compatible avec les deux classes */
.results-grid,
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 0;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.result-header {
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    position: relative;
}

.result-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.remuneration-card .result-header::before {
    background: var(--remuneration-color);
}

.dividendes-card .result-header::before {
    background: var(--dividendes-color);
}

.holding-card .result-header::before {
    background: var(--holding-color);
}

.result-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.result-body {
    padding: 0 1.5rem 1.5rem 1.5rem;
}

/* Métriques - compatible avec les deux formats */
.metric,
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.metric:last-child,
.metric-row:last-child {
    border-bottom: none;
}

.metric span:first-child,
.metric-label {
    color: var(--gray-600);
    font-weight: 400;
}

.metric-value {
    font-weight: 600;
    color: var(--gray-900);
}

.final-amount {
    background: var(--surface-soft);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin: 1rem 0;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    border: 1px solid var(--border);
    letter-spacing: -0.01em;
}

.gain-info {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 1rem;
    font-size: 0.8rem;
    line-height: 1.5;
}

.gain-info div {
    margin-bottom: 0.5rem;
}

.gain-info div:last-child {
    margin-bottom: 0;
}

/* Calculations section - compatible avec les deux classes */
.calculations-section,
.calculations-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.calc-section {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    position: relative;
    min-width: 0; /* Permet au contenu de se comprimer */
}

/* Couleurs cohérentes pour les sections de calcul */
.calc-section:nth-child(1) {
    border-left: 3px solid var(--remuneration-color);
    background: rgb(0 135 90 / 0.04);
}

.calc-section:nth-child(1) h4 {
    color: var(--remuneration-color);
}

.calc-section:nth-child(2) {
    border-left: 3px solid var(--dividendes-color);
    background: rgb(180 83 9 / 0.04);
}

.calc-section:nth-child(2) h4 {
    color: var(--dividendes-color);
}

.calc-section:nth-child(3) {
    border-left: 3px solid var(--holding-color);
    background: rgb(59 58 140 / 0.04);
}

.calc-section:nth-child(3) h4 {
    color: var(--holding-color);
}

.calc-section h4 {
    color: var(--ink);
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.calc-step {
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.calc-step:last-child {
    margin-bottom: 0;
}

.calc-step strong {
    color: var(--gray-900);
    display: block;
    margin-bottom: 0.25rem;
}

.calc-step .value {
    color: var(--primary-color);
    font-weight: 600;
}

/* Chart section */
.chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2rem;
    position: relative;
    height: 550px;
    width: 100%;
}

.chart-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: -0.01em;
}

#patrimoineChart {
    display: block;
    box-sizing: border-box;
    height: 450px;
    width: 100%;
}

/* Overlay pour mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive design complet */
@media (max-width: 1200px) {
    .burger-menu {
        display: flex;
    }
    
    .layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        position: relative;
        width: 100%;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(380px, 90vw);
        height: 100vh;
        max-height: 100vh;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .content-area {
        width: 100%;
    }
    
    /* Garde 3 colonnes sur tablette si possible */
    .results-grid, 
    .comparison-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }
    
    .calc-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 900px) {
    /* Passe en colonne unique seulement sur mobile */
    .results-grid, 
    .comparison-grid,
    .calc-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .result-card {
        min-width: auto;
        width: 100%;
    }
    
    .calc-section {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1.5rem 0;
        margin-bottom: 1.5rem;
    }
    
    .header h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .main-container {
        padding: 0 1rem 1rem 1rem;
        width: 100%;
    }
    
    .sidebar {
        width: 100vw;
        padding: 1.5rem;
    }
    
    .form-group.inline-group {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .calculations-section,
    .calculations-detail,
    .chart-container {
        padding: 1.5rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .chart-container {
        height: 450px;
    }
    
    #patrimoineChart {
        height: 350px;
        width: 100%;
    }
    
    .result-header {
        padding: 1rem;
    }
    
    .result-body {
        padding: 0 1rem 1rem 1rem;
    }
    
    .final-amount {
        font-size: 1.25rem;
        padding: 1rem;
    }
    
    .content-area {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header p {
        font-size: 0.9rem;
        padding: 0 1rem;
    }
    
    .main-container {
        padding: 0 0.75rem 1rem 0.75rem;
    }
    
    .sidebar {
        padding: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .calculations-section,
    .calculations-detail,
    .chart-container {
        padding: 1rem;
        margin: 0;
    }
    
    .calc-section {
        padding: 1rem;
    }
    
    .chart-container {
        height: 400px;
    }
    
    #patrimoineChart {
        height: 300px;
    }
    
    .section-title {
        font-size: 1.25rem;
    }
    
    .result-title {
        font-size: 1rem;
    }
    
    .final-amount {
        font-size: 1.1rem;
    }
    
    .content-area {
        gap: 1rem;
    }
    
    .burger-menu {
        width: 45px;
        height: 45px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card, 
.calculations-section, 
.calculations-detail,
.chart-container {
    animation: fadeIn 0.6s ease-out;
}

/* Utilities */
.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-info {
    color: var(--info-color);
}

/* Améliorations pour la section de calculs existante */
.calc-step {
    position: relative;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.calc-step:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

/* Formules de calcul détaillées */
.calc-formula {
    background: var(--gray-50);
    border-left: 3px solid var(--primary-color);
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--gray-800);
    line-height: 1.3;
}

/* Boutons pour basculer entre vue simple/détaillée */
.calc-mode-toggle {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius);
    padding: 0.25rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.calc-mode-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius) - 0.25rem);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.calc-mode-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.calc-mode-btn:hover:not(.active) {
    color: var(--gray-800);
}

/* Valeurs mises en évidence */
.highlight-value {
    background: rgba(37, 99, 235, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* Animation pour les changements de mode */
.calc-content {
    transition: opacity 0.3s ease;
}

.calc-content.fade-out {
    opacity: 0.5;
}

.baltazr-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin-bottom: 2rem;
}

.baltazr-header .header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.baltazr-header .logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.baltazr-header .logo {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.025em;
}

.baltazr-header .page-title {
    font-size: 1rem;
    color: #6b7280;
    font-weight: 500;
    padding-left: 1rem;
    border-left: 2px solid #e5e7eb;
    margin: 0;
}

.baltazr-header .nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.baltazr-header .nav a {
    text-decoration: none;
    color: #4b5563;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.baltazr-header .nav a:hover {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.05);
}

.baltazr-header .nav a.active {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
}

/* Espacement pour le contenu principal */
.main-container {
    padding-top: 0; /* Enlève le padding-top si il existe */
}

/* Responsive */
@media (max-width: 768px) {
     .baltazr-header {
        margin-bottom: 1rem; /* Moins d'espace sur mobile */
    }

    .baltazr-header .nav {
        display: none;
    }
    
    .baltazr-header .page-title {
        display: none;
    }
    
    .baltazr-header .header-content {
        padding: 1rem;
        justify-content: center;
    }
}