/* GuardSync Modern App Styles - Optimisé pour agents de sécurité */

/* Variables de design system modernes */
:root {
    /* Couleurs primaires - Palette professionnelle sécurité */
    --primary: #1e40af;        /* Bleu professionnel sécurité */
    --primary-dark: #1e3a8a;   /* Bleu foncé */
    --primary-light: #3b82f6;  /* Bleu clair */
    --secondary: #64748b;      /* Gris ardoise */
    --success: #059669;        /* Vert sécurisé */
    --warning: #d97706;        /* Orange attention */
    --danger: #dc2626;         /* Rouge alerte */
    --info: #0284c7;           /* Bleu info */
    
    /* MODE CLAIR (Défaut) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --surface-elevated: #ffffff;
    
    /* Texte mode clair */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-on-primary: #ffffff;
    --text-on-surface: #0f172a;
    
    /* Bordures mode clair */
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    /* Espacement système */
    --space-xs: 0.25rem;    /* 4px */
    --space-sm: 0.5rem;     /* 8px */
    --space-md: 1rem;       /* 16px */
    --space-lg: 1.5rem;     /* 24px */
    --space-xl: 2rem;       /* 32px */
    --space-2xl: 3rem;      /* 48px */
    
    /* Border radius */
    --radius-sm: 0.375rem;   /* 6px */
    --radius-md: 0.5rem;     /* 8px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --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);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Tailles pour mobile/tactile */
    --touch-target: 44px;
    --button-height: 48px;
    --input-height: 48px;
}

/* MODE SOMBRE - Variables spécifiques agents de nuit */
[data-theme="dark"] {
    /* Arrière-plans sombres - optimisés pour surveillance nocturne */
    --bg-primary: #0f172a;        /* Fond principal très sombre */
    --bg-secondary: #1e293b;      /* Fond secondaire */
    --bg-tertiary: #334155;       /* Fond tertiaire */
    --surface: #1e293b;           /* Surface des cards */
    --surface-hover: #334155;     /* Hover sur surfaces */
    --surface-elevated: #475569;  /* Surfaces élevées */
    
    /* Texte mode sombre - haute lisibilité */
    --text-primary: #f8fafc;      /* Texte principal blanc cassé */
    --text-secondary: #cbd5e1;    /* Texte secondaire gris clair */
    --text-muted: #94a3b8;        /* Texte discret */
    --text-on-primary: #f8fafc;   /* Texte sur fond primaire */
    --text-on-surface: #f8fafc;   /* Texte sur surfaces */
    
    /* Bordures mode sombre */
    --border-color: #475569;      /* Bordure principale */
    --border-hover: #64748b;      /* Bordure au survol */
    
    /* Ombres adaptées au sombre */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.3);
    
    /* Couleurs d'état adaptées au sombre */
    --primary: #3b82f6;           /* Bleu plus lumineux en sombre */
    --primary-light: #60a5fa;     /* Bleu encore plus clair */
    --success: #10b981;           /* Vert plus lumineux */
    --warning: #f59e0b;           /* Orange plus lumineux */
    --danger: #ef4444;            /* Rouge plus lumineux */
    --info: #06b6d4;              /* Cyan plus lumineux */
}

/* Reset et base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: color var(--transition-normal), background-color var(--transition-normal);
}

/* Navigation modernisée */
.navbar {
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1e293b 100%) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-on-primary) !important;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.navbar-brand i {
    font-size: 1.5rem;
    color: var(--primary-light);
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: var(--space-sm) var(--space-md) !important;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--text-on-primary) !important;
    background-color: rgba(59, 130, 246, 0.2);
    transform: translateY(-1px);
}

/* Cards système moderne */
.card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    overflow: hidden;
    color: var(--text-on-surface);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-lg);
}

/* Système de boutons moderne et accessible */
.btn {
    min-height: var(--button-height);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    transition: var(--transition-fast);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn:active {
    transform: scale(0.98);
}

/* Bouton primaire moderne */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1e3a8a 100%);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: var(--text-on-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
    color: var(--text-on-primary);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #b45309 100%);
    color: var(--text-on-primary);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: var(--text-on-primary);
}

