/* ═══════════════════════════════════════════════════════
   HÉVIOSSO IA — DESIGN SYSTEM
   Dark Command Center — dark par défaut
   Charte : #060f1d navy · #3b82f6 bleu · #f59e0b ambre
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&display=swap');


/* ── Dark theme — DEFAULT ───────────────────────────── */
:root {
  --bg-page:           #060f1d;
  --bg-surface:        #0a1828;
  --bg-surface-2:      #0d1e35;
  --bg-header:         #07111f;
  --bg-sidebar:        #040c18;
  --bg-sidebar-hover:  rgba(59,130,246,0.09);
  --bg-sidebar-active: rgba(59,130,246,0.16);
  --bg-overlay:        rgba(4,12,24,0.94);

  --text-primary:      #dde8f6;
  --text-secondary:    #5e82a8;
  --text-muted:        #2f4a65;
  --text-sidebar:      #4a7099;
  --text-sidebar-active: #dde8f6;
  --text-onblue:       #ffffff;

  --border:            #101e38;
  --border-strong:     #182e52;

  --accent:            #3b82f6;
  --accent-hover:      #2563eb;
  --color-cta:         #f59e0b;
  --color-cta-hover:   #d97706;
  --color-cta-light:   rgba(245,158,11,0.12);

  --c-healthy:         #22c55e;
  --c-healthy-bg:      rgba(34,197,94,0.1);
  --c-healthy-border:  rgba(34,197,94,0.25);
  --c-major:           #f97316;
  --c-major-bg:        rgba(249,115,22,0.1);
  --c-major-border:    rgba(249,115,22,0.25);
  --c-critical:        #ef4444;
  --c-critical-bg:     rgba(239,68,68,0.1);
  --c-critical-border: rgba(239,68,68,0.25);
  --c-minor:           #eab308;
  --c-minor-bg:        rgba(234,179,8,0.1);
  --c-minor-border:    rgba(234,179,8,0.25);

  /* Glow — subtil halo bleu sur les cards */
  --glow-blue:         0 0 0 1px rgba(59,130,246,0.08), 0 4px 20px rgba(0,0,0,0.55);
  --glow-blue-strong:  0 0 0 1px rgba(59,130,246,0.14), 0 8px 32px rgba(0,0,0,0.65);

  --shadow-xs:  0 1px 2px rgba(0,0,0,0.5);
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.45), 0 0 0 1px rgba(59,130,246,0.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.55), 0 0 0 1px rgba(59,130,246,0.08);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.65), 0 0 0 1px rgba(59,130,246,0.1);
  --shadow-xl:  0 20px 40px rgba(0,0,0,0.75), 0 0 0 1px rgba(59,130,246,0.12);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --transition:      0.2s ease;
  --transition-slow: 0.35s ease;
}


/* ── Light theme — opt-in ───────────────────────────── */
[data-theme="light"] {
  --bg-page:           #f0f4f8;
  --bg-surface:        #ffffff;
  --bg-surface-2:      #f1f5f9;
  --bg-header:         #ffffff;
  --bg-sidebar:        #0e1f44;
  --bg-sidebar-hover:  rgba(255,255,255,0.07);
  --bg-sidebar-active: rgba(255,255,255,0.13);
  --bg-overlay:        rgba(255,255,255,0.92);

  --text-primary:      #0f172a;
  --text-secondary:    #475569;
  --text-muted:        #94a3b8;
  --text-sidebar:      #7098be;
  --text-sidebar-active: #ffffff;
  --text-onblue:       #ffffff;

  --border:            #e2e8f0;
  --border-strong:     #cbd5e1;

  --accent:            #1e40af;
  --accent-hover:      #1730a0;
  --color-cta:         #f59e0b;
  --color-cta-hover:   #d97706;
  --color-cta-light:   rgba(245,158,11,0.12);

  --c-healthy:         #16a34a;
  --c-healthy-bg:      #f0fdf4;
  --c-healthy-border:  #bbf7d0;
  --c-major:           #ea580c;
  --c-major-bg:        #fff7ed;
  --c-major-border:    #fed7aa;
  --c-critical:        #dc2626;
  --c-critical-bg:     #fef2f2;
  --c-critical-border: #fecaca;
  --c-minor:           #d97706;
  --c-minor-bg:        #fffbeb;
  --c-minor-border:    #fde68a;

  --glow-blue:         none;
  --glow-blue-strong:  none;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1),  0 8px 10px -6px rgba(0,0,0,0.04);
}


