/* ===== VARIABLES CSS - THÈME CLAIR (PAR DÉFAUT) ===== */
:root, [data-theme="light"] {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-tertiary: #adb5bd;
    --border-color: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    
    --color-primary: #3498db;
    --color-primary-hover: #2980b9;
    --color-success: #27ae60;
    --color-danger: #e74c3c;
    --color-warning: #f39c12;
    --color-info: #16a085;
}

/* ===== THÈME SOMBRE ===== */
[data-theme="dark"] {
    --bg-primary: #1a1d23;
    --bg-secondary: #252932;
    --bg-tertiary: #2f3542;
    --text-primary: #f1f3f5;
    --text-secondary: #adb5bd;
    --text-tertiary: #6c757d;
    --border-color: #3d4450;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
}

/* ===== THÈME BLEU ===== */
[data-theme="blue"] {
    --bg-primary: #e3f2fd;
    --bg-secondary: #ffffff;
    --bg-tertiary: #bbdefb;
    --text-primary: #0d47a1;
    --text-secondary: #1565c0;
    --text-tertiary: #64b5f6;
    --border-color: #90caf9;
    --color-primary: #2196f3;
    --color-primary-hover: #1976d2;
}

/* ===== THÈME VERT ===== */
[data-theme="green"] {
    --bg-primary: #e8f5e9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #c8e6c9;
    --text-primary: #1b5e20;
    --text-secondary: #2e7d32;
    --text-tertiary: #66bb6a;
    --border-color: #81c784;
    --color-primary: #4caf50;
    --color-primary-hover: #388e3c;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== PAGE DE CONNEXION ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-info) 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 3rem;
    color: var(--color-primary);
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form {
    margin-top: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group label i {
    margin-right: 8px;
    color: var(--color-primary);
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* ===== ALERTES ===== */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert i {
    font-size: 1.2rem;
}

.alert-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.alert-info {
    background: #eef;
    color: #33c;
    border: 1px solid #ccf;
}

/* ===== BOUTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

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

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

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

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

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
}

.header-logo i {
    font-size: 1.5rem;
}

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

.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-tertiary);
    transition: background 0.3s ease;
}

.user-menu-toggle:hover {
    background: var(--border-color);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-menu {
    position: relative;
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 200px;
    z-index: 1000;
    display: none;
}

.user-menu-dropdown.active {
    display: block !important;
}

.user-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s ease;
}

.user-menu-dropdown a:hover {
    background: var(--bg-tertiary);
}

.user-menu-dropdown a:first-child {
    border-radius: 8px 8px 0 0;
}

.user-menu-dropdown a:last-child {
    border-radius: 0 0 8px 8px;
}

.user-menu-dropdown i {
    width: 20px;
    text-align: center;
}
/* ===== CONTAINER & LAYOUT ===== */
.container {
    display: flex;
    min-height: calc(100vh - 70px);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    transition: transform 0.2s ease-out;
    top: 60px;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--bg-tertiary);
    color: var(--color-primary);
    border-left: 3px solid var(--color-primary);
}

.sidebar-nav a i {
    font-size: 1.1rem;
    width: 20px;
}

/* ===== SIDEBAR NAV FIXE ET SCROLLABLE SUR MOBILE ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 60px; /* hauteur du header */
        left: 0;
        height: calc(100vh - 60px);
        width: 200px;
        z-index: 999;
        background: var(--bg-secondary);
        border-right: 1px solid var(--border-color);
        padding: 20px 0;
    }

    .sidebar-nav {
        max-height: calc(100vh - 80px); /* espace pour padding + header */
        overflow-y: auto;
        padding: 0 10px;
    }

    .sidebar-nav li {
        margin-bottom: 5px;
    }

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 15px;
        color: var(--text-secondary);
        text-decoration: none;
        transition: all 0.3s ease;
    }

    .sidebar-nav a:hover,
    .sidebar-nav a.active {
        background: var(--bg-tertiary);
        color: var(--color-primary);
        border-left: 3px solid var(--color-primary);
    }
}


/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

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

.page-header h1 {
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: flex;
    flex-wrap: nowrap; /* empêche le retour à la ligne */
    gap: 20px;
    margin-bottom: 30px;
    overflow-x: auto; /* si elles débordent, on peut scroller horizontalement */
}

