/* ============================================
   PENNY-WISE - Styles principaux
   Inspiré de Time-Tracking pour cohérence
   ============================================ */

/* Variables CSS */
:root {
    --primary: #00c2cb;
    --secondary: #8e44ad;
    --accent: #c19cf6;
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.18);
    --shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    color: var(--dark);
    overflow-x: hidden;
    line-height: 1.6;
}

/* ============================================
   BLOB ANIMATED BACKGROUND
   ============================================ */

.blob-container {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0;
    transition: opacity 2s ease-in-out;
    will-change: transform;
}

/* ============================================
   SIDEBAR NAVIGATION
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.sidebar-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
    flex: 1;
    padding: 20px 0;
}

.nav-links li {
    margin: 5px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: white;
    text-decoration: none;
    transition: var(--transition);
    font-weight: 500;
    border-left: 4px solid transparent;
}

.nav-link:hover {
    background: var(--glass-bg);
    border-left-color: var(--primary);
    padding-left: 30px;
}

.nav-link.active {
    background: var(--glass-bg);
    border-left-color: var(--primary);
    box-shadow: inset 0 0 20px rgba(0, 194, 203, 0.3);
}

.nav-link i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
}

.sidebar-footer a {
    display: block;
    padding: 12px;
    background: var(--glass-bg);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 500;
}

.sidebar-footer a:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 194, 203, 0.4);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

#main-content {
    margin-left: 280px;
    padding: 20px 40px; /* Légère réduction du padding vertical */
    height: 100vh; /* 🚨 Forcer la hauteur à 100% de l'écran */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Empêcher le scroll du body entier */
}

.page {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

.page.active {
    display: block;
    animation: fadeInUp 0.5s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 0;
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
    flex: 1; /* 🚨 Prendre toute la place restante */
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* 🚨 C'est ICI que ça scroll maintenant */
}
/* 🚨 On remet le padding sur le contenu DANS le scroll */
.page-content > * {
    padding-left: 40px;
    padding-right: 40px;
}

.page-content > h1:first-child {
    padding-top: 30px;
    padding-bottom: 10px;
    flex-shrink: 0;
}

.page-content > div:last-child {
    padding-bottom: 30px;
}
.page-content h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.page-content h1 i {
    color: var(--primary);
}

/* ============================================
   CARDS & GRIDS
   ============================================ */

.card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.card h3 {
    color: var(--dark);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.compte-card.principal {
    border: 1px solid var(--primary);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5);
}

.badge-principal {
    background-color: var(--primary);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: auto;
}

/* ============================================
   BUTTONS
   ============================================ */

button,
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 194, 203, 0.4);
}

.btn-secondary {
    background: var(--light);
    color: var(--dark);
}

.btn-secondary:hover {
    background: #d5d8dc;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-icon {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--light);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--dark);
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 25px 0;
    gap: 15px;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin: 20px 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--light);
    border-radius: 8px;
    font-size: 15px;
    transition: var(--transition);
    background: white;
    color: var(--secondary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 194, 203, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    justify-content: flex-end;
}

.filters-bar {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.filters-bar input,
.filters-bar select {
    padding: 10px 15px;
    border: 2px solid var(--light);
    border-radius: 8px;
    font-size: 14px;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.table thead {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.table th {
    padding: 15px;
    text-align: left;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--light);
    color: var(--dark);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(0, 194, 203, 0.05);
}

.table-simple {
    width: 100%;
    border-collapse: collapse;
}

.table-simple td {
    padding: 10px;
    border-bottom: 1px solid var(--light);
}

/* ============================================
   MODALS
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    margin: 3% auto;
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideDown 0.4s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: 25px;
    color: var(--dark);
    font-size: 1.8rem;
}

.close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 32px;
    cursor: pointer;
    color: var(--dark);
    transition: var(--transition);
    line-height: 1;
}

.close:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

/* ============================================
   COMPTES SPECIFIQUES
   ============================================ */

.compte-card {
    border-left: 5px solid var(--primary);
}

.compte-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.compte-body {
    margin: 20px 0;
}

.solde-display {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 10px 0;
}

.compte-meta {
    color: #7f8c8d;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.compte-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-end;
}

.compte-mini {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--light);
    border-radius: 8px;
    margin: 10px 0;
}

.compte-mini strong {
    color: var(--dark);
}

.compte-mini .solde {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

/* ============================================
   TAGS
   ============================================ */

.tag-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: var(--transition);
}

.tag-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.tag-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tag-card-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.tags-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.tag-checkbox {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.tag-checkbox input {
    margin-right: 8px;
}

.tag-label {
    padding: 6px 12px;
    border-radius: 20px;
    color: white;
    font-size: 13px;
    font-weight: 600;
}

/* ============================================
   STATS & DASHBOARD
   ============================================ */

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--light);
    border-radius: 10px;
    margin: 10px 0;
}

.stat-label {
    color: var(--dark);
    font-weight: 600;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
}

/* ============================================
   BADGES & UTILITY CLASSES
   ============================================ */

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: var(--success);
    color: white;
}