/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ── Header ─────────────────────────────────────────── */
.app-header {
  height: 58px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-xs);
  transition: background var(--transition-slow), border-color var(--transition-slow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.app-logo { height: 34px; width: auto; }

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.app-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}
.app-title strong { color: var(--text-primary); font-weight: 700; }

.no-decoration { text-decoration: none; }

.header-icons { display: flex; align-items: center; gap: 6px; }


/* ── Header icon buttons ────────────────────────────── */
.icon-btn-header {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  position: relative;
  padding: 0;
}
.icon-btn-header:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-surface-2);
  box-shadow: var(--glow-blue);
}

.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: block; }
[data-theme="light"] .icon-moon { display: none; }

.icon-bell { color: var(--color-cta); }

.icon-user {
  background: linear-gradient(135deg, #0d2044, #1e40af) !important;
  border-color: transparent !important;
  color: white !important;
}
.icon-user:hover {
  background: linear-gradient(135deg, #071530, #1730a0) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(30,64,175,0.5) !important;
}

/* Badge notification */
.notification { position: relative; display: inline-flex; }
.badge {
  position: absolute;
  top: -5px; right: -6px;
  background: var(--c-critical);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px; height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-header);
  line-height: 1;
}


/* ── Buttons globaux ────────────────────────────────── */
.btn-dark {
  padding: 9px 18px;
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
}
.btn-dark:hover {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  box-shadow: var(--glow-blue);
}

.btn-primary {
  background: var(--accent);
  color: white;
  padding: 9px 16px;
  border: none;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }

.btn-secondary {
  padding: 9px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition);
}
.btn-secondary:hover { background: var(--bg-surface-2); border-color: var(--border-strong); }

