/* ============================================================
   COMPTA.CSS - DESIGN "COMPTA ÉLITE" (DARK MODE & GLASSMORPHISM)
   ============================================================ */

   :root {
    /* L'ADN de Thier Univers */
    --bg-gradient: radial-gradient(circle at top left, #1a1b4b, #0d0d1a, #000000);
    --card-bg: rgba(20, 20, 35, 0.7);
    --card-bg-hover: rgba(30, 30, 45, 0.9);
    
    --c-primary: #00d4ff; /* Cyan IA */
    --c-secondary: #8b5cf6; /* Violet */
    --c-warning: #ff9800;
    --c-danger: #ff0055;
    --c-success: #00e676;
    
    --c-debit: #00d4ff; /* Cyan pour le débit */
    --c-credit: #ff0055; /* Rouge Élite pour le crédit */
    
    --c-text-main: #ffffff;
    --c-text-muted: #aaa;
    --c-border: rgba(255, 255, 255, 0.1);
    
    --sidebar-width: 260px;
    --header-height: 70px;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--c-text-main);
    overflow: hidden; 
}

/* --- STRUCTURE PRINCIPALE --- */
#erp-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- BARRE LATÉRALE (SIDEBAR) --- */
.erp-sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--c-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--c-border);
}

.sidebar-header i {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.5));
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    color: var(--c-text-muted);
    text-decoration: none;
    font-size: 1.2rem;
    border-radius: 12px;
    transition: 0.3s;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
    transform: translateX(5px);
}

.nav-item.active {
    background: rgba(0, 212, 255, 0.15);
    color: var(--c-primary);
    border-color: var(--c-primary);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--c-border);
    display: flex;
    justify-content: center;
}

.btn-exit-erp {
    background: transparent;
    color: var(--c-danger);
    border: 1px solid var(--c-danger);
    width: 50px;
    height: 50px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.3s;
}

.btn-exit-erp:hover {
    background: rgba(255, 0, 85, 0.2);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}

/* --- ZONE CENTRALE (MAIN) --- */
.erp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* TOPBAR */
.erp-topbar {
    height: var(--header-height);
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.topbar-left h2 {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--c-primary);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.topbar-search {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--c-border);
    padding: 10px 20px;
    border-radius: 30px;
    width: 350px;
}

.topbar-search input {
    border: none;
    background: transparent;
    width: 100%;
    outline: none;
    color: white;
    margin-left: 10px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.topbar-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--c-border);
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    transition: 0.2s;
}

.topbar-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--c-primary); }

.topbar-profile img {
    width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--c-primary); object-fit: cover;
}

/* --- VUES CONTENT --- */
.erp-view {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    display: none;
}
.erp-view.active-view { display: block; }

/* BOUTONS GÉNÉRIQUES PROS */
.btn-primary {
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    color: white; border: none; padding: 12px 25px; border-radius: 8px;
    font-weight: bold; cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
    box-shadow: 0 5px 15px rgba(0, 198, 255, 0.3); transition: 0.3s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 198, 255, 0.5); }

