/* Variables CSS */
:root {
    --primary-color: #8d8e92;
    --secondary-color: #000000;
    --accent-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --text-color: #2c3e50;
    --border-color: #bdc3c7;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f8f9fa;
}

.container {
    max-width: 1900px;
    max-height: 95vh;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 2rem;
}

.logo img {
    height: 70px;
    /* Ajustez la taille du logo si nécessaire */
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 200;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 20px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Dropdown submenu for nav items */
.nav-item-dropdown { position: relative; }
.nav-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    /* Same background as header/menu for visual consistency */
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 8px 6px;
    border-radius: 8px;
    min-width: 180px;
    /* Slightly lighter shadow to match header elevation */
    box-shadow: var(--shadow);
    z-index: 1100;
}
.nav-submenu li { list-style: none; }
.nav-submenu a { display: block; padding: 8px 12px; color: white; text-decoration: none; border-radius:6px; }
.nav-submenu a:hover { background: rgba(255,255,255,0.12); }
.nav-item-dropdown:hover > .nav-submenu { display: block; }

/* Make submenu visible on focus for keyboard users */
.nav-item-dropdown:focus-within > .nav-submenu { display:block; }

/* Also support toggling via JS by adding .open */
.nav-item-dropdown.open > .nav-submenu { display: block; }

/* Types UI removed: styles previously for header banner and inline indicators */

/* Main content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notification-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    transition: var(--transition);
}

.notification-status.active {
    background: #d4edda;
    border-color: var(--success-color);
    color: var(--success-color);
}

.notification-status.inactive {
    background: #f8d7da;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.notification-status i {
    font-size: 0.9rem;
}

.notification-status.active i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.section-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Boutons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    text-align: center;
}

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

.btn-primary:hover {
    background-color: #bf4f36;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(211, 84, 0, 0.3);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-color);
}

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

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

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

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

.btn-small {
    padding: 6px 12px;
    font-size: 0.9rem;
}

/* Auto Sync Indicator */
.auto-sync-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #27ae60;
    color: white;
    margin-right: 10px;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.auto-sync-indicator.syncing {
    background-color: #3498db;
    opacity: 1;
    animation: pulse 1.5s ease-in-out infinite;
}

.auto-sync-indicator.offline {
    background-color: #95a5a6;
    opacity: 0.5;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

.section-actions {
    display: flex;
    align-items: center;
}

/* Dashboard */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-card:nth-child(1) .stat-icon { background-color: var(--primary-color); }
.stat-card:nth-child(2) .stat-icon { background-color: var(--success-color); }
.stat-card:nth-child(3) .stat-icon { background-color: var(--warning-color); }
.stat-card:nth-child(4) .stat-icon { background-color: var(--secondary-color); }

.stat-info h3 {
    font-size: 2rem;
    color: var(--text-color);
    margin-bottom: 5px;
}

.stat-info p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.dashboard-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.recent-activities,
.quick-actions {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.recent-activities h3,
.quick-actions h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.quick-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Barre de recherche */
.search-bar {
    position: relative;
    margin-bottom: 2rem;
}

.search-bar input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.1);
}

/* Notes de frais styles */
.notes-frais .data-table { width:100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; }
.notes-frais .data-table th, .notes-frais .data-table td { padding: 10px 12px; border-bottom: 1px solid #f1f1f1; text-align: left; }
.notes-frais .data-table tbody tr:hover { background: #fafafa; }
.notes-frais .modal .modal-content { max-width: 720px; }

.data-table .btn { margin-left: 6px; }

/* Small adjustments for notes-frais table columns */
#notes-frais .data-table th, #notes-frais .data-table td { font-size: 0.95rem; }
#notes-frais .data-table td.text-right { white-space: nowrap; }

.search-bar i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--border-color);
}

