/* Variables CSS - Style Votre Entreprise */
:root {
    --primary-color: #1e3a5f;
    --primary-dark: #152a45;
    --primary-light: #2c5282;
    --accent-color: #4a90c2;
    --accent-light: #7ab8e0;
    --accent-dark: #2c5282;
    --success-color: #5cb85c;
    --danger-color: #d9534f;
    --warning-color: #f0ad4e;
    --info-color: #5bc0de;
    --background-color: #f0f0e8;
    --background-cream: #fafae8;
    --card-background: #ffffff;
    --header-bg: #1e3a5f;
    --gray-light: #e8e8e8;
    --gray-medium: #b0b0b0;
    --gray-dark: #707070;
    --toolbar-bg: linear-gradient(to bottom, #f8f8f8, #e0e0e0);
    --text-color: #333333;
    --text-light: #666666;
    --border-color: #b0b0b0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
    font-size: 13px;
}

/* Barre de menu */
.menu-bar {
    display: flex;
    align-items: center;
    background: linear-gradient(to bottom, #e8e8e8, #c8c8c8);
    border-bottom: 1px solid #a0a0a0;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-item {
    position: relative;
}

.menu-title {
    display: block;
    padding: 10px 14px;
    color: #333;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
    border-right: 1px solid #c0c0c0;
}

.menu-title:hover {
    background: rgba(255, 255, 255, 0.5);
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 4px 4px;
    z-index: 101;
}

.menu-item:hover .menu-dropdown {
    display: block;
}

.menu-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    transition: background 0.2s;
}

.menu-dropdown button:hover {
    background: var(--background-color);
}

.menu-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 4px 0;
}

.menu-spacer {
    flex: 1;
}

.menu-info {
    padding: 10px 16px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 13px;
}

/* Contenu principal */
.main-content {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--background-color);
    min-height: calc(100vh - 45px);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Page d'accueil */
#accueil h1 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 22px;
    font-weight: 600;
    padding: 10px 15px;
    background: var(--header-bg);
    color: white;
    border-radius: 4px 4px 0 0;
    margin: -20px -20px 20px -20px;
    padding: 12px 20px;
}

/* Grille des modules */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.module-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 20px;
    background: linear-gradient(to bottom, #ffffff, #f0f0f0);
    border: 1px solid #b0b0b0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
}