.badge-danger {
    background: var(--danger);
    color: white;
}

.badge-warning {
    background: var(--warning);
    color: white;
}

.badge-en_attente {
    background: var(--warning);
    color: white;
}

.badge-reussi {
    background: var(--success);
    color: white;
}

.badge-echoue {
    background: var(--danger);
    color: white;
}

.positive {
    color: var(--success);
    font-weight: 600;
}

.negative {
    color: var(--danger);
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
}

.error {
    color: var(--danger);
    padding: 15px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    border-left: 4px solid var(--danger);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        width: 250px;
    }

    #main-content {
        margin-left: 250px;
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    #main-content {
        margin-left: 0;
        padding: 20px;
    }

    .page-content {
        padding: 25px;
    }

    .page-content h1 {
        font-size: 1.8rem;
    }

    .dashboard-grid,
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filters-bar input,
    .filters-bar select {
        width: 100%;
    }
}

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    /* 🚨 Ajout : Arrondir la piste de la scrollbar pour correspondre à la card */
    border-radius: 20px; 
    margin: 10px 0; /* Évite que la scrollbar touche les bords extrêmes */
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 20px; /* 🚨 Plus arrondi */
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Stats */
.stat-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #bbb;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
}

/* Comptes mini */
.compte-mini {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.compte-mini .solde {
    font-weight: bold;
    font-size: 1.1rem;
}

/* Table simple */
.table-simple {
    width: 100%;
    border-collapse: collapse;
}

.table-simple tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.table-simple tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.table-simple td {
    padding: 0.75rem 0.5rem;
}

/* Couleurs */
.positive {
    color: #27ae60 !important;
}

.negative {
    color: #e74c3c !important;
}

/* ============================================
   PARAMETRES
   ============================================ */

.form-control {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.proc-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.invitation-item {
    background: rgba(255,255,255,0.03);
    padding: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.invitation-item strong { color: var(--primary); }
.invitation-item em { font-style: normal; font-weight: bold; }
.text-muted { color: #888; font-style: italic; }

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    margin-left: 5px;
}

/* IMPORT grisé sur les doublons */
.duplicate-row {
    background-color: rgba(0, 0, 0, 0.05);
    color: #7f8c8d;
    transition: all 0.3s ease;
}
/* Note: L'opacité est gérée via JS pour l'interactivité immédiate, 
   mais vous pouvez l'ajouter ici aussi */


/* =========================================================
   REFONTE DU TABLEAU DE BORD (ACCUEIL)
   ========================================================= */

/* 1. Restructuration de la grille (Stats en haut, puis Comptes/Mouvements) */
.dashboard-grid {
    display: grid !important;
    grid-template-columns: 350px 1fr; /* Comptes à gauche (fixes), Mouvements à droite (fluides) */
    grid-template-areas: 
        "stats stats"
        "comptes mouvements";
    gap: 25px;
    align-items: start;
}

/* Assignation des 3 cartes à leurs zones */
.dashboard-grid > .card:nth-child(1) { grid-area: comptes; }
.dashboard-grid > .card:nth-child(2) { 
    grid-area: stats; 
    background: transparent; /* On supprime la grosse carte globale des stats */
    border: none; 
    box-shadow: none; 
    padding: 0; 
}
.dashboard-grid > .card:nth-child(3) { grid-area: mouvements; }

/* On masque le titre H3 "Statistiques" devenu inutile */
.dashboard-grid > .card:nth-child(2) h3 { display: none; }

/* 2. Glassmorphism sur les Cartes restantes */
.dashboard-grid > .card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    color: #fff; /* Passage du texte en blanc pour contraster avec le fond */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.dashboard-grid > .card h3 {
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    margin-top: 0;
    margin-bottom: 20px;
}

/* 3. Design des 3 blocs Statistiques (KPIs alignés horizontalement) */
/* 🚨 Forcer la hauteur des cards dans les grilles */
#dashboard-stats {
    display: grid;
    /* La première colonne = Camembert (350px) / La deuxième = Évolution (le reste) */
    grid-template-columns: 350px 1fr;
    gap: 25px;
    align-items: stretch; /* C'est ça qui force les deux cards à faire la même hauteur */
    margin-bottom: 25px;
}

#dashboard-stats > .card {
    height: 100%;
    margin: 0; /* Enlever la marge par défaut des cards */
    display: flex;
    flex-direction: column;
}

#dashboard-stats > .card > div[style*="position: relative"] {
    flex: 1; /* Forcer le conteneur du canvas Chart.js à prendre tout l'espace */
    min-height: 250px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background 0.3s;
}

.stat-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.stat-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
}