.btn-danger {
  padding: 9px 12px;
  background: var(--c-critical);
  border: none;
  color: white;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background var(--transition);
}
.btn-danger:hover { background: #b91c1c; }


/* ── Toasts ─────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-notification {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  transform: translateX(110%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  pointer-events: auto;
  border: 1px solid transparent;
  backdrop-filter: blur(12px);
}
.toast-notification.toast-visible { transform: translateX(0); opacity: 1; }

.toast-success { background: rgba(5,46,22,0.95);  color: #4ade80; border-color: #166534; }
.toast-error   { background: rgba(69,10,10,0.95); color: #f87171; border-color: #7f1d1d; }
.toast-info    { background: rgba(12,26,64,0.95); color: #60a5fa; border-color: #1e3a8a; }
.toast-warning { background: rgba(45,26,0,0.95);  color: #fbbf24; border-color: #78350f; }

[data-theme="light"] .toast-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
[data-theme="light"] .toast-error   { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
[data-theme="light"] .toast-info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
[data-theme="light"] .toast-warning { background: #fffbeb; color: #d97706; border-color: #fde68a; }

.toast-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.toast-success .toast-icon { background: rgba(74,222,128,0.15); }
.toast-error   .toast-icon { background: rgba(248,113,113,0.15); }
.toast-info    .toast-icon { background: rgba(96,165,250,0.15); }
.toast-warning .toast-icon { background: rgba(251,191,36,0.15); }

[data-theme="light"] .toast-success .toast-icon { background: #dcfce7; }
[data-theme="light"] .toast-error   .toast-icon { background: #fee2e2; }
[data-theme="light"] .toast-info    .toast-icon { background: #dbeafe; }
[data-theme="light"] .toast-warning .toast-icon { background: #fef3c7; }

.toast-message { flex:1; line-height:1.4; }
.toast-close {
  background: none; border: none; font-size: 18px;
  cursor: pointer; opacity: 0.4; transition: opacity 0.2s;
  padding: 0; line-height: 1; color: inherit; font-family: inherit;
}
.toast-close:hover { opacity: 1; }


/* ── Modals globaux ─────────────────────────────────── */
.modal-overlay, .modal-overlay-1 {
  position: fixed;
  inset: 0;
  background: rgba(4,12,24,0.8);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 1000;
}
.modal-overlay.active, .modal-overlay-1.active { opacity: 1; visibility: visible; }

[data-theme="light"] .modal-overlay,
[data-theme="light"] .modal-overlay-1 {
  background: rgba(0,0,0,0.55);
}

.modal-overlay .modal-content {
  background: var(--bg-surface);
  border-radius: var(--r-xl);
  width: 90%; max-width: 420px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  transform: translateY(-16px) scale(0.98);
  transition: transform 0.25s ease;
  overflow: hidden;
}
.modal-overlay.active .modal-content { transform: translateY(0) scale(1); }

.modal-overlay .modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 18px;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  line-height: 1; padding: 0;
}
.modal-overlay .modal-close:hover { background: rgba(255,255,255,0.15); color: #fff; }

[data-theme="light"] .modal-overlay .modal-close {
  background: var(--bg-surface-2);
  color: var(--text-muted);
}
[data-theme="light"] .modal-overlay .modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.modal-header-user-bell {
  background: linear-gradient(135deg, #07111f 0%, #0d2044 100%);
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
}
[data-theme="light"] .modal-header-user-bell {
  background: linear-gradient(135deg, #0e1f44 0%, #1e3a8a 100%);
}

.modal-overlay .modal-header-user-profile {
  background: linear-gradient(135deg, #07111f 0%, #0d2044 100%);
  color: white;
  padding: 28px 24px;
  text-align: center;
  position: relative;
}
[data-theme="light"] .modal-overlay .modal-header-user-profile {
  background: linear-gradient(135deg, #0e1f44 0%, #1e3a8a 100%);
}

.user-avatar {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, #ff6b35, #e55a25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 12px;
  border: 3px solid rgba(255,255,255,0.2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.user-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; color: #fff; }
.user-role { font-size: 11px; opacity: 0.65; color: #fff; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

.modal-overlay .modal-body { padding: 20px 24px; }

.user-info-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.user-info-item:last-child { border-bottom: none; }
.info-label { font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.info-value { font-size: 13px; color: var(--text-primary); font-weight: 500; }

.modal-overlay .modal-footer {
  display: flex; gap: 8px; padding: 16px 24px;
  background: var(--bg-surface-2);
  border-top: 1px solid var(--border);
}

/* Notification modals */
.modal-content-user-bell { max-height: 88vh; display: flex; flex-direction: column; }
.modal-body-user-bell { overflow-y: auto; flex: 1; padding-right: 4px; }
.modal-body-user-bell::-webkit-scrollbar { width: 4px; }
.modal-body-user-bell::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.notification-item {
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg-surface-2);
  display: flex; flex-direction: column; gap: 5px;
  border: 1px solid var(--border);
  border-left-width: 3px;
}
.notification-item strong { font-weight: 700; font-size: 13px; color: var(--text-primary); }
.notification-item p { margin: 0; color: var(--text-secondary); font-size: 12px; }
.notification-date { font-size: 10px; color: var(--text-muted); }
.notification-info    { border-left-color: var(--accent); }
.notification-success { border-left-color: var(--c-healthy); }
.notification-warning { border-left-color: var(--c-minor); }
.notification-error   { border-left-color: var(--c-critical); }
.notification-system  { border-left-color: var(--border-strong); }

.notification-item .actions { display: flex; gap: 8px; }
.notification-item button { padding: 5px 12px; border-radius: var(--r-sm); font-weight: 600; font-size: 12px; border: none; cursor: pointer; font-family: inherit; }
.notification-item button.read-btn   { background: var(--c-healthy);  color: #000; }
.notification-item button.delete-btn { background: var(--c-critical); color: white; }


/* ── Forms (globaux) ────────────────────────────────── */
.hidden { display: none; }
.profile-edit-form { margin-top: 12px; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

.form-input {
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-surface-2);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }

.form-textarea {
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-surface-2);
  color: var(--text-primary);
  resize: vertical;
  min-height: 80px;
}
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.form-actions .btn-primary  { flex: none; }
.form-actions .btn-secondary { flex: none; }

.password-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error    { color: var(--c-critical); font-size: 12px; margin-top: 4px; }
.form-success  { color: var(--c-healthy);  font-size: 12px; margin-top: 4px; }
.form-success::before { content: "✓ "; font-weight: 700; }


/* ── Footer ─────────────────────────────────────────── */
.footer-bottom {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background var(--transition-slow), border-color var(--transition-slow);
}

.footer-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.footer-logo-icon {
  width: 30px; height: 30px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.footer-logo-icon img { height: 22px; width: auto; object-fit: contain; }
.footer-logo span { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.copyright { font-size: 11px; color: var(--text-muted); }
.footer-right { display: flex; align-items: center; gap: 14px; }
.social-icons { display: flex; gap: 6px; }

.social-icon {
  width: 34px; height: 34px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
}
.social-icon svg { width: 14px; height: 14px; }
.social-icon:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59,130,246,0.35);
}

@media (max-width: 768px) {
  .footer-bottom { flex-direction: column; gap: 14px; padding: 18px; text-align: center; }
  .footer-right  { flex-direction: column; gap: 10px; }
}
@media (max-width: 640px) {
  .toast-container { left: 12px; right: 12px; top: 12px; }
  .toast-notification { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