.btn-secondary {
    background: rgba(255,255,255,0.05); color: white; border: 1px solid var(--c-border);
    padding: 10px 20px; border-radius: 8px; font-weight: bold; cursor: pointer; transition: 0.3s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

.btn-success {
    background: linear-gradient(135deg, #4caf50, #2e7d32); color: white; border: none;
    padding: 12px 25px; border-radius: 8px; font-weight: bold; cursor: pointer; transition: 0.3s;
}
.btn-success:disabled { background: #444; color: #888; cursor: not-allowed; box-shadow: none; }

/* INPUTS GÉNÉRIQUES SOMBRES */
.erp-input {
    width: 100%; padding: 12px; background: rgba(0,0,0,0.5); border: 1px solid var(--c-border);
    color: white; border-radius: 8px; box-sizing: border-box; transition: 0.3s;
}
.erp-input:focus { border-color: var(--c-primary); box-shadow: 0 0 10px rgba(0,212,255,0.2); outline: none; }

.erp-input-small {
    padding: 8px; background: rgba(0,0,0,0.5); border: 1px solid var(--c-border);
    color: white; border-radius: 5px; width: 100%; box-sizing: border-box;
}

.form-group label { display: block; margin-bottom: 5px; color: var(--c-text-muted); font-size: 0.85rem; }

/* --- VUE 1 : DASHBOARD (Complexe & Élite) --- */
.welcome-banner { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.welcome-banner h1 { margin: 0 0 5px; font-family: 'Space Grotesk', sans-serif; font-size: 2rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 40px; }
.kpi-card {
    background: var(--card-bg); backdrop-filter: blur(10px);
    border: 1px solid var(--c-border); padding: 25px; border-radius: 15px;
    display: flex; align-items: center; gap: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); transition: 0.3s;
}
.kpi-card:hover { border-color: var(--c-primary); transform: translateY(-5px); }
.kpi-icon { width: 60px; height: 60px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.kpi-info h3 { margin: 0 0 5px; font-size: 0.9rem; color: var(--c-text-muted); text-transform: uppercase; }
.kpi-value { margin: 0; font-size: 1.8rem; font-weight: bold; font-family: 'Space Grotesk', sans-serif; }

.section-title { font-family: 'Space Grotesk', sans-serif; border-bottom: 1px solid var(--c-border); padding-bottom: 10px; margin-bottom: 20px; color: var(--c-primary); }

.apps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.app-card {
    background: var(--card-bg); border: 1px solid var(--c-border);
    padding: 30px 20px; border-radius: 15px; text-align: center; cursor: pointer;
    transition: 0.3s;
}
.app-card:hover { background: var(--card-bg-hover); border-color: var(--c-primary); box-shadow: 0 0 20px rgba(0, 212, 255, 0.15); }
.app-icon { font-size: 3rem; margin-bottom: 15px; filter: drop-shadow(0 0 10px currentColor); }
.app-card h4 { margin: 0 0 10px; font-size: 1.2rem; }
.app-card p { margin: 0; font-size: 0.85rem; color: var(--c-text-muted); }

/* --- VUE 2 : IMPORT IA (Split Screen Pro) --- */
.split-screen-ia { display: flex; gap: 20px; height: calc(100vh - var(--header-height) - 120px); }

.ia-viewer {
    flex: 1.5; background: rgba(0,0,0,0.5); border-radius: 15px; border: 1px solid var(--c-border);
    display: flex; flex-direction: column; overflow: hidden; box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}
.viewer-toolbar { background: rgba(20,20,30,0.9); padding: 10px; display: flex; gap: 10px; border-bottom: 1px solid var(--c-border); }
.viewer-toolbar button { background: transparent; color: white; border: none; cursor: pointer; font-size: 1.2rem; padding: 5px 10px; }
.viewer-content { flex: 1; overflow: auto; padding: 20px; display: flex; justify-content: center; align-items: flex-start; }

.ia-form {
    width: 450px; background: var(--card-bg); border-radius: 15px; border: 1px solid var(--c-border);
    display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.ia-status { padding: 15px 20px; background: rgba(0,0,0,0.3); color: var(--c-warning); font-weight: bold; border-bottom: 1px solid var(--c-border); }
.ia-status.scanning { color: var(--c-primary); text-shadow: 0 0 10px var(--c-primary); }
.ia-status.success { color: var(--c-success); text-shadow: 0 0 10px var(--c-success); }

.form-section { padding: 20px; border-bottom: 1px solid var(--c-border); }
.form-section-title { font-size: 1rem; color: var(--c-primary); margin: 0 0 15px 0; text-transform: uppercase; letter-spacing: 1px; }
.ia-actions { padding: 20px; background: rgba(0,0,0,0.4); text-align: center; }

/* --- TABLES GÉNÉRIQUES COMPLEXES --- */
.erp-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.erp-table th, .erp-table td { padding: 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05); }
.erp-table th { background: rgba(0,0,0,0.6); color: var(--c-primary); font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
.erp-table tbody tr:hover { background: rgba(255,255,255,0.03); }

/* --- VUE 3 : JOURNAUX (COMPLEXE FAÇON COALA) --- */
.coala-layout { display: flex; background: var(--card-bg); border: 1px solid var(--c-border); height: calc(100vh - var(--header-height) - 150px); border-radius: 15px; overflow: hidden; }
.coala-sidebar { width: 250px; border-right: 1px solid var(--c-border); background: rgba(0,0,0,0.4); display: flex; flex-direction: column; }
.coala-toolbar { padding: 15px; border-bottom: 1px solid var(--c-border); }
.coala-journaux-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; }
.coala-journaux-list li { padding: 15px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.02); transition: 0.2s; font-family: 'Space Grotesk', sans-serif;}
.coala-journaux-list li:hover { background: rgba(255,255,255,0.05); }
.coala-journaux-list li.active { background: rgba(0, 212, 255, 0.1); color: var(--c-primary); border-left: 4px solid var(--c-primary); }

.coala-grid-container { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.coala-grid-toolbar { padding: 10px 15px; background: rgba(0,0,0,0.6); border-bottom: 1px solid var(--c-border); display: flex; gap: 10px; }
.coala-grid-toolbar button { background: rgba(255,255,255,0.1); color: white; border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; }
.coala-grid-toolbar button:hover { background: var(--c-primary); }

.coala-table { font-family: 'Courier New', Courier, monospace; } /* Typo stricte Comptable */
.coala-table th { background: #0a0a0f; border-right: 1px solid rgba(255,255,255,0.05); }
.coala-table td { border-right: 1px solid rgba(255,255,255,0.02); padding: 0 !important; } /* On retire le padding pour les inputs */
.amount { text-align: right !important; font-weight: bold; font-size: 0.95rem; }
.amount.debit { color: var(--c-debit); text-shadow: 0 0 5px rgba(0,212,255,0.3); }
.amount.credit { color: var(--c-credit); text-shadow: 0 0 5px rgba(255,0,85,0.3); }

/* --- VUE 4 : RAPPROCHEMENT BANCAIRE --- */
#view-rapprochement .erp-table {
    border-collapse: separate; /* Permet le sticky header */
    border-spacing: 0;
}
#view-rapprochement .erp-table th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #0a0a0f; /* Fond opaque pour cacher les lignes dessous au scroll */
}
#view-rapprochement .erp-table tbody tr {
    transition: background-color 0.2s ease, transform 0.1s ease;
}
#view-rapprochement .erp-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.08); /* Effet hover plus prononcé */
}

/* --- MODALS ERP --- */
.erp-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.erp-modal-content { background: rgba(20, 20, 30, 0.95); border: 1px solid var(--c-border); width: 450px; border-radius: 15px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); overflow: hidden; }
.erp-modal-header { padding: 20px; border-bottom: 1px solid var(--c-border); display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.5); }
.erp-modal-header h3 { margin: 0; color: var(--c-primary); font-family: 'Space Grotesk', sans-serif; }
.close-modal { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; }
.erp-modal-body { padding: 25px; }
.erp-modal-footer { padding: 20px; border-top: 1px solid var(--c-border); background: rgba(0,0,0,0.5); display: flex; justify-content: flex-end; gap: 15px; }

