/* ════════════════════════════════════════════════════════════
   VARIABLES DE THÈME (Dark par défaut)
   ════════════════════════════════════════════════════════════ */
:root {
  /* Dark Theme */
  --layer-base: #0f172a;
  --layer-surface: #1e293b;
  --layer-elevated: #334155;
  --border-default: #475569;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --accent: #3b82f6;
  --purple: #8b5cf6;
  --teal: #14b8a6;
  --warning: #f59e0b;
  --orange: #f97316;
  --success: #22c55e;
  --danger: #ef4444;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

[data-theme="light"] {
  --layer-base: #f8fafc;
  --layer-surface: #ffffff;
  --layer-elevated: #f1f5f9;
  --border-default: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
}

/* ════════════════════════════════════════════════════════════
   NOTIFICATION BADGE — Positionnement corrigé
   ════════════════════════════════════════════════════════════ */
.notification-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--layer-surface, #1e293b);
  z-index: 10;
  pointer-events: none;
  animation: badge-pulse 2s ease-in-out infinite;
}

.notification-badge:empty,
.notification-badge.hidden {
  display: none;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@media (max-width: 768px) {
  .notification-badge {
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    line-height: 16px;
  }
}

/* ════════════════════════════════════════════════════════════
   MODAL STYLES
   ════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--layer-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-default);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-default);
}

/* ════════════════════════════════════════════════════════════
   FORM & BUTTONS
   ════════════════════════════════════════════════════════════ */
.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-label-sm {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  background: var(--layer-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #2563eb; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--layer-elevated);
  color: var(--text-primary);
}

.btn-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
}

/* ════════════════════════════════════════════════════════════
   BADGES & TABLES
   ════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-danger { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-success { background: rgba(34,197,94,0.15); color: #22c55e; }
.badge-info { background: rgba(59,130,246,0.15); color: #3b82f6; }
.badge-purple { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.badge-cyan { background: rgba(6,182,212,0.15); color: #06b6d4; }
.badge-muted { background: rgba(100,116,139,0.15); color: #64748b; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-default);
  text-align: left;
  font-size: 0.85rem;
}

.data-table th {
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.data-table tr:hover {
  background: var(--layer-elevated);
}

/* ════════════════════════════════════════════════════════════
   CARDS & CHARTS
   ════════════════════════════════════════════════════════════ */
.chart-card {
  background: var(--layer-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.chart-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin: 4px 0 0 0;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-tertiary);
}

.iso-score {
  text-align: center;
  padding: 20px;
  background: var(--layer-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  border-top: 4px solid;
}

.iso-score-value {
  font-size: 2.2rem;
  font-weight: 800;
}

.iso-score-label {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════
   KANBAN BOARD
   ════════════════════════════════════════════════════════════ */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-col {
  min-width: 220px;
  flex: 1;
  background: var(--layer-base);
  border-radius: var(--radius-md);
  padding: 8px;
}

.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  margin-bottom: 8px;
}

.kanban-col-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kanban-count {
  background: var(--layer-elevated);
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.kanban-cards {
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card {
  background: var(--layer-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px;
  position: relative;
  cursor: grab;
  transition: box-shadow 0.2s;
}

.kanban-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.kanban-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  padding-right: 24px;
}

.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 0.75rem;
}

.sortable-ghost {
  opacity: 0.4;
}

.sortable-drag {
  transform: rotate(3deg);
}

/* ════════════════════════════════════════════════════════════
   KPI BARS
   ════════════════════════════════════════════════════════════ */
.kpi-chart-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.kpi-bar-label {
  min-width: 120px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: right;
}

.kpi-bar-track {
  flex: 1;
  height: 8px;
  background: var(--layer-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.kpi-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.kpi-bar-value {
  min-width: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ════════════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════════════ */
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.fa-spin { animation: spin 1s linear infinite; }

/* Text helpers */
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-tertiary) !important; }
.text-xs { font-size: 0.7rem; }
.text-sm { font-size: 0.8rem; }