/* styles généraux */
body {
    background: linear-gradient(135deg, #2d5a3d 0%, #3a7355 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    color: #333333;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* STRUCTURE PRINCIPALE */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    padding: 30px;
    box-shadow: 0 20px 40px rgba(45, 90, 61, 0.2);
    display: flex;
    gap: 30px;
    height: auto;
    border-radius: 20px;
    flex-direction: row;
}

.colonne-gauche {
    flex: 0 0 400px;
    display: flex;
    flex-direction: column;
}

.colonne-droite {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* EN-TÊTE */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    color: #033009;
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 1.2em;
}

/* CARTES DE RÉSUMÉ FINANCIER */
.cartes-resume {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

.carte {
    background: linear-gradient(135deg, #f8fff9, #f0f7f2);
    border: 1px solid #d4e8d4;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    flex: 1;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.carte:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.carte h3 {
    color: #5a7d5a;
    font-size: 1em;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.montant {
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

/* Couleurs des montants */
.revenus {
    color: #4caf50;
    text-shadow: 0 2px 4px rgba(39, 174, 96, 0.3);
}

.depenses {
    color: #ff0000;
    text-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

/* FORMULAIRE D'AJOUT */
.formulaire {
    background: linear-gradient(135deg, #f8fff9, #f0f7f2);
    border: 1px solid #d4e8d4;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 40px;
    box-shadow: 0 8px 25px rgba(45, 90, 61, 0.1);
}

.formulaire h2 {
    color: #2d5a3d;
    margin-bottom: 20px;
    text-align: center;
}

form {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

input, button {
    padding: 12px 15px;
    border: 2px solid #ecf0f1;
    border-radius: 10px;
    font-size: 16px;
}

input {
    padding: 12px 15px;
    border: 2px solid #d4e8d4;
    border-radius: 10px;
    font-size: 16px;
    background: #ffffff;
    color: #2d5a3d;
    flex: 1;
    min-width: 200px;
}

input:focus {
    outline: none;
    border-color: #8bc34a;
    background: #f8fff9;
}

button {
    background: linear-gradient(135deg, #8bc34a, #4caf50);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
}

button:hover {
    background: linear-gradient(135deg, #9ccc65, #66bb6a);
    box-shadow: 0 5px 15px rgba(139, 195, 74, 0.3);
}

/* SECTION HISTORIQUE */
.historique {
    background: linear-gradient(135deg, #f8fff9, #f0f7f2);
    border: 1px solid #d4e8d4;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.historique h2 {
    color: #2d5a3d;
    margin-bottom: 20px;
    text-align: center;
}

.transactions-container {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
    min-height: 100px;
    border: 1px solid #ecf0f1;
    border-radius: 10px;
    padding: 10px;
}

.message-vide {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 20px;
}

/* STYLE DES TRANSACTIONS */
.transaction {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 5px solid #ddd;
    transition: transform 0.2s ease;
}

.transaction:hover {
    transform: translateX(5px);
}

.transaction.revenu {
    border-left-color: #27ae60;
    background: linear-gradient(135deg, #f0fff4, #e8f5e8);
}

.transaction.depense {
    border-left-color: #ff0000;
    background: linear-gradient(135deg, #fff0f0, #ffe8e8);
}

.transaction-info {
    flex: 1;
}

.transaction-info strong {
    display: block;
    margin-bottom: 5px;
}

.transaction-date {
    font-size: 0.9em;
    color: #7f8c8d;
}

.transaction-montant {
    font-weight: bold;
    font-size: 1.1em;
}

.transaction-montant.revenu {
    color: #27ae60;
}

.transaction-montant.depense {
    color: #ff0000;
}

.transaction-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-supprimer {
    background: #ff0000;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-supprimer:hover {
    background: #c0392b;
}

/* COLONNES RESPONSIVES */
.colonne-gauche {
    flex: 0 0 60%;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.colonne-droite {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
}

/* GRAPHIQUE */
.graphique-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border: 1px solid #ecf0f1;
}

.graphique-section h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.3em;
}

.graphique-titre {
    text-align: center;
    font-weight: 600;
    font-size: 1.2em;
    margin-bottom: 15px;
}

.graphique-bars {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bar-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bar-label {
    width: 80px;
    font-size: 0.9em;
    color: #7f8c8d;
    font-weight: 500;
}

.bar-background {
    flex: 1;
    height: 25px;
    background: #ecf0f1;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.bar-remplissage {
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s ease;
    position: relative;
}

.revenu-bar {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.depense-bar {
    background: linear-gradient(90deg, #ff0000, #e67e22);
}

.bar-valeur {
    width: 80px;
    text-align: right;
    font-size: 0.9em;
    font-weight: 600;
    color: #2c3e50;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    body {
        padding: 10px;
        display: block;
        min-height: 100vh;
    }
    
    .container {
        flex-direction: column;
        padding: 15px;
        gap: 20px;
        margin: 0;
        max-width: 100%;
        height: auto;
    }
    
    /* Colonnes */
    .colonne-gauche, 
    .colonne-droite {
        flex: 1;
        width: 100%;
        min-height: auto;
    }
    
    /* Header */
    header {
        margin-bottom: 20px;
        padding: 0;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    header p {
        font-size: 1em;
    }
    
    /* Cartes résumé */
    .cartes-resume {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .carte {
        padding: 20px;
    }
    
    .montant {
        font-size: 24px;
    }
    
    /* Formulaire */
    .formulaire {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    form {
        flex-direction: column;
        gap: 12px;
    }
    
    input, button {
        width: 100%;
        min-width: auto;
    }
    
    /* Historique */
    .historique {
        padding: 20px;
        min-height: 300px;
    }
    
    .transactions-container {
        max-height: 300px;
        min-height: 200px;
    }
    
    /* Transactions */
    .transaction {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .transaction-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .transaction-info strong {
        font-size: 0.9em;
    }
    
    .transaction-montant {
        font-size: 1em;
    }
    
    /* GRAPHIQUE */
    .graphique-section {
        display: block !important;
        min-height: 180px;
        margin-bottom: 20px;
    }
    
    .graphique-bars {
        gap: 20px;
    }
    
    .bar-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .bar-label {
        width: 100%;
        text-align: center;
        font-weight: 600;
    }
    
    .bar-valeur {
        width: 100%;
        text-align: center;
        font-size: 1em;
    }
    
    .bar-background {
        width: 100%;
        height: 20px;
    }
}

/* Très petits écrans */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .carte,
    .formulaire,
    .historique {
        padding: 15px;
    }
    
    .montant {
        font-size: 22px;
    }
    
    .graphique-section {
        padding: 15px;
    }
}