/* Filtres */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filters select,
.filters input {
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

/* Tableaux */
table {
    width: 100%;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border-collapse: collapse;
}

th,
td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

tr:hover {
    background-color: #f8f9fa;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--danger-color);
}

/* Formulaires */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

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

input,
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Statistiques */
.stats-controls {
    display: flex;
    gap: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

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

.stats-card h3 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    text-align: center;
}

.stats-card.full-width {
    grid-column: 1 / -1;
}

.stats-card .stats-subtitle {
    text-align: center;
    color: #666;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}

/* Limiter la hauteur du graphique CA */
.stats-card canvas {
    max-height: 400px !important;
    height: 400px !important;
}

#chiffre-affaires-chart {
    max-height: 600px !important;
    height: 600px !important;
}

.evolution-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.evolution-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
}

.evolution-item .label {
    font-weight: 500;
}

/* Badges de statut */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
}
.status-icon { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 12px; color: #fff; font-weight: 600; }
.status-icon i { margin-right: 6px; }
.status-brouillon { background: #6c757d; }
.status-envoye { background: #17a2b8; }
.status-paye { background: #28a745; }
.status-annulee { background: #ffebee; }

.status-planifiee {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status-en-cours {
    background-color: #fff3e0;
    color: #f57c00;
}

.status-terminee {
    background-color: #e8f5e8;
    color: #388e3c;
}

.status-annulee {
    background-color: #ffebee;
    color: #d32f2f;
}

/* Badge d'heure */
.time-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: monospace;
}

/* Footer */
footer {
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .dashboard-content {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th,
    td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

/* Animations et transitions */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Administration */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Grid used by the dedicated types section - match administration layout */
.types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.admin-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.admin-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem;
}

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

.card-description {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

.smtp-config, .email-templates, .backup-actions {
    padding: 2rem;
}

/* Configuration SMTP */
.smtp-provider {
    margin-bottom: 2rem;
}

.provider-buttons {
    display: flex;
    gap: 10px;
    margin-top: 1rem;
}

.btn-provider {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-provider:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

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

.password-field {
    position: relative;
}

.btn-toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--border-color);
    cursor: pointer;
    padding: 5px;
}

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

.smtp-status {
    margin-top: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: var(--border-radius);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator.status-not-configured i {
    color: var(--border-color);
}

.status-indicator.status-configured i {
    color: var(--warning-color);
}

.status-indicator.status-tested i {
    color: var(--success-color);
}

/* Modèles d'email */
.template-selector {
    margin-bottom: 1.5rem;
}

.email-preview {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin: 1rem 0;
}

.email-header {
    background: white;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.email-body {
    padding: 1rem;
}

.email-body pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: inherit;
}

/* Paramètres généraux */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    padding-left: 35px;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: var(--transition);
}

.checkbox-label:hover .checkmark {
    border-color: var(--primary-color);
}

.checkbox-label input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label input:checked ~ .checkmark:after {
    display: block;
}

/* Rappels automatiques */
.reminder-settings {
    margin-top: 10px;
}

.reminder-timing {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.form-col {
    display: flex;
    flex-direction: column;
}

.form-col label {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.form-col input[type="time"],
.form-col select {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.form-help {
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 4px;
}

/* Google Calendar */
.google-calendar-settings {
    margin-top: 10px;
}

.google-calendar-config {
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.google-auth-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.google-auth-section h4 {
    margin-bottom: 10px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    background: white;
    border: 1px solid #dee2e6;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-connected {
    background-color: var(--success-color);
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2);
}

.status-disconnected {
    background-color: var(--danger-color);
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.status-pending {
    background-color: var(--warning-color);
    box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.calendar-selection {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.calendar-selection label {
    margin-bottom: 8px;
}

.calendar-selection .btn {
    margin-left: 10px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.sync-options {
    margin-bottom: 15px;
}

.sync-options h4 {
    margin-bottom: 10px;
    color: var(--text-color);
    font-size: 1rem;
}

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

.sync-actions .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

/* Sauvegarde et restauration */
.backup-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #dee2e6;
}

.backup-section:last-child {
    border-bottom: none;
}

.backup-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.export-buttons, .system-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.import-area {
    padding: 1rem;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
}

.import-area:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

.form-help {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 5px;
    display: block;
}

.form-help.text-danger {
    color: var(--danger-color);
}

/* Responsive pour administration */
@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .provider-buttons {
        flex-direction: column;
    }
    
    .export-buttons, .system-buttons {
        flex-direction: column;
    }
    
    .smtp-config, .email-templates, .backup-actions {
        padding: 1.5rem;
    }
}

/* Utilitaires */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }

.hidden { display: none; }
.visible { display: block; }

/* Loading spinner */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styles pour le Planning/Calendrier */
.view-selector {
    display: flex;
    gap: 5px;
}

.calendar-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--light-color);
    border-bottom: 1px solid var(--border-color);
}

.calendar-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.calendar-grid {
    padding: 1rem;
}

/* Vue mensuelle */
.month-view {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
}

.calendar-day-header {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.calendar-day {
    background: white;
    min-height: 120px;
    padding: 0.5rem;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.calendar-day:hover {
    background: #f8f9fa;
}

.calendar-day.other-month {
    background: #f8f9fa;
    color: #999;
}

.calendar-day.today {
    background: rgba(211, 84, 0, 0.1);
    border: 2px solid var(--primary-color);
}

.day-number {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.prestations-list {
    font-size: 0.8rem;
}

.prestation-item {
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    margin: 1px 0;
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--transition);
}

.prestation-item:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

.prestation-item.status-planifiee {
    background: var(--primary-color);
}

.prestation-item.status-en-cours {
    background: var(--warning-color);
}

.prestation-item.status-terminee {
    background: var(--success-color);
}

.prestation-item.status-annulee {
    background: var(--danger-color);
}

/* Vue semaine */
.week-view {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
}

.time-slot {
    background: var(--light-color);
    padding: 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-color);
}

.week-day {
    background: white;
    min-height: 60px;
    padding: 0.25rem;
    position: relative;
}

.week-day-header {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.week-day-header.has-sector {
    border-bottom: 4px solid;
}

.week-day-header .week-day-name {
    font-weight: 600;
}

.week-day-header .sector-badge.week-sector {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

/* Légende */
.legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.legend-color.status-planifiee {
    background: var(--primary-color);
}

.legend-color.status-en-cours {
    background: var(--warning-color);
}

.legend-color.status-terminee {
    background: var(--success-color);
}

.legend-color.status-annulee {
    background: var(--danger-color);
}

/* Modal détails prestation */
#prestation-details-content {
    padding: 1rem 0;
}

.detail-row {
    display: flex;
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

.detail-label {
    font-weight: 600;
    width: 120px;
    color: var(--primary-color);
}

.detail-value {
    flex: 1;
}

/* Styles pour les secteurs */
.modal-large {
    width: 90%;
    max-width: 900px;
}

.sector-assignment-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin: 1rem 0;
}

.sector-form {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.sector-assignments-list {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.sector-assignments-table {
    max-height: 300px;
    overflow-y: auto;
}

.sector-assignment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.sector-legend {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.sector-colors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.sector-color-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
}

.sector-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #ddd;
}

.sector-centre-ville {
    background: #e3f2fd;
    border-color: #1976d2;
}

.sector-nord {
    background: #f3e5f5;
    border-color: #7b1fa2;
}

.sector-sud {
    background: #fff3e0;
    border-color: #f57c00;
}

.sector-est {
    background: #e8f5e8;
    border-color: #388e3c;
}

.sector-ouest {
    background: #ffebee;
    border-color: #d32f2f;
}

.sector-peripherie {
    background: #f1f8e9;
    border-color: #689f38;
}

/* Indicateurs de secteur dans le calendrier */
.calendar-day.has-sector {
    border-top: 4px solid;
}

.calendar-day.has-sector.sector-centre-ville {
    border-top-color: #1976d2;
}

.calendar-day.has-sector.sector-nord {
    border-top-color: #7b1fa2;
}

.calendar-day.has-sector.sector-sud {
    border-top-color: #f57c00;
}

.calendar-day.has-sector.sector-est {
    border-top-color: #388e3c;
}

.calendar-day.has-sector.sector-ouest {
    border-top-color: #d32f2f;
}

.calendar-day.has-sector.sector-peripherie {
    border-top-color: #689f38;
}

.sector-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    margin-bottom: 2px;
}

.sector-badge.sector-centre-ville {
    background: #1976d2;
}

.sector-badge.sector-nord {
    background: #7b1fa2;
}

.sector-badge.sector-sud {
    background: #f57c00;
}

.sector-badge.sector-est {
    background: #388e3c;
}

.sector-badge.sector-ouest {
    background: #d32f2f;
}

.sector-badge.sector-peripherie {
    background: #689f38;
}

/* Responsivité calendrier */
@media (max-width: 768px) {
    .calendar-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .calendar-day {
        min-height: 80px;
        font-size: 0.8rem;
    }
    
    .prestation-item {
        font-size: 0.7rem;
        padding: 1px 4px;
    }
    
    .legend {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .modal-large {
        width: 95%;
    }
    
    .sector-colors {
        grid-template-columns: 1fr;
    }
}

/* ========== STYLES CHARGES ========== */

.category-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: white;
}

.category-urssaf { background-color: #e74c3c; }
.category-entretien { background-color: #3498db; }
.category-carburant { background-color: #f39c12; }
.category-assurance { background-color: #9b59b6; }
.category-consommables { background-color: #2ecc71; }
.category-materiel { background-color: #34495e; }
.category-formation { background-color: #1abc9c; }
.category-telephonie { background-color: #e67e22; }
.category-comptabilite { background-color: #8e44ad; }
.category-autres { background-color: #95a5a6; }

.type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.type-fixe {
    background-color: #ecf0f1;
    color: #2c3e50;
}

.type-variable {
    background-color: #d5dbdb;
    color: #2c3e50;
}

.type-ponctuelle {
    background-color: #ffeaa7;
    color: #2d3436;
}

.charges-icon {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.month-icon {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.year-icon {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.fixed-icon {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

/* ========== STYLES FACTURES ========== */

.factures-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.summary-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.summary-card.pending {
    border-left: 4px solid var(--warning-color);
}

.summary-card.overdue {
    border-left: 4px solid var(--danger-color);
}

.summary-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.summary-card.pending .summary-icon {
    background: var(--warning-color);
}

.summary-card.overdue .summary-icon {
    background: var(--danger-color);
}

.summary-info h3 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-color);
}

.summary-info p {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 0.9rem;
}

.factures-table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.factures-table th {
    background: var(--primary-color);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.factures-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.factures-table tr:hover {
    background-color: #f8f9fa;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-badge.draft {
    background: #e3f2fd;
    color: #1976d2;
}

.status-badge.sent {
    background: #fff3e0;
    color: #f57c00;
}

.status-badge.paid {
    background: #e8f5e8;
    color: #2e7d32;
}

.status-badge.cancelled {
    background: #ffebee;
    color: #d32f2f;
}

.text-danger {
    color: var(--danger-color);
    margin-left: 5px;
}

.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.facture-totaux {
    background: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 20px 0;
}

.totaux-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.totaux-line.total {
    border-bottom: none;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color);
    border-top: 2px solid var(--primary-color);
    margin-top: 10px;
    padding-top: 15px;
}

.prestations-a-facturer {
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 15px;
    margin: 10px 0;
    min-height: 60px;
}

.selected-prestation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 10px;
}

.prestation-details {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-grow: 1;
}

.prestation-details .prix {
    font-weight: bold;
    color: var(--success-color);
}

.prestations-selector {
    max-height: 400px;
    overflow-y: auto;
}

.filter-prestations {
    margin-bottom: 15px;
}

.filter-prestations input {
    width: 100%;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
}

.prestations-disponibles {
    max-height: 300px;
    overflow-y: auto;
}

.prestation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 8px;
    background: white;
    transition: var(--transition);
}

.prestation-item:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.prestation-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prestation-date {
    font-size: 0.9rem;
    color: #666;
}

.prestation-prix {
    font-weight: bold;
    color: var(--success-color);
}

.no-prestations {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 30px;
}

/* Responsivité factures */
@media (max-width: 768px) {
    .factures-summary {
        grid-template-columns: 1fr;
    }
    
    .factures-table-container {
        overflow-x: auto;
    }
    
    .factures-table {
        min-width: 800px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .prestation-details {
        flex-direction: column;
        gap: 5px;
        align-items: flex-start;
    }
    
    .selected-prestation {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
}

/* Styles pour les types de prestation */
.prestation-types-banner-container {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.prestation-types-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.prestation-types-banner .empty {
    color: var(--text-color);
    font-style: italic;
    opacity: 0.7;
}

.type-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    user-select: none;
}

.type-pill:hover {
    border-color: var(--primary-color);
    background: var(--light-color);
    transform: translateY(-1px);
}

.type-pill.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.type-pill .badge-key {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    font-family: monospace;
    font-size: 0.75rem;
}

.type-pill.active .badge-key {
    background: rgba(255, 255, 255, 0.3);
}

.prestation-types-inline {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
    align-items: center;
}

.type-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.type-dot:hover {
    transform: scale(1.2);
}

.type-dot.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 5px rgba(243, 156, 18, 0.5);
}

.type-dot.small {
    width: 6px;
    height: 6px;
}

/* Styles pour la section types de prestation */
#prestation-types {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

#prestation-types .section-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.prestation-types-content {
    min-height: 300px;
}

.prestation-types-list {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

#prestation-types-main-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

#prestation-types-main-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

#prestation-types-main-table th,
#prestation-types-main-table td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

#prestation-types-main-table tbody tr {
    transition: background-color 0.2s ease;
}

#prestation-types-main-table tbody tr:hover {
    background-color: #f8f9fa;
}

#prestation-types-main-table tbody tr:last-child td {
    border-bottom: none;
}

.type-key {
    font-family: 'Courier New', monospace;
    background: #f1f3f4;
    padding: 4px 8px;
    border-radius: 4px;
    color: #333;
    font-size: 0.9rem;
}

.type-label {
    font-weight: 500;
    color: var(--text-color);
}

.type-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    min-width: auto;
}

/* Styles pour le tableau vide */
#prestation-types-main-table .text-center {
    text-align: center;
    padding: 40px 20px;
}

#prestation-types-main-table .text-center p {
    color: #666;
    margin-bottom: 15px;
    font-size: 1rem;
}

/* Amélioration des styles du modal pour les types de prestation */
#prestation-type-modal .modal-content {
    max-width: 600px;
}

#prestation-type-modal .form-help {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

#prestation-type-modal .form-group {
    margin-bottom: 20px;
}

#prestation-type-modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    #prestation-type-modal .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .type-pill {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    .prestation-types-banner {
        justify-content: center;
    }
    
    .type-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .btn-small {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    #prestation-types-main-table th,
    #prestation-types-main-table td {
        padding: 10px 8px;
        font-size: 0.9rem;
    }
}

/* Styles pour le module Comptabilité et ses sous-modules */
.nav-item-dropdown {
    position: relative;
}

.nav-item-dropdown .dropdown-arrow {
    font-size: 0.8rem;
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.nav-item-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    min-width: 200px;
    z-index: 1000;
    padding: 8px 0;
    margin-top: 4px;
}

.nav-item-dropdown.open .nav-submenu {
    display: block;
}

.nav-sublink {
    display: block;
    padding: 10px 16px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
}

.nav-sublink:hover {
    background-color: var(--light-color);
}

.section-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.comptabilite-tab {
    border: 2px solid var(--border-color);
    background: white;
    color: var(--text-color);
    font-size: 0.9rem;
    padding: 8px 16px;
    transition: var(--transition);
}

.comptabilite-tab:hover {
    background: var(--light-color);
    border-color: var(--primary-color);
}

.comptabilite-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.comptabilite-submodule {
    display: none;
    margin-top: 20px;
}

.comptabilite-submodule.active {
    display: block;
}

.submodule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.submodule-header h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin: 0;
}

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

@media (max-width: 768px) {
    .nav-submenu {
        position: static;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.05);
        margin-top: 8px;
        margin-left: 20px;
        border-left: 2px solid var(--primary-color);
    }
    
    .section-nav {
        flex-wrap: wrap;
    }
    
    .comptabilite-tab {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .submodule-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .submodule-header .header-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}