
   :root {
    --buy-color: #10B981; /* Vert pour les achats */
    --sell-color: #EF4444; /* Rouge pour les ventes */
    --buy-bg: rgba(16, 185, 129, 0.2); /* Fond vert plus visible */
    --sell-bg: rgba(239, 68, 68, 0.2); /* Fond rouge plus visible */
    /* ... autres variables inchangées ... */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-header {
    text-align: center;
    margin: 2rem 0 3rem;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1rem;
}

/* Style pour la section résumé en haut */
.summary-top {
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.summary-item {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--light) 0%, #ffffff 100%);
    border-radius: var(--radius);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.summary-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

.summary-icon {
    font-size: 2rem;
    margin-right: 1rem;
    color: var(--primary);
}

.summary-content {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Style pour la section Profit/Perte */
.profit-loss-section {
    margin-bottom: 2rem;
}

.profit-loss-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.profit-loss-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 1.5rem;
}

.profit-loss-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.profit-loss-content {
    padding: 1.5rem;
}

.profit-loss-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--light);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.profit-loss-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray);
}

.profit-loss-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.profit-loss-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.position-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.position-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.position-crypto {
    font-weight: 600;
    color: var(--dark);
}

.position-type {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.position-type.long {
    background-color: var(--buy-bg);
    color: var(--buy-color);
}

.position-type.short {
    background-color: var(--sell-bg);
    color: var(--sell-color);
}

.position-leverage {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    background-color: var(--leverage-open-bg);
    color: var(--leverage-open);
    border-radius: 4px;
}

.position-value {
    font-weight: 600;
}

.position-percent {
    font-size: 0.85rem;
    margin-left: 0.5rem;
    opacity: 0.8;
}

.history-container {
    margin-bottom: 2rem;
}

.card-header {
    background: linear-gradient(135deg, var(--light) 0%, #ffffff 100%);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    -webkit-overflow-scrolling: touch; /* Améliore le défilement sur iOS */
}

.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--dark);
    border-collapse: collapse;
    background: var(--white);
    min-width: 800px; /* Largeur minimale pour éviter les chevauchements */
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid var(--border);
    text-align: left;
}