.stat-card {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 10px var(--shadow);
    transition: transform 0.3s ease;
    min-width: 250px;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-revenus .stat-icon {
    background: rgba(39, 174, 96, 0.1);
    color: var(--color-success);
}

.stat-depenses .stat-icon {
    background: rgba(231, 76, 60, 0.1);
    color: var(--color-danger);
}

.stat-solde .stat-icon {
    background: rgba(52, 152, 219, 0.1);
    color: var(--color-primary);
}

.stat-charges .stat-icon {
    background: rgba(243, 156, 18, 0.1);
    color: var(--color-warning);
}

.stat-futur .stat-icon{
    background: rgba(155, 89, 182, 0.1); /* violet clair */
    color: #9b59b6; /* violet */
}

.stat-upcoming .stat-icon{
    background: rgba(52, 73, 94, 0.1); /* bleu-gris clair */
    color: #34495e; /* bleu-gris foncé */
}

.stat-content h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-value {
    font-size: auto;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.stat-solde.positive .stat-value {
    color: var(--color-success);
}

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

/* ===== CHARTS GRID ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow);
}

.chart-card h3 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== CONTENT GRID ===== */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
}

.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== TRANSACTIONS LIST ===== */
.transactions-list {
    max-height: 500px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.transaction-item:hover {
    background: var(--bg-tertiary);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.transaction-info {
    flex: 1;
}

.transaction-info h4 {
    font-size: 1rem;
    margin-bottom: 3px;
}

.transaction-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.transaction-amount {
    font-size: 1.1rem;
    font-weight: 700;
}

.transaction-amount.positive {
    color: var(--color-success);
}

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

/* ===== EVENTS LIST ===== */
.events-list {
    max-height: 500px;
    overflow-y: auto;
}

.event-item {
    display: flex;
    gap: 15px;
    padding: 15px 25px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.event-item:hover {
    background: var(--bg-tertiary);
}

.event-item:last-child {
    border-bottom: none;
}

.event-date {
    text-align: center;
    background: var(--bg-tertiary);
    padding: 10px;
    border-radius: 10px;
    min-width: 60px;
}

.event-date .day {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.event-date .month {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.event-info h4 {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.event-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--color-primary);
}

/* Responsive badges */
@media (max-width: 480px) {
    .badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
}

/* ===== RESPONSIVE ===== */

/* Tablettes et écrans moyens */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobiles et petits écrans */
@media (max-width: 768px) {
    /* Container et layout */
    .container {
        flex-direction: column;
    }
    
    /* Header */
    .header {
        padding: 10px 15px;
        flex-wrap: wrap;
    }
    
    .header-logo {
        font-size: 1.1rem;
    }
    
    .header-logo i {
        font-size: 1.2rem;
    }
    
    /* Sidebar */
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 10px 0;
    }
    
    .sidebar-nav li {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .sidebar-nav a {
        padding: 10px 15px;
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .sidebar-nav a:hover,
    .sidebar-nav a.active {
        border-left: none;
        border-bottom: 3px solid var(--color-primary);
    }
    
    /* Main content */
    .main-content {
        padding: 15px;
        width: 100%;
    }
    
    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .header-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Stats grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Charts */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .chart-card {
        padding: 20px;
    }
    
    /* Content grid */
    .content-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Cards */
    .card {
        overflow-x: auto;
    }
    
    .card-header {
        padding: 15px 20px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .card-header h3 {
        font-size: 1.1rem;
    }
    
    .card-header .btn {
        width: 100%;
    }
    
    /* Transactions */
    .transaction-item {
        flex-wrap: wrap;
        padding: 15px;
    }
    
    .transaction-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .transaction-info {
        flex: 1;
        min-width: 150px;
    }
    
    .transaction-amount {
        width: 100%;
        text-align: right;
        margin-top: 10px;
        font-size: 1.2rem;
    }
    
    /* Events */
    .event-item {
        flex-wrap: wrap;
    }
    
    .event-date {
        min-width: 50px;
    }
    
    /* Boutons */
    .btn {
        padding: 12px 16px;
        font-size: 0.95rem;
        white-space: nowrap;
    }
    
    .btn i {
        font-size: 1rem;
    }
    
    .btn-sm {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    /* Modal */
    .modal-content {
        max-width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .modal-form {
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Évite le zoom sur iOS */
    }
    
    /* Tableaux */
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    /* User menu */
    .user-menu-toggle {
        padding: 6px 12px;
    }
    
    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    
    /* Empty state */
    .empty-state {
        padding: 40px 20px;
    }
    
    .empty-state i {
        font-size: 2.5rem;
    }
}

/* Très petits écrans */
@media (max-width: 480px) {
    .header {
        padding: 8px 10px;
    }
    
    .header-logo span {
        display: none;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .page-header h1 {
        font-size: 1.3rem;
    }
    
    .stat-card {
        padding: 15px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .card-header {
        padding: 12px 15px;
    }
    
    .transaction-item,
    .event-item {
        padding: 12px;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 8px 6px;
    }
}

/* Corrections débordements */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

table {
    width: 100%;
    table-layout: auto;
}

.transactions-table,
.charges-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Empêcher le débordement du texte */
.transaction-info h4,
.transaction-info p,
.event-info h4,
.event-info p {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Flexbox fixes */
.header-actions,
.modal-actions {
    flex-wrap: wrap;
}

/* Scroll horizontal pour les tableaux sur mobile */
@media (max-width: 768px) {
    .transactions-table table,
    .charges-table table {
        min-width: 600px;
    }
    
    .transactions-list,
    .events-list {
        overflow-x: visible;
    }
}

/* ===== CALENDRIER ===== */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
}

.calendar-header {
    background: var(--bg-tertiary);
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
}

.calendar-day {
    background: var(--bg-secondary);
    min-height: 100px;
    padding: 10px;
    position: relative;
}

.calendar-day.empty {
    background: var(--bg-primary);
}

.calendar-day.today {
    background: rgba(52, 152, 219, 0.1);
    border: 2px solid var(--color-primary);
}

.day-number {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.event-item {
    font-size: 0.85rem;
    padding: 5px 8px;
    background: rgba(52, 152, 219, 0.1);
    border-left: 3px solid var(--color-primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.event-item:hover {
    background: rgba(52, 152, 219, 0.2);
    transform: translateX(3px);
}

.event-item.holiday {
    background: rgba(231, 76, 60, 0.1);
    border-left-color: var(--color-danger);
}

.event-item i {
    font-size: 0.75rem;
}

.event-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.events-list-detailed {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.event-detail-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.event-detail-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.event-date-badge {
    text-align: center;
    background: var(--color-primary);
    color: white;
    padding: 10px;
    border-radius: 10px;
    min-width: 60px;
}

.date-day {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.date-month {
    display: block;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.event-info-detail {
    flex: 1;
}

.event-info-detail h4 {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.event-info-detail p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.badge-info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--color-primary);
}

@media (max-width: 768px) {
    .calendar-grid {
        font-size: 0.85rem;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 5px;
    }
    
    .event-item span {
        display: none;
    }
}

/* ===== GESTION DES CATÉGORIES ===== */

.categories-grid {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.category-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border-left: 4px solid var(--color-primary);
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px var(--shadow);
}

.category-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.category-info {
    flex: 1;
}

.category-info h4 {
    margin-bottom: 5px;
}

.category-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.category-actions {
    display: flex;
    gap: 5px;
}

.color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.color-option {
    cursor: pointer;
}

.color-option input {
    display: none;
}

.color-circle {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.color-option input:checked + .color-circle {
    border-color: var(--text-primary);
    transform: scale(1.1);
}

.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.icon-option {
    cursor: pointer;
}

.icon-option input {
    display: none;
}

.icon-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.icon-option:hover .icon-preview {
    background: var(--bg-tertiary);
}

.icon-option input:checked + .icon-preview {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ===== CALENDRIER DES CHARGES ===== */

.charges-calendar {
    display: grid;
    gap: 15px;
}

.charge-calendar-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border-left: 4px solid var(--color-primary);
}

.charge-day {
    text-align: center;
    min-width: 60px;
}

.day-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.day-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.charge-details {
    flex: 1;
}

.charge-details h4 {
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.charge-details p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.charge-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary);
}

.charges-table table {
    width: 100%;
    border-collapse: collapse;
}

.charges-table th {
    background: var(--bg-tertiary);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.charges-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.charges-table tr:hover {
    background: var(--bg-tertiary);
}

.inactive-row {
    opacity: 0.5;
}

.badge-secondary {
    background: rgba(149, 165, 166, 0.1);
    color: #95a5a6;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* ===== RAPPORT DES DÉPENSES ===== */

.period-filters {
    display: flex;
    flex-wrap: wrap; /* permet de passer à la ligne sur petit écran */
    gap: 20px;       /* réduit l'espacement horizontal */
    align-items: flex-end;
}

.period-filters .form-group {
    flex: 1;             /* chaque champ prend la même largeur */
    margin: 0;           /* supprime les marges par défaut */
    box-sizing: content-box;
}

.period-filters .form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

/* Inputs et selects : même taille, padding uniforme */
.period-filters select,
.period-filters input[type="month"] {
    width: 100%;
    height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-sizing: border-box;
}

/* Boutons de recherche / réinitialisation */
.period-filters button,
.period-filters a.btn {
    flex: 0;                 /* ne prend pas toute la largeur */
    height: 38px;            /* même hauteur que les selects */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    white-space: nowrap;     /* texte sur une seule ligne */
}

.period-filters h3 {
    margin: 0;
    color: var(--color-primary);
    padding-bottom: 5px;
    text-align: right;
}

.top-expenses {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.expense-rank-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.expense-rank-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px var(--shadow);
}

.rank-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.expense-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.expense-details {
    flex: 1;
}

.expense-details h4 {
    margin-bottom: 5px;
}

.expense-details p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.expense-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-danger);
}

@media print {
    .header, .sidebar, .header-actions, .btn {
        display: none !important;
    }
    
    .main-content {
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    .card {
        page-break-inside: avoid;
    }
}

/* ===== PARAMETRES ET THÈMES ===== */

.settings-grid {
    display: grid;
    gap: 20px;
}

.theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.theme-option {
    cursor: pointer;
}

.theme-option input[type="radio"] {
    display: none;
}

.theme-preview {
    padding: 20px;
    border: 3px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.theme-option input[type="radio"]:checked + .theme-preview {
    border-color: var(--color-primary);
    background: rgba(52, 152, 219, 0.1);
}

.theme-preview:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px var(--shadow);
}

.theme-preview i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.theme-preview.theme-light {
    background: #fff;
    color: #333;
}

.theme-preview.theme-dark {
    background: #252932;
    color: #f1f3f5;
}

.theme-preview.theme-blue {
    background: #e3f2fd;
    color: #0d47a1;
}

.theme-preview.theme-green {
    background: #e8f5e9;
    color: #1b5e20;
}

/* ===== TRANSACTIONS ===== */

/* Champs de filtre */
/* Conteneur des filtres */
.filters-grid {
    display: flex;
    flex-wrap: wrap; /* permet de passer à la ligne sur petit écran */
    gap: 10px;       /* réduit l'espacement horizontal */
    align-items: flex-end;
}

/* Chaque champ + label */
.filters-grid .form-group {
    flex: 1;             /* chaque champ prend la même largeur */
    margin: 0;           /* supprime les marges par défaut */
    box-sizing: content-box;
}

/* Labels au-dessus du champ, compact */
.filters-grid .form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

/* Inputs et selects : même taille, padding uniforme */
.filters-grid select,
.filters-grid input[type="text"] {
    width: 100%;
    height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-sizing: border-box;
}

/* Boutons de recherche / réinitialisation */
.filters-grid button,
.filters-grid a.btn {
    flex: 0;                 /* ne prend pas toute la largeur */
    height: 38px;            /* même hauteur que les selects */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    white-space: nowrap;     /* texte sur une seule ligne */
}

/* Tableau de transactions*/

.transactions-table table {
    width: 100%;
    border-collapse: collapse;
}

.transactions-table th {
    background: var(--bg-tertiary);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.transactions-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.transactions-table tr:hover {
    background: var(--bg-tertiary);
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.badge-success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--color-success);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.1);
    color: var(--color-danger);
}

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    transform: scale(1.1);
}

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

.btn-danger:hover {
    background: rgba(231, 76, 60, 0.1);
}