/* CSI Connect - Modern Styles */

/* Variables CSS - Palette Modernisée */
:root {
    /* Couleurs Primaires - Bleu Nuit Sophistiqué */
    --csi-primary: #1A237E;
    --csi-primary-dark: #0D1642;
    --csi-primary-light: #303F9F;

    /* Couleurs Secondaires */
    --csi-secondary: #64748b;

    /* Couleur d'Accent - Vert-de-gris Chic */
    --csi-accent: #8BC34A;

    /* Bouton d'Action - Bleu Standard */
    --csi-action: #007BFF;
    --csi-action-hover: #0056b3;

    /* Couleurs de Statut */
    --csi-success: #10b981;
    --csi-warning: #f59e0b;
    --csi-danger: #ef4444;

    /* Dimensions */
    --sidebar-width: 260px;
    --header-height: 72px;

    /* Arrière-plans - Gris Très Léger */
    --bg-primary: #ffffff;
    --bg-secondary: #F8F9FA;
    --bg-tertiary: #f1f5f9;

    /* Textes */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Bordures */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* Ombres Subtiles - Box Shadow Moderne */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Arrondis Modernes */
    --radius-card: 8px;
    --radius-btn: 4px;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

/* Header Styles */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.header-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--csi-primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    position: relative;
    width: 320px;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--csi-primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.user-dropdown:hover {
    background: var(--bg-secondary);
    color: inherit;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--csi-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}
.form-group .form-control.user-select-field {
    background-color: white;
    color: black;
}
/* Sidebar Styles */
.main-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 999;
    transition: transform 0.3s ease;
}

.sidebar-content {
    padding: 24px 0;
}

.sidebar-section {
    margin-bottom: 32px;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0 24px 12px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    margin: 0 12px 4px;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar-menu-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-menu-link.active {
    background: var(--csi-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.sidebar-menu-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-submenu {
    margin-left: 32px;
    margin-top: 8px;
    display: none;
}

.sidebar-submenu.show {
    display: block;
}

.sidebar-submenu-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s ease;
    margin: 2px 0;
}

.sidebar-submenu-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-submenu-link.active {
    background: var(--bg-tertiary);
    color: var(--csi-primary);
    font-weight: 500;
}

.dropdown-arrow {
    margin-left: auto;
    transition: transform 0.2s ease;
    font-size: 12px;
}

.dropdown-arrow.rotated {
    transform: rotate(90deg);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 32px;
    min-height: calc(100vh - var(--header-height));
}

/* Dashboard Components */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stats-card {
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius-card);
    padding: 24px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stats-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stats-card-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.stats-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--csi-accent);
    background: rgba(139, 195, 74, 0.1);
}

.stats-card-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.stats-card-change {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
}

.stats-card-change.positive {
    color: var(--csi-success);
}

.stats-card-change.negative {
    color: var(--csi-danger);
}