.table thead th {
    background: linear-gradient(135deg, var(--light) 0%, #ffffff 100%);
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* Largeurs des colonnes - MODIFIÉES */
.table th:nth-child(1), .table td:nth-child(1) { width: 120px; } /* Date */
.table th:nth-child(2), .table td:nth-child(2) { width: 90px; } /* Type */
.table th:nth-child(3), .table td:nth-child(3) { width: 80px; } /* Crypto */
.table th:nth-child(4), .table td:nth-child(4) { width: 120px; } /* Quantité */
.table th:nth-child(5), .table td:nth-child(5) { width: 150px; } /* Valeur (€) */
.table th:nth-child(6), .table td:nth-child(6) { width: 120px; } /* Prix unitaire */
.table th:nth-child(7), .table td:nth-child(7) { width: 100px; } /* Bonus utilisé */
.table th:nth-child(8), .table td:nth-child(8) { width: 100px; } /* Levier */
.table th:nth-child(9), .table td:nth-child(9) { width: 140px; } /* Statut */

/* Style pour les lignes du tableau */
.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(0, 82, 255, 0.03);
}

/* Suppression des couleurs de fond pour les lignes d'achat et de vente */
.table tbody tr.buy-row {
    /* background-color: var(--buy-bg); */
    /* border-left: 4px solid var(--buy-color); */
}

.table tbody tr.sell-row {
    /* background-color: var(--sell-bg); */
    /* border-left: 4px solid var(--sell-color); */
}

/* Les lignes de levier gardent leur style */
.table tbody tr.leverage-open-row {
    background-color: var(--leverage-open-bg);
    border-left: 4px solid var(--leverage-open);
}

.table tbody tr.leverage-close-row {
    background-color: var(--leverage-close-bg);
    border-left: 4px solid var(--leverage-close);
}

.badge {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Styles pour les badges de type de transaction */
.badge-buy {
    background-color: var(--buy-color);
    color: var(--white);
    font-weight: 700; /* Ajout du gras */
}

.badge-sell {
    background-color: var(--sell-color);
    color: var(--white);
    font-weight: 700; /* Ajout du gras */
}

.badge-deposit {
    background-color: var(--primary);
    color: var(--white);
}

.badge-bonus {
    background-color: var(--warning);
    color: var(--white);
}

.badge-pending {
    background-color: var(--warning);
    color: var(--white);
}

.badge-completed {
    background-color: var(--secondary);
    color: var(--white);
}

/* Styles pour les badges de levier */
.badge-leverage-open {
    background-color: var(--leverage-open);
    color: var(--white);
}

.badge-leverage-close {
    background-color: var(--leverage-close);
    color: var(--white);
}

.badge-default {
    background-color: var(--gray);
    color: var(--white);
}

.portfolio-value {
    margin-bottom: 2rem;
}

.portfolio-chart {
    height: 300px;
    margin-bottom: 1.5rem;
}

.positive {
    color: var(--secondary);
}

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

/* Style pour la section explicative du levier */
.leverage-info {
    margin-top: 2rem;
    border-left: 4px solid var(--leverage-open);
}

/* Style pour les alertes */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert.warning {
    background: var(--warning-light);
    color: #92400E;
    border: 1px solid #FDE68A;
}

.alert.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Style pour la note d'administration */
.admin-note {
    margin-top: 2rem;
    border-left: 4px solid var(--danger);
}

.admin-note pre {
    background: var(--light);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.admin-note ol {
    padding-left: 20px;
    margin-top: 10px;
}

.admin-note li {
    margin-bottom: 10px;
}

/* Style pour la section de débogage */
.debug-section {
    margin-top: 2rem;
}

.debug-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.debug-header {
    background: var(--debug-bg);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--debug-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.btn-toggle {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-toggle:hover {
    background: var(--primary-dark);
}

.debug-content {
    padding: 1.5rem;
}

.debug-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.debug-content h4:first-child {
    margin-top: 0;
}

.debug-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.debug-table th,
.debug-table td {
    padding: 0.5rem;
    border: 1px solid var(--debug-border);
    text-align: left;
}

.debug-table th {
    background: var(--light);
    font-weight: 600;
}

/* Media queries améliorées */
@media (max-width: 992px) {
    .table {
        min-width: 700px; /* Largeur minimale réduite pour tablettes */
    }
    
    .table th,
    .table td {
        padding: 0.65rem;
    }
    
    /* Ajustement des largeurs de colonnes pour tablettes */
    .table th:nth-child(1), .table td:nth-child(1) { width: 100px; } /* Date */
    .table th:nth-child(5), .table td:nth-child(5) { width: 130px; } /* Valeur */
    .table th:nth-child(6), .table td:nth-child(6) { width: 110px; } /* Prix unitaire */
}

@media (max-width: 768px) {
    .summary-card {
        grid-template-columns: 1fr;
    }
    
    .profit-loss-details {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 0.8rem;
        min-width: 600px; /* Largeur minimale pour mobile */
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap; /* Empêche le retour à la ligne */
        overflow: hidden; /* Cache le texte qui dépasse */
        text-overflow: ellipsis; /* Ajoute "..." pour le texte coupé */
    }
    
    .badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .debug-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 576px) {
    .page-header h1 {
        font-size: 2rem;
    }
    
    .table {
        font-size: 0.75rem;
        min-width: 500px;
    }
    
    .table th,
    .table td {
        padding: 0.4rem 0.3rem;
    }
    
    /* Masquer certaines colonnes moins importantes sur très
    /* Masquer certaines colonnes moins importantes sur très petits écrans */
    .table th:nth-child(7), .table td:nth-child(7), /* Bonus utilisé */
    .table th:nth-child(8), .table td:nth-child(8) { /* Levier */
        display: none;
    }