.btn-info {
    background: linear-gradient(135deg, var(--info) 0%, #0369a1 100%);
    color: var(--text-on-primary);
}

/* Boutons outline modernes */
.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-md);
}

/* Tailles de boutons */
.btn-sm {
    min-height: 36px;
    padding: var(--space-xs) var(--space-md);
    font-size: 0.875rem;
}

.btn-lg {
    min-height: 56px;
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
}

/* Forms modernes et accessibles */
.form-control,
.form-select {
    min-height: var(--input-height);
    padding: var(--space-sm) var(--space-md);
    border: 2px solid #d1d5db;
    border-radius: var(--radius-md);
    background: var(--surface);
    font-size: 1rem;
    transition: var(--transition-fast);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

/* Checkboxes et radios modernes */
.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Alerts modernes */
.alert {
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border-left: 4px solid;
    box-shadow: var(--shadow-sm);
}

.alert-primary {
    background-color: rgba(30, 64, 175, 0.1);
    border-left-color: var(--primary);
    color: var(--primary-dark);
}

.alert-success {
    background-color: rgba(5, 150, 105, 0.1);
    border-left-color: var(--success);
    color: #047857;
}

.alert-warning {
    background-color: rgba(217, 119, 6, 0.1);
    border-left-color: var(--warning);
    color: #b45309;
}

.alert-danger {
    background-color: rgba(220, 38, 38, 0.1);
    border-left-color: var(--danger);
    color: #b91c1c;
}

/* Badges modernes */
.badge {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables responsives */
.table {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    border: none;
    padding: var(--space-md);
}

.table td {
    padding: var(--space-md);
    border-top: 1px solid #e2e8f0;
    vertical-align: middle;
}

/* Loading spinner moderne */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(30, 64, 175, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utilities pour l'accessibilité */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Animations et micro-interactions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 0.6s ease-in-out;
}

/* Focus visible pour accessibilité clavier */
.focus-visible {
    outline: 2px solid var(--primary) !important;
    outline-offset: 2px !important;
}

/* Responsive helpers */
@media (max-width: 768px) {
    :root {
        --button-height: 52px;
        --input-height: 52px;
        --touch-target: 48px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .btn-group .btn {
        width: auto;
    }
}


/* === QUICK ACTIONS AMÉLIORÉES === */
.quick-action-card {
    transition: all var(--transition-normal);
    border: 1px solid transparent;
    position: relative;
    overflow: visible;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

/* Badge de statut en haut à droite */
.quick-action-status {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-indicator.status-active {
    background-color: #10b981; /* Vert - actif */
    animation: pulse-green 2s infinite;
}

.status-indicator.status-pending {
    background-color: #f59e0b; /* Orange - en attente */
    animation: pulse-orange 2s infinite;
}

.status-indicator.status-urgent {
    background-color: #ef4444; /* Rouge - urgent */
    animation: pulse-red 1.5s infinite;
}

.status-indicator.status-draft {
    background-color: #8b5cf6; /* Violet - brouillon */
}

.status-indicator.status-upcoming {
    background-color: #3b82f6; /* Bleu - à venir */
}

.status-indicator.status-none {
    background-color: #d1d5db; /* Gris - aucun */
}

/* Animations de pulsation pour les indicateurs */
@keyframes pulse-green {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

@keyframes pulse-orange {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.15); }
}

/* Badge compteur en haut à gauche */
.quick-action-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    z-index: 15;
}

.quick-action-badge .badge {
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: badge-appear 0.3s ease-out;
}

@keyframes badge-appear {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Sous-titre avec informations dynamiques */
.quick-action-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    text-align: center;
    min-height: 1.2em;
    line-height: 1.2;
}

/* Améliorations des icônes */
.quick-action-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    transition: all var(--transition-normal);
}

.quick-action-card:hover .quick-action-icon {
    transform: scale(1.1);
}

/* Améliorations responsive */
@media (max-width: 768px) {
    .quick-action-status {
        top: 8px;
        right: 8px;
    }
    
    .quick-action-badge {
        top: -6px;
        left: -6px;
    }
    
    .quick-action-badge .badge {
        min-width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
    
    .status-indicator {
        width: 10px;
        height: 10px;
    }
    
    .quick-action-subtitle {
        font-size: 0.75rem;
    }
}

/* États de chargement */
.quick-action-subtitle:empty::before {
    content: 'Chargement...';
    color: var(--text-muted);
    opacity: 0.7;
}

/* Amélioration de l'accessibilité */
.quick-action-card:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Variations de couleurs pour les badges selon le contexte */
.badge.bg-success {
    background-color: #10b981 !important;
}

.badge.bg-warning {
    background-color: #f59e0b !important;
}

.badge.bg-danger {
    background-color: #ef4444 !important;
}

.badge.bg-info {
    background-color: #3b82f6 !important;
}

/* === STYLES POUR LE TOGGLE THÈME === */
.theme-toggle {
    position: relative;
    transition: var(--transition-normal);
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle--auto {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
}

.theme-toggle--auto::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid var(--surface);
}

/* === NOTIFICATIONS DE CHANGEMENT DE THÈME === */
.theme-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1060;
    max-width: 320px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    opacity: 0;
    transition: all var(--transition-normal);
}

.theme-notification--show {
    transform: translateX(0);
    opacity: 1;
}

.theme-notification-content {
    padding: var(--space-md) var(--space-lg);
    color: var(--text-on-surface);
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}

.theme-auto-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1060;
    background: var(--surface-elevated);
    border: 2px solid var(--border-hover);
    color: var(--text-on-surface);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    font-weight: 500;
    transform: translateY(100%);
    opacity: 0;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.theme-auto-notification--show {
    transform: translateY(0);
    opacity: 1;
}

/* Mode clair - notifications avec couleurs spécifiques */
[data-theme="light"] .theme-notification {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .theme-notification-content {
    color: #1f2937;
}

[data-theme="light"] .theme-auto-notification {
    background: #1f2937;
    border-color: #374151;
    color: #ffffff;
}

/* Mode sombre - notifications avec couleurs spécifiques */
[data-theme="dark"] .theme-notification {
    background: #334155;
    border-color: #64748b;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .theme-notification-content {
    color: #f8fafc;
}

[data-theme="dark"] .theme-auto-notification {
    background: #475569;
    border-color: #64748b;
    color: #f8fafc;
}

/* === ADAPTATIONS SPÉCIFIQUES MODE SOMBRE === */

/* Navigation en mode sombre */
[data-theme="dark"] .navbar {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border-bottom: 1px solid var(--border-color);
}

/* Tables en mode sombre */
[data-theme="dark"] .table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--text-on-surface);
}

[data-theme="dark"] .table th {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .table td {
    border-color: var(--border-color);
}

/* Forms en mode sombre */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: var(--surface);
    border-color: var(--border-color);
    color: var(--text-on-surface);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--text-on-surface);
}