/* Menus déroulants sombres */
select.erp-input option, select.erp-input-small option { background: #111; color: white; }

/* ==========================================
   AJOUTS POUR L'ÉDITION DES JOURNAUX (GRILLE)
   ========================================== */
.grid-input {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    color: white;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    padding: 12px 6px;
    outline: none;
    box-sizing: border-box;
    border-radius: 0;
    transition: 0.2s;
}
.grid-input:focus {
    background: rgba(0, 212, 255, 0.1);
}
.grid-input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}
.grid-input.amount {
    text-align: right;
}
#coala-ecritures-body tr {
    transition: 0.2s;
    cursor: pointer;
}
#coala-ecritures-body tr.selected-row {
    background: rgba(0, 212, 255, 0.1) !important;
    box-shadow: inset 4px 0 0 var(--c-primary);
}
#coala-ecritures-body tr.selected-row .grid-input {
    background: rgba(0,0,0,0.3);
}
/* Supprimer les flèches des inputs number pour faire plus propre */
.grid-input[type="number"]::-webkit-inner-spin-button, 
.grid-input[type="number"]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
.grid-input[type="number"] {
    -moz-appearance: textfield;
}

/* ==========================================
   VUE 5 : INTERROGATION / BALANCE
   ========================================== */
.interro-tab {
    padding: 15px 25px;
    cursor: pointer;
    color: var(--c-text-muted);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    border-right: 1px solid rgba(255,255,255,0.05);
    transition: 0.3s;
}
.interro-tab:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}
.interro-tab.active {
    background: rgba(0, 212, 255, 0.1);
    color: var(--c-primary);
    border-bottom: 2px solid var(--c-primary);
}
.interro-content {
    display: none;
}
.interro-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}