.module-btn:hover {
    background: linear-gradient(to bottom, #e8f4fc, #d0e8f8);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-lg);
}

.module-btn:active {
    background: linear-gradient(to bottom, #d0e8f8, #c0d8e8);
}

.module-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.module-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.module-desc {
    font-size: 11px;
    color: var(--text-light);
}

/* Cartes de résumé */
.dashboard-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.summary-card {
    background: var(--card-background);
    padding: 15px;
    border-radius: 4px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
}

.summary-card h3 {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.summary-card .amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

/* En-tête de module */
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.module-header h1 {
    color: white;
    background: var(--header-bg);
    padding: 10px 15px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 18px;
}

.btn-retour {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: linear-gradient(to bottom, #f8f8f8, #e0e0e0);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-retour:hover {
    background: linear-gradient(to bottom, #e8e8e8, #d0d0d0);
}

/* Boutons */
.btn {
    padding: 6px 14px;
    border: 1px solid #999;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(to bottom, #4a90c2, #3a7aa8);
    color: white;
    border: 1px solid #2c5282;
}

.btn-primary:hover {
    background: linear-gradient(to bottom, #3a7aa8, #2c5282);
}

.btn-success {
    background: linear-gradient(to bottom, #5cb85c, #449d44);
    color: white;
    border: 1px solid #3d8b3d;
}

.btn-success:hover {
    background: linear-gradient(to bottom, #449d44, #3d8b3d);
}

.btn-danger {
    background: linear-gradient(to bottom, #d9534f, #c9302c);
    color: white;
    border: 1px solid #ac2925;
}

.btn-danger:hover {
    background: linear-gradient(to bottom, #c9302c, #ac2925);
}

.btn-secondary {
    background: linear-gradient(to bottom, #f8f8f8, #e0e0e0);
    color: var(--text-color);
    border: 1px solid #999;
}

.btn-secondary:hover {
    background: linear-gradient(to bottom, #e8e8e8, #d0d0d0);
}

/* Boutons d'action dans les tableaux */
td .btn {
    padding: 4px 8px;
    font-size: 11px;
    margin: 1px;
}

td .btn + .btn {
    margin-left: 4px;
}

/* Tableaux */
.table-container {
    background: var(--card-background);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
}

tr:hover {
    background: var(--background-color);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Formulaires */
.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 13px;
    transition: border-color 0.2s;
    background: #fffff8;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #ffffd0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--background-cream);
    border-radius: 6px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

#modal-body {
    background: var(--background-cream);
}

.text-light {
    color: var(--text-light);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--primary-color);
    border-bottom: none;
}

.modal-header h2 {
    color: white;
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

#modal-body {
    padding: 20px;
}

/* Onglets */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
    border-radius: 4px 4px 0 0;
}

.tab {
    padding: 10px 20px;
    border: 1px solid transparent;
    border-bottom: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: -1px;
    transition: all 0.2s;
    border-radius: 4px 4px 0 0;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.5);
}

.tab.active {
    background: white;
    border-color: var(--border-color);
    border-bottom-color: white;
    color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Barre d'outils */
.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px;
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.toolbar .search-input {
    flex: 1;
    min-width: 200px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 13px;
}

/* Calculatrice */
.calculatrice {
    position: fixed;
    top: 50px;
    right: 20px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    width: 220px;
    z-index: 150;
}

.calculatrice.hidden {
    display: none;
}

.calc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--primary-color);
    color: white;
    border-radius: 6px 6px 0 0;
    font-size: 13px;
}

.calc-header button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

#calc-display {
    width: 100%;
    padding: 16px;
    border: none;
    font-size: 24px;
    text-align: right;
    background: var(--background-color);
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px;
}

.calc-buttons button {
    padding: 16px;
    border: none;
    background: var(--background-color);
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.calc-buttons button:hover {
    background: var(--border-color);
}

.calc-buttons .calc-clear {
    background: var(--danger-color);
    color: white;
    grid-column: span 4;
}

/* Alertes et messages */
.alert {
    padding: 10px 14px;
    border-radius: 3px;
    margin-bottom: 12px;
    font-size: 12px;
}

.alert-success {
    background: #dff0d8;
    color: #3c763d;
    border: 1px solid #d6e9c6;
}

.alert-danger {
    background: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}

.alert-warning {
    background: #fcf8e3;
    color: #8a6d3b;
    border: 1px solid #faebcc;
}

.alert-info {
    background: #d9edf7;
    color: #31708f;
    border: 1px solid #bce8f1;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success {
    background: #dff0d8;
    color: #3c763d;
    border: 1px solid #d6e9c6;
}

.badge-warning {
    background: #fcf8e3;
    color: #8a6d3b;
    border: 1px solid #faebcc;
}

.badge-danger {
    background: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}

.badge-info {
    background: #d9edf7;
    color: #31708f;
    border: 1px solid #bce8f1;
}

/* Écritures comptables */
.ecritures-form {
    background: var(--card-background);
    padding: 20px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.ecritures-form h3 {
    color: white;
    background: var(--primary-color);
    padding: 8px 12px;
    margin: -20px -20px 20px -20px;
    border-radius: 4px 4px 0 0;
    font-size: 14px;
}

.ecritures-form h4 {
    color: var(--primary-color);
    font-size: 13px;
    margin: 15px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
}

.lignes-ecriture {
    margin: 16px 0;
}

.ligne-ecriture {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
    margin-bottom: 8px;
    align-items: center;
}

.ligne-ecriture input,
.ligne-ecriture select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.btn-supprimer-ligne {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
}

.totaux-ecriture {
    display: flex;
    justify-content: flex-end;
    gap: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-weight: 600;
}

.totaux-ecriture.equilibre {
    color: var(--success-color);
}

.totaux-ecriture.desequilibre {
    color: var(--danger-color);
}

/* Cartes d'information */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.info-card {
    background: linear-gradient(to bottom, #ffffff, #f8f8f0);
    padding: 12px 15px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
}

.info-card h4 {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.info-card p {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Rapports */
.rapport-container {
    background: var(--card-background);
    padding: 20px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.rapport-container h3:not(.rapport-section h3) {
    color: white;
    background: var(--primary-color);
    padding: 8px 12px;
    margin: -20px -20px 20px -20px;
    border-radius: 4px 4px 0 0;
    font-size: 14px;
}

.rapport-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
}

.rapport-header h2 {
    color: var(--primary-color);
    margin-bottom: 4px;
    font-size: 18px;
}

.rapport-header p {
    color: var(--text-light);
    font-size: 14px;
}

.rapport-section {
    margin-bottom: 24px;
}

.rapport-section h3 {
    color: white;
    background: var(--primary-color);
    padding: 8px 12px;
    border-bottom: none;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 14px;
    border-radius: 3px;
}

.rapport-ligne {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dotted var(--border-color);
}

.rapport-ligne.total {
    font-weight: 600;
    border-bottom: 2px solid var(--text-color);
    margin-top: 8px;
    padding-top: 12px;
}

.rapport-ligne.grand-total {
    font-weight: 700;
    font-size: 16px;
    border-top: 3px double var(--primary-color);
    border-bottom: none;
    margin-top: 12px;
    padding-top: 12px;
    color: var(--primary-color);
}

/* Écran de connexion */
.ecran-login {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    overflow: hidden;
}

.login-header {
    background: var(--primary-color);
    padding: 24px;
    text-align: center;
}

.login-header h1 {
    color: white;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.login-card h2 {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

#form-connexion,
#form-inscription {
    padding: 24px;
}

.btn-login {
    width: 100%;
    padding: 10px 14px !important;
    font-size: 14px !important;
    margin-top: 8px;
    justify-content: center;
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-toggle {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-light);
}

.login-toggle a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
}

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

.login-mdp-oublie {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
}

.login-mdp-oublie a {
    color: var(--text-light);
    text-decoration: none;
}

.login-mdp-oublie a:hover {
    text-decoration: underline;
    color: var(--accent-color);
}

/* Email utilisateur dans la barre de menu */
.menu-email {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 400;
    margin-left: 8px;
}

/* Écran de sélection de dossiers */
.ecran-dossiers {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}

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

.dossiers-header h1 {
    color: white;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 6px;
}

.dossiers-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
}

.dossiers-actions {
    margin-bottom: 24px;
}

.dossiers-actions .btn {
    padding: 10px 24px;
    font-size: 14px;
}

.dossiers-container {
    width: 100%;
    max-width: 800px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.dossier-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid transparent;
}

.dossier-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    border-color: var(--accent-light);
}

.dossier-card .dossier-nom {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    word-break: break-word;
}

.dossier-card .dossier-date {
    font-size: 11px;
    color: var(--text-light);
}

.dossier-card .dossier-acces {
    font-size: 11px;
    color: var(--gray-medium);
    margin-top: 4px;
}

.dossiers-vide {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
}

.dossiers-vide p:first-child {
    font-size: 18px;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
}

/* Écran de prix */
#ecran-prix,
#ecran-abonnement-requis {
    padding: 24px;
}

#ecran-prix h2,
#ecran-abonnement-requis h2 {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
}

.prix-card {
    background: linear-gradient(to bottom, #f8fbff, #eef4fa);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.prix-montant {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.prix-periode {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-light);
}

.prix-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    text-align: left;
}

.prix-features li {
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-color);
    border-bottom: 1px solid var(--gray-light);
}

.prix-features li::before {
    content: "\2713";
    color: var(--success-color);
    font-weight: 700;
    margin-right: 8px;
}

.prix-features li:last-child {
    border-bottom: none;
}

.abonnement-requis-msg {
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 16px;
}

.abonnement-requis-info {
    color: var(--text-light);
    font-size: 13px;
    margin-top: 12px;
}

/* Formulaire de création de dossier dans modal */
.form-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-light);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h4 {
    color: var(--primary-color);
    font-size: 13px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--accent-color);
    display: inline-block;
}

/* Responsive */
@media (max-width: 1024px) {
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .dashboard-summary {
        grid-template-columns: 1fr;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .ligne-ecriture {
        grid-template-columns: 1fr;
    }

    .menu-bar {
        flex-wrap: wrap;
    }
}

/* Impression */
@media print {
    .menu-bar,
    .btn,
    .toolbar,
    .modal-close {
        display: none !important;
    }

    .rapport-container {
        box-shadow: none;
        border: 1px solid #000;
    }
}
