/* ==============================================
   SUPERADMIN - PILOTAGE DU LOGICIEL
   ============================================== */

/* --- Onglets de navigation --- */
.pilotage-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
    border-bottom: 1px solid var(--clr-border);
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.pilotage-tabs::-webkit-scrollbar {
    height: 3px;
}

.pilotage-tabs::-webkit-scrollbar-thumb {
    background: var(--clr-blue);
    border-radius: 10px;
}

.pilotage-tab {
    padding: 0.7rem 1.5rem;
    border-radius: 30px;
    background: transparent;
    color: var(--clr-text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.pilotage-tab:hover {
    background: var(--clr-bg-primary);
    color: var(--clr-text-primary);
}

.pilotage-tab.active {
    background: var(--clr-blue);
    color: white;
}

.pilotage-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.pilotage-tab-content.active {
    display: block;
}

/* --- Alertes urgentes --- */
.urgent-alerts-section {
    background: var(--clr-bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 2rem 0;
    border: 1px solid var(--clr-border);
    box-shadow: var(--clr-shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alerts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1rem;
}

.alert-card {
    display: flex;
    gap: 1rem;
    padding: 1.2rem;
    background: var(--clr-bg-primary);
    border-radius: 12px;
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.alert-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.alert-card.critical {
    border-left-color: #ef4444;
}

.alert-card.warning {
    border-left-color: #f59e0b;
}

.alert-card.info {
    border-left-color: #0284c7;
}

.alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.alert-card.critical .alert-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.alert-card.warning .alert-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.alert-card.info .alert-icon {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
}

.alert-content {
    flex: 1;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.alert-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.alert-time {
    font-size: 0.75rem;
    color: var(--clr-text-secondary);
}

.alert-content p {
    font-size: 0.85rem;
    color: var(--clr-text-secondary);
    margin-bottom: 0.8rem;
}

.alert-actions {
    display: flex;
    gap: 0.5rem;
}

/* --- Cartes établissements --- */
.etablissements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.2rem;
    margin: 1.5rem 0;
}

.etablissement-card {
    background: var(--clr-bg-secondary);
    border-radius: 16px;
    padding: 1.2rem;
    box-shadow: var(--clr-shadow);
    border: 1px solid var(--clr-border);
    position: relative;
    transition: all 0.3s ease;
}

.etablissement-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-color: var(--clr-blue);
}

.etablissement-card.alert {
    border: 2px solid #ef4444;
}

.etablissement-card.trial {
    border: 2px solid #f59e0b;
}

.card-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-active {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.status-warning {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.status-trial {
    background: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.etablissement-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--clr-blue), #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.etablissement-info {
    flex: 1;
}

.etablissement-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.etablissement-info p {
    font-size: 0.85rem;
    color: var(--clr-text-secondary);
}

.etablissement-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin: 1rem 0;
    padding: 0.8rem 0;
    border-top: 1px solid var(--clr-border);
    border-bottom: 1px solid var(--clr-border);
}

.etablissement-stats .stat {
    text-align: center;
}

.etablissement-stats .stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--clr-blue);
}

.etablissement-stats .stat-label {
    font-size: 0.7rem;
    color: var(--clr-text-secondary);
}

.etablissement-details p {
    margin: 0.3rem 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.etablissement-details i {
    width: 18px;
    color: var(--clr-blue);
}

.alert-message {
    color: #ef4444 !important;
    font-weight: 500;
}

.card-footer {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--clr-border);
}

.progress-text {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--clr-text-secondary);
}

/* --- Statistiques abonnements --- */
.subscription-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    background: var(--clr-bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--clr-border);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.stat-icon.blue { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #34d399); }
.stat-icon.yellow { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }

.stat-content {
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--clr-text-secondary);
}

/* --- Ligne d'avertissement dans tableau --- */
.warning-row {
    background: rgba(245, 158, 11, 0.05);
}

.warning-row:hover {
    background: rgba(245, 158, 11, 0.1) !important;
}

/* --- Graphique revenus --- */
.revenue-chart-section {
    background: var(--clr-bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid var(--clr-border);
}

.revenue-chart-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-container {
    height: 300px;
    position: relative;
}

/* --- Santé système --- */
.system-status-card {
    background: var(--clr-bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--clr-border);
}

.status-global {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.status-icon {
    width: 70px;
    height: 70px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.status-icon.success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.status-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.status-info p {
    color: var(--clr-text-secondary);
}

.system-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--clr-bg-secondary);
    border-radius: 12px;
    padding: 1.2rem;
    border: 1px solid var(--clr-border);
}

.metric-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    color: var(--clr-text-secondary);
}

.metric-header i {
    font-size: 1.2rem;
    color: var(--clr-blue);
}

.metric-value {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* --- Services --- */
.services-section {
    background: var(--clr-bg-secondary);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--clr-border);
}

.services-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.services-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.service-item {
    padding: 1rem;
    background: var(--clr-bg-primary);
    border-radius: 8px;
    border-left: 4px solid #10b981;
}

.service-item.warning {
    border-left-color: #f59e0b;
}

.service-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.service-info strong {
    font-size: 0.95rem;
}

.service-details {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--clr-text-secondary);
    flex-wrap: wrap;
}

