/**
 * Dashboard BCMS - Styles spécialisés
 * Contient toutes les classes CSS pour le tableau de bord BCMS
 * @version 1.0.0
 * @date 2025-11-04
 */

/* ========================================
   DARK THEME COMPATIBILITY
   Fix text colors for dark theme with white cards
   ======================================== */

/* Keep dark theme background from futuristic-dark-theme.css */
/* But override text colors ONLY on white containers for readability */

/* ========================================
   STAT MINI CARDS (Statistiques en haut)
   ======================================== */

.stat-mini {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.stat-mini::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: currentColor;
}

.stat-mini.primary { color: #0d6efd; border-left: 4px solid #0d6efd; }
.stat-mini.danger { color: #dc3545; border-left: 4px solid #dc3545; }
.stat-mini.success { color: #198754; border-left: 4px solid #198754; }
.stat-mini.warning { color: #ffc107; border-left: 4px solid #ffc107; }
.stat-mini.info { color: #0dcaf0; border-left: 4px solid #0dcaf0; }
.stat-mini.secondary { color: #6c757d; border-left: 4px solid #6c757d; }

.stat-mini-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.stat-mini-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50 !important;
    margin: 0.5rem 0;
}

.stat-mini-label {
    font-size: 0.85rem;
    color: #6c757d !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   MODULE CARDS (Cartes des modules)
   ======================================== */

.module-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
    border-color: #667eea;
}

.module-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.module-icon {
    font-size: 2.5rem;
    color: #667eea !important;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
}

.module-icon i {
    color: #667eea !important;
}

.module-info {
    flex: 1;
}

.module-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50 !important;
    margin: 0;
    margin-bottom: 0.25rem;
}

.module-subtitle {
    font-size: 0.85rem;
    color: #6c757d !important;
    margin: 0;
}

.module-health {
    font-size: 2rem;
    font-weight: 700;
    color: #28a745 !important;
    margin-left: auto;
}

.module-health.warning {
    color: #ffc107 !important;
}

.module-health.danger {
    color: #dc3545 !important;
}

.module-stats {
    display: flex;
    justify-content: space-around;
    margin: 1.5rem 0;
    padding: 1rem 0;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.module-stat {
    text-align: center;
    flex: 1;
}

.module-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c3e50 !important;
    display: block;
}

.module-stat-label {
    font-size: 0.75rem;
    color: #6c757d !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-top: 0.25rem;
}

.module-progress {
    margin-top: 1rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: #6c757d !important;
}

.progress-label strong {
    color: #2c3e50 !important;
}

.module-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.module-link {
    color: #667eea !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.module-link:hover {
    color: #764ba2 !important;
    transform: translateX(3px);
}

.module-link i {
    transition: transform 0.3s ease;
}

.module-link:hover i {
    transform: translateX(3px);
}

/* ========================================
   EXECUTIVE SUMMARY (Résumé exécutif)
   ======================================== */

.executive-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.executive-summary h2 {
    color: white;
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.executive-summary p {
    opacity: 0.95;
    line-height: 1.6;
}

/* Fix for stat-mini inside executive-summary (prevent white on white) */
.executive-summary .stat-mini {
    color: inherit;
}

.executive-summary .stat-mini-value {
    color: #2c3e50 !important;
}

.executive-summary .stat-mini-label {
    color: #6c757d !important;
}

.executive-summary .stat-mini-icon {
    color: inherit;
}

/* Ensure icons in colored stat-mini keep their parent color */
.stat-mini.primary .stat-mini-icon i {
    color: #0d6efd !important;
}

.stat-mini.danger .stat-mini-icon i {
    color: #dc3545 !important;
}

.stat-mini.success .stat-mini-icon i {
    color: #198754 !important;
}

.stat-mini.warning .stat-mini-icon i {
    color: #ffc107 !important;
}

.stat-mini.info .stat-mini-icon i {
    color: #0dcaf0 !important;
}

.stat-mini.secondary .stat-mini-icon i {
    color: #6c757d !important;
}

/* ========================================
   BCMS HEALTH SCORE (Score de santé)
   ======================================== */

.bcms-health-score {
    text-align: center;
    background: rgba(255,255,255,0.15);
    padding: 1.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

/* bcms-health-score inside executive-summary should have WHITE text */
.executive-summary .bcms-health-score,
.executive-summary .bcms-health-score *,
.executive-summary .health-score-label,
.executive-summary .health-score-value,
.executive-summary .health-score-trend,
.executive-summary .health-score-trend span,
.executive-summary .health-score-trend i {
    color: white !important;
}

.health-score-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.health-score-value {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
    line-height: 1;
}

.health-score-trend {
    font-size: 0.85rem;
    opacity: 0.8;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.health-score-trend i {
    font-size: 1rem;
}

/* ========================================
   CHARTS (Graphiques)
   ======================================== */

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.chart-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50 !important;
    margin: 0;
}

.chart-filter {
    display: flex;
    gap: 0.5rem;
}

.chart-filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e9ecef;
    background: white;
    color: #6c757d !important;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.chart-filter-btn:hover {
    border-color: #667eea;
    color: #667eea !important;
}

.chart-filter-btn.active {
    background: #667eea;
    color: white !important;
    border-color: #667eea;
}

/* Fix for headings inside chart-container */
.chart-container h5,
.chart-container h4,
.chart-container h3 {
    color: #2c3e50 !important;
}

/* Preserve Bootstrap text color utilities inside containers */
.chart-container .text-danger,
.module-card .text-danger {
    color: #dc3545 !important;
}

.chart-container .text-success,
.module-card .text-success {
    color: #198754 !important;
}

.chart-container .text-warning,
.module-card .text-warning {
    color: #ffc107 !important;
}

.chart-container .text-info,
.module-card .text-info {
    color: #0dcaf0 !important;
}

.chart-container .text-primary,
.module-card .text-primary {
    color: #0d6efd !important;
}

/* Fix for Bootstrap utility classes inside white containers */
.chart-container .text-muted,
.module-card .text-muted,
.stat-mini .text-muted,
.alert-card .text-muted {
    color: #6c757d !important;
}

.chart-container .fw-bold,
.module-card .fw-bold,
.alert-card .fw-bold {
    color: #2c3e50 !important;
}

.chart-container small,
.alert-card small {
    color: #6c757d !important;
}

/* ========================================
   ALERT CARDS (Alertes critiques)
   ======================================== */

.alert-card {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.alert-card:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
}

.alert-card.critical {
    border-left-color: #dc3545;
}

.alert-card.warning {
    border-left-color: #ffc107;
}

.alert-card.info {
    border-left-color: #0dcaf0;
}

.alert-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.alert-card.critical .alert-icon {
    color: #dc3545 !important;
    background: rgba(220, 53, 69, 0.1);
}

.alert-card.critical .alert-icon i {
    color: #dc3545 !important;
}

.alert-card.warning .alert-icon {
    color: #ffc107 !important;
    background: rgba(255, 193, 7, 0.1);
}

.alert-card.warning .alert-icon i {
    color: #ffc107 !important;
}

.alert-card.info .alert-icon {
    color: #0dcaf0 !important;
    background: rgba(13, 202, 240, 0.1);
}

.alert-card.info .alert-icon i {
    color: #0dcaf0 !important;
}

/* Icons with inline styles should keep their inline color */
.alert-icon[style*="color:"] i {
    color: inherit !important;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: #2c3e50 !important;
    margin-bottom: 0.25rem;
}

.alert-time {
    font-size: 0.75rem;
    color: #6c757d !important;
}

/* ========================================
   QUICK ACTIONS (Actions rapides)
   ======================================== */

.quick-action {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    cursor: pointer;
}

.quick-action:hover {
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    border-color: #667eea;
    text-decoration: none;
}

.quick-action-icon {
    font-size: 1.5rem;
    color: #667eea !important;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
}

.quick-action-icon i {
    color: inherit;
}

/* For icons with inline styles (gradient backgrounds) */
.quick-action-icon i.text-white {
    color: white !important;
}

/* Elements with inline style backgrounds (gradients, etc.) should have WHITE text */
.quick-action [style*="background: var(--gradient"],
.quick-action-icon[style*="background: var(--gradient"] {
    color: white !important;
}

.quick-action [style*="background: var(--gradient"] i,
.quick-action-icon[style*="background: var(--gradient"] i {
    color: white !important;
}

.quick-action-content {
    flex: 1;
}

.quick-action-title {
    font-weight: 600;
    color: #2c3e50 !important;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.quick-action-desc {
    font-size: 0.75rem;
    color: #6c757d !important;
    margin: 0;
}

/* ========================================
   ACTIVITY ITEMS (Activités récentes)
   ======================================== */

.activity-item {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
    position: relative;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 10px;
    height: 10px;
    background: #667eea;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #667eea;
}

.activity-time {
    font-size: 0.75rem;
    color: #6c757d !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    display: block;
}

.activity-title {
    font-weight: 500;
    color: #2c3e50 !important;
    margin-bottom: 0.25rem;
}

.activity-desc {
    font-size: 0.85rem;
    color: #6c757d !important;
}

/* ========================================
   BCMS TIMELINE (Timeline)
   ======================================== */

.bcms-timeline {
    position: relative;
    padding-left: 2rem;
}

.bcms-timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
}

/* ========================================
   SECTION TITLE (Titres de section)
   ======================================== */

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50 !important;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-title i {
    color: #667eea !important;
}

/* CRITICAL: Override futuristic-dark-theme global white text on white containers */
/* The dark theme has: p, span, div, label, a, li, td, th, small, i, em, strong, b { color: #ffffff !important } */
/* We need HIGHER specificity to override it on white containers ONLY (not on dark backgrounds) */

/* But first, ensure executive-summary text stays WHITE on gradient background */
.executive-summary h1,
.executive-summary h2,
.executive-summary h3,
.executive-summary h4,
.executive-summary h5,
.executive-summary h6,
.executive-summary h1 i,
.executive-summary h2 i,
.executive-summary h3 i,
.executive-summary h4 i,
.executive-summary h5 i,
.executive-summary h6 i,
.executive-summary p:not(.stat-mini p),
.executive-summary span:not(.stat-mini span):not(.stat-mini-value):not(.stat-mini-label),
.executive-summary div:not(.stat-mini):not(.stat-mini-value):not(.stat-mini-label):not(.stat-mini-icon),
.executive-summary label:not(.stat-mini label) {
    color: white !important;
}

/* stat-mini cards are WHITE backgrounds inside executive-summary, so they need DARK text */
.stat-mini p,
.stat-mini span,
.stat-mini div,
.stat-mini label,
.stat-mini small,
.stat-mini strong,
.stat-mini b {
    color: #2c3e50 !important;
}

.module-card p,
.module-card span,
.module-card div,
.module-card label,
.module-card small,
.module-card strong,
.module-card b {
    color: #2c3e50 !important;
}

.chart-container p,
.chart-container span,
.chart-container div,
.chart-container label,
.chart-container small,
.chart-container strong,
.chart-container b {
    color: #2c3e50 !important;
}

.alert-card p,
.alert-card span,
.alert-card div,
.alert-card label,
.alert-card small,
.alert-card strong,
.alert-card b {
    color: #2c3e50 !important;
}

.quick-action p,
.quick-action span,
.quick-action div,
.quick-action label,
.quick-action small,
.quick-action strong,
.quick-action b {
    color: #2c3e50 !important;
}

/* Links inside white containers */
.module-card a:not(.btn),
.chart-container a:not(.btn),
.quick-action a:not(.btn) {
    color: #667eea !important;
}

/* Preserve muted text */
.stat-mini .text-muted,
.module-card .text-muted,
.chart-container .text-muted,
.alert-card .text-muted {
    color: #6c757d !important;
}

/* Table elements inside white containers */
.chart-container td,
.chart-container th,
.module-card td,
.module-card th {
    color: #2c3e50 !important;
}

.chart-container li,
.module-card li {
    color: #2c3e50 !important;
}

/* Exception: Icons should inherit color from parent */
.stat-mini i,
.module-card i,
.chart-container i,
.alert-card i,
.quick-action i {
    color: inherit;
}

/* Elements with dark backgrounds inside white containers should have WHITE text */
.module-card .bg-primary,
.module-card .bg-dark,
.module-card .bg-secondary,
.module-card .badge,
.module-card .btn,
.chart-container .bg-primary,
.chart-container .bg-dark,
.chart-container .bg-secondary,
.chart-container .badge,
.chart-container .btn {
    color: white !important;
}

.module-card .bg-primary *,
.module-card .bg-dark *,
.chart-container .bg-primary *,
.chart-container .bg-dark * {
    color: white !important;
}

/* Progress bars should keep their text white */
.module-card .progress-bar,
.chart-container .progress-bar,
.module-card .progress-bar * {
    color: white !important;
}

/* Buttons inside white containers */
.module-card .btn,
.chart-container .btn,
.alert-card .btn,
.quick-action .btn {
    color: white !important;
}

/* Fix for flex-grow utility inside alert-card */
.alert-card .flex-grow-1 {
    color: inherit;
}

.alert-card .flex-grow-1 .fw-bold {
    color: #2c3e50 !important;
}

.alert-card .flex-grow-1 small {
    color: #6c757d !important;
}

/* ========================================
   TENANT BADGE (Badge tenant)
   ======================================== */

.tenant-badge-inline {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
}

.tenant-badge-inline i {
    font-size: 1rem;
}

/* tenant-badge-inline inside executive-summary should have WHITE text */
.executive-summary .tenant-badge-inline,
.executive-summary .tenant-badge-inline span,
.executive-summary .tenant-badge-inline i {
    color: white !important;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .stat-mini {
        padding: 1rem;
    }

    .stat-mini-icon {
        font-size: 1.5rem;
    }

    .stat-mini-value {
        font-size: 1.5rem;
    }

    .module-card {
        padding: 1rem;
    }

    .module-icon {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }

    .module-title {
        font-size: 1.1rem;
    }

    .module-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .health-score-value {
        font-size: 2.5rem;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.badge-status {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-status.active {
    background: rgba(25, 135, 84, 0.1);
    color: #198754 !important;
}

.badge-status.pending {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107 !important;
}

.badge-status.inactive {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d !important;
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

.pulse {
    animation: pulse 2s ease infinite;
}
