/* Variables pour la cohérence des couleurs et des valeurs */
:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --success-color: #4CAF50;
    --error-color: #DC3545;
    --gray-light: #f5f5f5;
    --gray-medium: #e0e0e0;
    --gray-dark: #757575;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --radius: 8px;

    --chart-color-1: #2196F3;
    --chart-color-2: #4CAF50;
    --chart-color-3: #FF9800;
    --chart-color-4: #9C27B0;
    --chart-color-5: #F44336;
}

/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    background-color: #f8f9fa;
    color: #333;
}

/* Navigation */
nav {
    background-color: white;
    padding: 1rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: flex-start;
    max-width: 1200px;
    margin: 0 auto;
}

nav button{
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: #fff;
    font-weight: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    appearance: none;
    -webkit-appearance: none;
}

nav a{
    text-decoration: none;
    color: inherit;
}
nav a:visited{
    color: inherit;
}

nav li {
    color: var(--primary-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: background-color 0.2s;
}

nav li:hover {
    background-color: var(--gray-light);
    cursor: pointer;
}

/* Layout principal */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Conteneur de formulaire */
.form-container {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

h1 {
    color: #2c3e50;
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

/* Styles de formulaire */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--gray-dark);
    font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-medium);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.form-input-error {
    border-color: var(--error-color);
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: block;
}

/* Boutons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

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

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

.btn:active {
    transform: translateY(1px);
}

/* Alertes */
.alert {
    margin-bottom: 2rem;
    padding: 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-success {
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    color: var(--success-color);
}

.alert-danger {
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    color: var(--error-color);
}

.alert-icon {
    flex-shrink: 0;
}

.alert-icon-svg {
    width: 24px;
    height: 24px;
}

.alert-message {
    font-weight: 500;
}

/* Container principal de la liste */
.list-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Cartes */
.filters-card,
.stats-grid,
.types-card,
.revenus-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

/* Filtres */
.filters-title {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.filters-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filters-type {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 1rem;
}

.radio-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.radio-input {
    cursor: pointer;
}

.radio-label {
    font-weight: 500;
    cursor: pointer;
}

.period-inputs {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hidden {
    display: none;
}

/* Grille des statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    text-align: center;
}

.stats-card {
    padding: 1.5rem;
    background: var(--gray-light);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stats-label {
    color: var(--gray-dark);
    font-size: 0.9rem;
    font-weight: 500;
}

.stats-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
}

/* Répartition par type */
.types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.type-stat {
    padding: 1rem;
    background: var(--gray-light);
    border-radius: var(--radius);
}

.type-name {
    font-weight: 500;
    display: block;
}

.type-total {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
    display: block;
}

.type-count {
    color: var(--gray-dark);
    font-size: 0.9rem;
}

/* Tableau des revenus */
.table-container {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.revenus-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.revenus-table th {
    background: var(--gray-light);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
}

.revenus-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-medium);
}

.revenus-table .affirmative {
    font-weight: bolder;
    color: var(--primary-color);
}

.date-cell {
    white-space: nowrap;
}

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

.notes-cell {
    color: var(--gray-dark);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nvRevenu{
    background-color: #e9f4fd;
    color: #0D3C61;
    padding: 20px 0;
}
.nvRevenu hr{
    margin: 15px 0;
}
.nvRevenu label{
    display: inline;
    cursor: pointer;

}
.nvRevenu .partLabel{
    display: inline-block;
    width: 45%;
}
.nvRevenu .partCheckbox{
    display: inline-block;
    width: 40%;
    padding-left: 5%;
}


/* État vide */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-dark);
}

/* Bouton secondaire */
.btn-secondary {
    background-color: var(--gray-medium);
    color: var(--gray-dark);
}

.btn-secondary:hover {
    background-color: #d0d0d0;
}


/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    color: var(--gray-dark);
    border-top: 1px solid var(--gray-medium);
}

/* Responsive design */
@media (max-width: 600px) {
    .form-container {
        padding: 1rem;
    }

    .btn {
        width: 100%;
    }

    h1 {
        font-size: 1.5rem;
    }
}
@media (max-width: 768px) {
    main{
        width: 100%;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .types-grid {
        grid-template-columns: 1fr;
    }

    .period-inputs {
        flex-direction: column;
    }

    .filters-type {
        flex-direction: column;
        gap: 1rem;
    }

    .revenus-table {
        font-size: 0.9rem;
    }

    .revenus-table th,
    .revenus-table td {
        padding: 0.75rem;
    }

    .notes-cell {
        max-width: 150px;
    }
    .period-inputs {
        flex-direction: column;
        gap: 1rem;
    }

    .filters-actions {
        flex-direction: column;
    }
    .month-selects {
        flex-direction: column;
        gap: 1rem;
    }
}
@media (max-width: 1200px) {
    main{
        width: 700px;
    }
}

/* Mise à jour des styles des filtres */
.filters-type {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filter-inputs {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--gray-light);
    border-radius: var(--radius);
}

.period-inputs {
    display: flex;
    gap: 1rem;
}

.filters-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}
.month-selects {
    display: flex;
    gap: 1rem;
}

.month-selects .form-group {
    flex: 1;
}

/*
** Parsing
*/
.form-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.import-checkbox {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

#importForm {
    margin-top: 2rem;
}

.type-select {
    min-width: 200px;
    max-width: 300px;
    background-color: #fff;
}
.warning-duplicate {
    background-color: #fff3cd;
}

.danger-duplicate {
    background-color: #f8d7da;
}

.warning-duplicate td, .danger-duplicate td {
    position: relative;
}

.warning-duplicate td:first-child::before {
    content: "⚠️ Doublon possible";
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 0.8rem;
    color: #856404;
}

.danger-duplicate td:first-child::before {
    content: "❌ Doublon probable";
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 0.8rem;
    color: #721c24;
}

/* Ajustement de la largeur des colonnes */
.revenus-table td:nth-child(3) {
    /* Colonne libellé */
    max-width: 400px;
    white-space: normal;
    word-break: break-word;
}

.revenus-table td:nth-child(5) {
    /* Colonne select */
    min-width: 200px;
}

/* Style pour les options du select */
.type-select option {
    padding: 8px;
}

/* Vue type-revenu */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    margin: 20px;
}

.inline-form {
    display: inline-block;
    margin-left: 0.5rem;
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.actions-cell {
    white-space: nowrap;
    text-align: right;
}

.form-section {
    margin-top: 2rem;
    border-top: 1px solid var(--gray-medium);
    padding-top: 2rem;
}

hr{
    margin: 2rem 0;
}


/* Styles pour les rapports et statistiques */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stats-card.highlight {
    background-color: #e3f2fd;
    border-left: 4px solid var(--primary-color);
}

.stats-percentage {
    font-size: 0.9rem;
    color: var(--gray-dark);
    display: block;
    margin-top: 0.25rem;
}

.types-breakdown {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.type-stat {
    background: var(--gray-light);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.type-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.type-name {
    font-weight: 500;
    font-size: 1.1rem;
}

.type-percentage {
    font-weight: 600;
    color: var(--primary-color);
}

.type-bar {
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.type-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
}

.type-info {
    display: flex;
    justify-content: space-between;
}

.type-total {
    font-weight: 600;
    color: var(--primary-color);
}

.type-count {
    color: var(--gray-dark);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .types-grid {
        grid-template-columns: 1fr;
    }
}