.service-details i {
    margin-right: 0.3rem;
    color: var(--clr-blue);
}

/* --- Logs --- */
.logs-filters {
    margin-bottom: 1.5rem;
}

.logs-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    background: var(--clr-bg-primary);
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9rem;
}

.log-level {
    min-width: 70px;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
}

.log-level.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.log-level.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.log-level.info {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
}

.log-message {
    flex: 1;
}

.log-time {
    color: var(--clr-text-secondary);
    font-size: 0.8rem;
}

/* --- Admins système --- */
.admins-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.admins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.2rem;
}

.admin-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    background: var(--clr-bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--clr-border);
}

.admin-card img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.admin-info {
    flex: 1;
}

.admin-info h4 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.admin-info p {
    font-size: 0.8rem;
    color: var(--clr-text-secondary);
    margin: 0.2rem 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.admin-info i {
    width: 16px;
    color: var(--clr-blue);
}

.admin-actions {
    display: flex;
    gap: 0.3rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .pilotage-tabs {
        flex-wrap: nowrap;
        padding-bottom: 0.3rem;
    }
    
    .pilotage-tab {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .alerts-grid {
        grid-template-columns: 1fr;
    }
    
    .etablissements-grid {
        grid-template-columns: 1fr;
    }
    
    .subscription-stats {
        grid-template-columns: 1fr 1fr;
    }
    
    .system-metrics {
        grid-template-columns: 1fr;
    }
    
    .service-details {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .log-entry {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .log-time {
        align-self: flex-end;
    }
    
    .admin-card {
        flex-direction: column;
        text-align: center;
    }
    
    .admin-info p {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .subscription-stats {
        grid-template-columns: 1fr;
    }
    
    .alert-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .etablissement-stats {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .admins-grid {
        grid-template-columns: 1fr;
    }
}



/* ==============================================
   SUPERADMIN - MODALES ET SÉLECTION MULTIPLE
   ============================================== */

/* --- Actions batch --- */
.batch-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--clr-bg-primary);
    border: 1px solid var(--clr-blue);
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s ease;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.batch-info {
    font-size: 0.95rem;
    font-weight: 600;
}

.batch-info span {
    color: var(--clr-blue);
    font-size: 1.2rem;
    margin-right: 0.3rem;
}

.batch-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* --- Checkbox sur les cartes --- */
.etablissement-card {
    position: relative;
}

.card-checkbox {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 5;
}

.card-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--clr-blue);
}

.etablissement-card.selected {
    border: 2px solid var(--clr-blue);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.3);
}

/* --- Modales améliorées --- */
.modal-xl {
    max-width: 1000px !important;
    width: 95%;
}

.details-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--clr-border);
}

.details-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--clr-blue), #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: white;
}

.details-title {
    flex: 1;
}

.details-title h2 {
    font-size: 1.5rem;
    margin-bottom: 0.3rem;
}

.details-tabs {
    margin-top: 1.5rem;
}

.tab-content {
    padding: 1.5rem 0;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stats-cards .stat-card {
    background: var(--clr-bg-primary);
    border-radius: 10px;
    padding: 1.2rem;
    text-align: center;
}

.stats-cards .stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--clr-blue);
    line-height: 1.2;
}