/* Badges en mode sombre */
[data-theme="dark"] .badge.bg-light {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

/* Alerts en mode sombre */
[data-theme="dark"] .alert-primary {
    background-color: rgba(59, 130, 246, 0.2);
    border-left-color: var(--primary);
    color: var(--primary-light);
}

[data-theme="dark"] .alert-success {
    background-color: rgba(16, 185, 129, 0.2);
    border-left-color: var(--success);
    color: #34d399;
}

[data-theme="dark"] .alert-warning {
    background-color: rgba(245, 158, 11, 0.2);
    border-left-color: var(--warning);
    color: #fbbf24;
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(239, 68, 68, 0.2);
    border-left-color: var(--danger);
    color: #fb7185;
}

/* Breadcrumb en mode sombre */
[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

[data-theme="dark"] .breadcrumb-item.active {
    color: var(--text-secondary);
}

/* Dropdown menus en mode sombre */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--surface-elevated);
    border-color: var(--border-color);
    box-shadow: var(--shadow-xl);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-on-surface);
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--surface-hover);
    color: var(--text-on-surface);
}

/* Modals en mode sombre */
[data-theme="dark"] .modal-content {
    background-color: var(--surface);
    border-color: var(--border-color);
}

[data-theme="dark"] .modal-header {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .modal-footer {
    border-top-color: var(--border-color);
}

/* Tooltips en mode sombre */
[data-theme="dark"] .tooltip-inner {
    background-color: var(--bg-tertiary);
    color: var(--text-on-surface);
}

/* Print styles */
@media print {
    .btn, .navbar, .no-print, .theme-toggle {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}