/* Chart Cards */
.chart-card {
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius-card);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.chart-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.chart-placeholder {
    height: 300px;
    background: var(--bg-secondary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius-card);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.quick-action-btn:hover {
    background: var(--csi-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.quick-action-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--csi-accent);
}

.quick-action-btn:hover .quick-action-icon {
    color: white;
}

/* Activity List */
.activity-list {
    padding: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.activity-description {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 4px;
}

.activity-time {
    color: var(--text-muted);
    font-size: 12px;
}

/* Page Header */
.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    margin: 0;
}

/* Buttons - Modernisés */
.btn-primary {
    background: var(--csi-primary);
    border-color: var(--csi-primary);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-btn);
    padding: 10px 20px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--csi-primary-dark);
    border-color: var(--csi-primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-primary {
    color: var(--csi-primary);
    border-color: var(--csi-primary);
    background: transparent;
    font-weight: 500;
    border-radius: var(--radius-btn);
    padding: 10px 20px;
    transition: all 0.2s ease;
}

.btn-outline-primary:hover {
    background: var(--csi-primary);
    border-color: var(--csi-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Bouton d'Action (pour "Créer", "Saisir", etc.) */
.btn-action {
    background: var(--csi-action);
    border-color: var(--csi-action);
    color: white;
    font-weight: 600;
    border-radius: var(--radius-btn);
    padding: 10px 20px;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: var(--csi-action-hover);
    border-color: var(--csi-action-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-outline-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Mobile Toggle */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .main-sidebar {
        transform: translateX(-100%);
    }

    .main-sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .search-box {
        width: 200px;
    }

    .user-info {
        display: none;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .sidebar-toggle {
        display: block;
    }

    .page-title {
        font-size: 24px;
    }

    .header-content {
        padding: 0 16px;
    }
}

/* Scrollbar Styling */
.main-sidebar::-webkit-scrollbar {
    width: 4px;
}

.main-sidebar::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.main-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.main-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Alerts */
.alert {
    border: none;
    border-radius: 12px;
    border-left: 4px solid;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d1fae5;
    border-left-color: var(--csi-success);
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    border-left-color: var(--csi-danger);
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    border-left-color: var(--csi-warning);
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    border-left-color: var(--csi-accent);
    color: #1e40af;
}

/* Form Controls */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--csi-primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* Tables */
.table {
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.table thead th {
    background-color: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    padding: 16px;
    border-top: none;
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    border-color: var(--border-light);
}

.table tbody tr:hover {
    background-color: var(--bg-secondary);
}

/* Badge */
.badge {
    border-radius: 20px;
    font-weight: 500;
    padding: 6px 12px;
    font-size: 12px;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-light) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--csi-primary) 0%, var(--csi-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--csi-primary) 0%, var(--csi-accent) 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, var(--csi-success) 0%, #34d399 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, var(--csi-warning) 0%, #fbbf24 100%);
}

.bg-gradient-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
}

.app-title {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--csi-primary);
    padding: 8px 24px;
    border-radius: 12px;
    margin: 0 20px;
    box-shadow: var(--shadow-md);
}

.app-title h1 {
    font-size: 20px;
    font-weight: 700;
    color: white;
    margin: 0;
    letter-spacing: 1px;
}

/* Styles pour la page prévisionnel */
.budget-input {
    transition: all 0.3s ease;
}

.budget-input:focus {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    background: #f8f9ff !important;
}

.border-left-primary {
    border-left: 4px solid #007bff !important;
}

.table thead th {
    border-top: none;
    font-weight: 600;
    font-size: 13px;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.card {
    box-shadow: var(--shadow-md);
    border: none;
    border-radius: var(--radius-card);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.alert {
    border-radius: 10px;
    border: none;
}

.btn {
    border-radius: var(--radius-btn);
    padding: 10px 25px;
    font-weight: 600;
}

/* Note: Le .btn-primary principal est déjà défini plus haut avec les bonnes couleurs */

/* Styles pour les formulaires de paie */
.form-label.required::after {
    content: " *";
    color: #dc3545;
}

.card-header.bg-light {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6;
}

/* Styles pour les ratios */
input[type="number"] {
    text-align: right;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .card-body .row {
        margin-bottom: 0.5rem;
    }

    .card-body .col-md-3,
    .card-body .col-md-4 {
        margin-bottom: 1rem;
    }
}

/* ==============================================
   STYLES MODERNISÉS POUR CARTES "ACCÈS RAPIDES"
   ============================================== */

/* Cartes d'accès rapides avec style moderne */
.access-card {
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius-card);
    padding: 24px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.access-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Icônes des cartes avec couleur d'accent */
.access-card .card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: rgba(139, 195, 74, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.access-card .card-icon i {
    font-size: 28px;
    color: var(--csi-accent);
}

/* Titre de la carte */
.access-card .card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Description de la carte */
.access-card .card-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Bouton "Accéder" dans les cartes */
.access-card .btn-access {
    background: var(--csi-primary);
    color: white;
    border: none;
    border-radius: var(--radius-btn);
    padding: 10px 20px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.access-card .btn-access:hover {
    background: var(--csi-primary-dark);
    color: white;
    transform: translateX(2px);
}

/* Badge de statut sur les cartes */
.access-card .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.access-card .status-badge.new {
    background: rgba(139, 195, 74, 0.2);
    color: var(--csi-accent);
}

.access-card .status-badge.urgent {
    background: rgba(239, 68, 68, 0.2);
    color: var(--csi-danger);
}

/* Cartes "Actions Recommandées" */
.action-card {
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius-card);
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.action-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
    background: var(--bg-secondary);
}

.action-card .action-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(139, 195, 74, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-card .action-icon i {
    font-size: 20px;
    color: var(--csi-accent);
}

.action-card .action-content {
    flex: 1;
}

.action-card .action-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.action-card .action-description {
    font-size: 12px;
    color: var(--text-muted);
}

.action-card .action-arrow {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.action-card:hover .action-arrow {
    transform: translateX(4px);
    color: var(--csi-accent);
}

/* Sections de tableau de bord */
.dashboard-section {
    margin-bottom: 32px;
}

.dashboard-section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-section-title i {
    color: var(--csi-accent);
}

/* Grille de cartes responsive */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .access-card {
        padding: 20px;
    }
}