
:root {
    --color-primary: #C6337A;
    --color-primary-light: #F48FB1;
    --color-bg-page: #FBF6F7;
    --color-bg-card: #FFFFFF;
    --color-border: #F0E0E6;
    --color-text-main: #3f353d;
    --color-text-muted: #9B7A85;
    color: #fdf1f5;
}

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

body{
    padding: 30px;
    background-color: var(--color-bg-page)
}

header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

header img{
    border-radius: 50%;
    height: 50px;
    width: 50px;
    object-fit: cover;

}

header h1{
    font-family: 'DM Serif Display', serif;;
    color: rgb(68, 4, 20) ;
    font-size: 1.8rem;
    text-align: center;

    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

header nav{
    /*min-width: 200px;*/
    display: flex;
    justify-content: flex-end;
    flex: 1;
}
header ul{
    list-style-type: none;
    display: flex;
    justify-content: space-between;
    padding: 0;
    margin: 0;
    gap: 15px;
    font-family: 'DM Serif Display', serif;
    color: var(--color-primary);

}

header li {
    cursor: pointer;
}

header li a{
    text-decoration: none;
    color: inherit;
}

header li:hover{
    color: var(--color-text-muted);
}

.summary{
    display: flex;
    justify-content: space-between;
    height: 150px;
    margin-bottom: 20px;
    gap: 20px;
    align-items: stretch;

}

.budget-container, .expense-container, .balance-container{
    /*background-color: aliceblue;*/
    background-color: var(--color-bg-card);
    border:  1px solid var(--color-border);
    /*width: 480px;*/
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    font-family: 'DM Serif Display', serif;
    color: var(--color-text-main);
    border-radius: 1rem;
    justify-content: space-between;
    flex: 1;
}

.before-jauge {
    /*background-color: aliceblue;*/
    background-color: var(--color-bg-card);
    display: flex;
    justify-content: space-between;
    align-items: flex-start ;

}

.before-jauge button{
    font-family: 'DM Serif Display', serif;
    color: #3f353d;
    border: 0;
    /*background-color: aliceblue;*/
    background-color: var(--color-bg-card);
    font-size: medium;
    cursor: pointer;
}

.before-jauge button:hover{
    color: #C6337A;
}


.budget-left h3, .budget-left .budget, .budget-left .jauge,
.expense-container h3, .expense-container div, .expense-container p,
.balance-container h3, .balance-container div{
    background-color: var(--color-bg-card)
}

.jauge-bg{
    background: var(--color-bg-page) ;
    border-radius: 999px;
    height: 15px;
    width: 100%;
}

.jauge-fill{
    background: linear-gradient(90deg, #C6337A, aliceblue);
    border-radius: 999px;
    height: 100%;
    width: 50%;
}

.budget-left .budget, .expense-container .expense, .balance-container .balance{
    font-size: 50px;
    margin-top: auto;
}


.add-expense{
    background-color: var(--color-bg-card);
    border:  1px solid var(--color-border);
    border-radius: 1rem;
    padding: 20px;
    font-family: 'DM Serif Display', serif;
    color: var(--color-text-main);
    display: flex;
    flex-direction: column;
    gap:5px;
    margin-bottom: 20px;

}

.add-expense h2{
    /*background-color: aliceblue;*/
    font-size: 25px;
}

.add-expense form{
    display: flex;
    justify-content: space-between;
    gap: 10px;

}

.add-expense input, .add-expense select, .add-expense button{
    width:20% ;
    height: auto;
}

.add-expense input, .add-expense select{
    background-color: var(--color-bg-page);
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 5px;
    text-align: center;
    color: var(--color-text-muted) ;
    font-family: 'DM Serif Display', serif;
}

.add-expense input:focus, .add-expense select:focus{
    outline: none;
    border-color: var(--color-primary) ;
}

.add-expense button{
    background-color:var(--color-primary) ;
    border: none;
    border-radius: 1rem;
    padding: 8px 5px;
    text-align: center;
    font-family: 'DM Serif Display', serif;
    color: var(--color-bg-page);
    font-size: 15px;
    cursor: pointer;
}

.add-expense button:hover{
    background-color: var(--color-text-muted)
}


.transactions{
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 20px;
    font-family: 'DM Serif Display', serif;
    color: var(--color-text-main);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap:5px;
}

.transactions h2{
    font-size: 25px;
}

.transactions-header{
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#transaction-total{
    background-color: var(--color-bg-page);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    width: 30px;
    height: 30px;
    text-align: center;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;

}

.transactions-body{
    display: flex;
    justify-content: space-between;
    gap: 50px;
    align-items: center;

}

.category-filter{
    display: flex;
    flex-wrap: wrap;
    row-gap: 10px;
    column-gap: 10px;

}

.category-class{
    display: flex;
    gap: 5px;
    padding: 5px 10px;
    align-items: baseline;
    border-radius: 2rem;
    color: var(--color-text-main);
    border:  1px solid var(--color-border);
    cursor: pointer;
}

.category-class:hover{
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/*Style quand un filtre est actif - utilisé par JS */
.category-class.active{
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);

}

.category-class.active .category-total{
    color: rgb(255, 255, 255, 0.7);
}

.category-total{
    color: var(--color-text-muted);
    font-size: 10px;

}

.delete-all{
    font-family: 'DM Serif Display', serif;
    color: var(--color-text-main);
    background-color: transparent;
    border: 0;
    font-size: medium;
    border:  1px solid var(--color-primary);
    padding: 5px 12px;
    border-radius: 2rem;
    cursor: pointer;
    white-space: nowrap;
}

.delete-all:hover{
    color: var(--color-primary)
}

.transactions ul{
    list-style-type: none;
    padding: 0;
    margin: 0;
}

footer{
    font-family: 'DM Serif Display', serif;
    text-align: center;
    color: var(--color-text-main)

}

.expense-js{
    display: flex;
    border:  1px solid var(--color-border);
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 1rem;

}

.expense-category-js{
    font-size: 13px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.expense-amount-js {
    font-weight: 500;
    color: var(--color-primary);
}

.expense-date-js {
    font-size: 13px;
    color: var(--color-text-muted);
}

.expense-delete-js{
    background: none;
    border: 0;
    font-size: 16px;
    cursor: pointer;


}

.expense-delete-js:hover{
    color: var(--color-primary);
}

.overlay{
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:  rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.modale{

    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-bg-card);
    border-radius: 1rem;
    padding: 20px;
    width: 300px;
    z-index: 200;
    color: var(--color-text-main);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mode{
    display: flex;
    align-items: center;
    gap: 20px;
}

.modale-header, .language, .devise{
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modale-header h3{
    font-size: 25px;
}
.mode p, .language p, .devise p{
    font-size: 18px;
}

.close-modale{
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
}

.language button, .devise button{
    background: none;
    padding: 8px;
    border: 0.5px solid var(--color-text-muted);
    border-radius: 1rem;
    cursor: pointer;
}

.language button:hover, .devise button:hover{
    color:#C6337A;
}

.language button.active, .devise button.active{
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);

}

.mode input{
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
    height: 30px;
    width: 75px;
    background-color: #FFFFFF;
    border-radius: 5rem;
    transition: background-color .2s ;
    border: 1px solid var(--color-text-main);


}

.mode input::after{
    content: '';
    position: absolute;
    top: 50%;
    left: 20%;
    transform: translate(-50%,-50%);
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background-color: black;
    transition: left .2s;
}

.mode input:checked{
    background: rgb(3, 153, 240);
}

.mode input:checked::after{
    left: 80%;
}

.dark {
    --color-bg-page: #1a1a1a;
    --color-bg-card: #2d2d2d;
    --color-text-main: #ffffff;
    --color-border: #444444;
    --color-text-muted: #aaaaaa;
}





/*Responsive*/
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    header h1 {
        position: static; /* annule le position: absolute */
        transform: none;  /* annule le translateX(-50%) */
        left: auto;
    }

    .header-logo {
        flex: none;
    }

    header nav {
        flex: none;
        justify-content: center;
    }
}


@media (max-width: 768px) {
    .summary {
        flex-direction: column;
        height: auto;
    }

    .budget-container,
    .expense-container,
    .balance-container {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .add-expense form {
        flex-direction: column;
    }

    .add-expense input,
    .add-expense select,
    .add-expense button {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .transactions-body {
        flex-direction: column;
        gap: 15px;
    }

    .delete-all {
        width: 100%;
        text-align: center;
    }
}