.stats-cards .stat-label {
    font-size: 0.85rem;
    color: var(--clr-text-secondary);
}

/* --- Métadonnées dans modales --- */
.metadata-table {
    width: 100%;
    border-collapse: collapse;
}

.metadata-table th {
    width: 150px;
    padding: 0.8rem;
    background: var(--clr-bg-primary);
    font-weight: 600;
    color: var(--clr-text-secondary);
    border-bottom: 1px solid var(--clr-border);
}

.metadata-table td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--clr-border);
}

/* --- Service details --- */
.service-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
}

.metrics-table td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--clr-border);
}

.metrics-table td:first-child {
    font-weight: 600;
    width: 150px;
}

.metrics-table .progress-bar {
    width: 200px;
}

/* --- Health summary --- */
.health-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--clr-bg-primary);
    border-radius: 8px;
}

.health-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.health-status.good i {
    color: #10b981;
}

.health-status.warning i {
    color: #f59e0b;
}

.status-good {
    color: #10b981;
    font-weight: 600;
}

.status-warning {
    color: #f59e0b;
    font-weight: 600;
}

/* --- Update modal --- */
.update-info {
    padding: 0.5rem;
}

.update-version {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.update-version h4 {
    font-size: 1.3rem;
    color: var(--clr-blue);
}

.update-changelog,
.update-requirements {
    margin-bottom: 1.5rem;
}

.update-changelog h5,
.update-requirements h5 {
    margin-bottom: 0.5rem;
    color: var(--clr-text-secondary);
}

.update-changelog ul {
    list-style: none;
}

.update-changelog li {
    padding: 0.3rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.update-warning {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
}

.update-warning i {
    color: #f59e0b;
    font-size: 1.2rem;
}

/* --- Log detail --- */
.log-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.log-level-badge {
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.log-level-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.log-level-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.log-level-badge.info {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
}

.log-timestamp {
    color: var(--clr-text-secondary);
}

.log-detail-message {
    background: var(--clr-bg-primary);
    padding: 1rem;
    border-radius: 8px;
    font-family: monospace;
    margin-bottom: 1.5rem;
}

.log-detail-metadata h5,
.log-detail-stack h5 {
    margin-bottom: 0.8rem;
    color: var(--clr-text-secondary);
}

.log-detail-stack pre {
    background: var(--clr-bg-primary);
    padding: 1rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* --- Admin detail --- */
.admin-detail-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-detail-header img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--clr-border);
}

.admin-permissions {
    margin: 1.5rem 0;
}

.admin-permissions h4 {
    margin-bottom: 0.8rem;
    color: var(--clr-text-secondary);
}

.permissions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.activity-list {
    list-style: none;
}

.activity-list li {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px dashed var(--clr-border);
}

.activity-list i {
    font-size: 0.5rem;
    color: var(--clr-blue);
}

/* --- Warning message --- */
.warning-message {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.warning-message i {
    color: #ef4444;
    font-size: 1.5rem;
}

.warning-message p {
    margin: 0;
}

/* --- Settings tabs --- */
.settings-tabs {
    margin-top: 0.5rem;
}

.settings-tabs .tabs-header {
    margin-bottom: 1.5rem;
}

/* --- Responsive pour modales --- */
@media (max-width: 768px) {
    .batch-actions {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-start;
    }
    
    .batch-buttons {
        width: 100%;
        justify-content: flex-start;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .details-header {
        flex-direction: column;
        text-align: center;
    }
    
    .admin-detail-header {
        flex-direction: column;
        text-align: center;
    }
    
    .metadata-table th {
        width: 100px;
    }
    
    .metrics-table td {
        display: block;
        width: 100%;
    }
    
    .metrics-table td .progress-bar {
        width: 100%;
    }
    
    .health-summary {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .batch-buttons {
        flex-direction: column;
    }
    
    .batch-buttons button {
        width: 100%;
    }
    
    .log-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .settings-tabs .tabs-header {
        flex-wrap: wrap;
    }
    
    .settings-tabs .tab-btn {
        flex: 1;
        text-align: center;
        padding: 0.5rem;
    }
}