/* 4. Couleurs adaptées au fond sombre (Néon subtil) */
.positive { color: #2ecc71 !important; text-shadow: 0 0 10px rgba(46,204,113,0.3); }
.negative { color: #ff7675 !important; text-shadow: 0 0 10px rgba(255,118,117,0.3); }

/* 5. Design de "Mes Comptes" (Effet "creusé") */
.compte-mini {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
.compte-mini:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}
.compte-mini strong { font-size: 1.1rem; color: #fff; }

/* 6. Tableau "Derniers Mouvements" (Correction des textes écrasés) */
.table-simple {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px; /* Sépare les lignes pour faire des mini-blocs */
}
.table-simple tr {
    background: rgba(0, 0, 0, 0.15);
    transition: background 0.2s;
}
.table-simple tr:hover {
    background: rgba(0, 0, 0, 0.25);
}
.table-simple td {
    padding: 12px 15px;
    border: none;
    color: #fff;
}
.table-simple td:first-child {
    border-radius: 10px 0 0 10px;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
}
.table-simple td:last-child {
    border-radius: 0 10px 10px 0;
}
/* Finis les textes sur 5 lignes : on tronque élégamment avec des "..." */
.table-simple td strong {
    display: block;
    max-width: 850px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}
.table-simple td small {
    color: rgba(255,255,255,0.5) !important;
}

/* 7. Mode Mobile (Responsive) */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "stats"
            "comptes"
            "mouvements";
    }
    #dashboard-stats {
        grid-template-columns: 1fr;
    }
}


/* =========================================================
   REFONTE DE LA PAGE MOUVEMENTS (TABLEAUX ET FILTRES)
   ========================================================= */

/* 1. Amélioration de la barre de filtres */
.filters-bar {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    gap: 15px;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.filters-bar select, 
.filters-bar input[type="date"] {
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-radius: 8px;
}
.filters-bar select option { background: #2c3e50; color: white; }

/* 2. Rendre le conteneur du tableau transparent */
.table-container {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    margin-top: 25px;
}

/* 3. Refonte du tableau principal (Table Glassmorphism) */
.table {
    background: transparent !important;
    border-collapse: separate;
    border-spacing: 0 8px; /* Lignes séparées style "cartes" */
}

/* En-tête transparent et néon */
.table thead {
    background: transparent !important;
}
.table th {
    background: rgba(0, 0, 0, 0.2);
    color: rgba(255, 255, 255, 0.8) !important;
    border: none !important;
    font-size: 0.85rem !important;
    letter-spacing: 1px;
    padding: 15px !important;
}
/* Arrondir les bords de l'en-tête */
.table th:first-child { border-radius: 10px 0 0 10px; }
.table th:last-child { border-radius: 0 10px 10px 0; }

/* Lignes de données (Effet Glass) */
.table tbody tr {
    background: rgba(255, 255, 255, 0.07) !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}
.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.005);
}

/* Cellules de données */
.table td {
    border: none !important;
    padding: 12px 15px !important;
    color: white !important;
    vertical-align: middle;
}
.table td:first-child { border-radius: 10px 0 0 10px; }
.table td:last-child { border-radius: 0 10px 10px 0; }

/* Tronquer les libellés trop longs */
.table td:nth-child(3) { 
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

/* Montants : Glow effect */
.table td.positive { color: #2ecc71 !important; text-shadow: 0 0 8px rgba(46,204,113,0.4); font-weight: bold; }
.table td.negative { color: #ff7675 !important; text-shadow: 0 0 8px rgba(255,118,117,0.4); font-weight: bold; }

/* 4. Boutons d'action dans le tableau (Plus discrets) */
.btn-icon {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    box-shadow: none !important;
    margin: 0 2px;
}
.btn-icon:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

/* 5. Barre d'action de masse (Rouge Glass) */
#bulk-actions-bar {
    background: rgba(231, 76, 60, 0.15) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(231, 76, 60, 0.3) !important;
    color: white !important;
}
#bulk-actions-bar span { color: white !important; }

/* =========================================================
   SCROLL DU TABLEAU MOUVEMENTS (VIRTUALISATION)
   ========================================================= */

/* On contraint la page pour éviter le double scroll de l'écran entier */
#page-mouvements.page.active,
#page-logs.page.active {
    display: flex !important;
    flex-direction: column;
    height: calc(100vh - 80px);
    overflow: hidden;
}

#page-mouvements .page-content,
#page-logs .page-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding-bottom: 0;
}

#liste-mouvements,
#liste-logs {
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* La zone du corps du tableau qui va VRAIMENT scroller */
.table-responsive-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    background: transparent;
    padding-right: 5px; /* Laisse la place à la scrollbar */
    border-radius: 0 0 8px 8px; /* Arrondis en bas seulement */
}

/* Scrollbar personnalisée */
.table-responsive-wrapper::-webkit-scrollbar { width: 8px; }
.table-responsive-wrapper::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); border-radius: 4px; }
.table-responsive-wrapper::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* Styles des Lignes et Accordéon */
.main-row {
    height: 65px;
    transition: background-color 0.2s;
}
.main-row:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}
.main-row td { 
    vertical-align: middle; 
    padding: 12px 15px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Design Accordéon */
.details-row td {
    padding: 0 !important;
    border: none !important;
}
.details-card {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin: 5px 10px 15px 10px;
    color: white;
    border-left: 4px solid var(--primary);
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}

/* Hover spécifique pour les lignes de Logs */
.log-row {
    transition: background-color 0.2s;
}
.log-row:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}