/* ══════════════════════════════════════════════════════════════
   Styles pour la liste AgGrid des membres AEA
   ══════════════════════════════════════════════════════════════ */

:root {
  --bleu:      #1a3a5c;
  --bleu-cl:   #2e6da4;
  --bleu-pale: #e8f0f8;
  --or:        #c9a84c;
  --gris:      #f4f6f9;
  --gris-bd:   #d0d7e3;
  --vert:      #2e7d32;
  --vert-pale: #e8f5e9;
  --rouge:     #c62828;
  --texte:     #1a1a2e;
  --texte-cl:  #5a6a7a;
  --blanc:     #ffffff;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--gris);
  color: var(--texte);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  background: var(--bleu);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  z-index: 100;
}
.topbar-brand {
  font-family: 'Libre Baskerville', serif;
  font-size: 15px;
  color: var(--blanc);
  display: flex; align-items: center; gap: 8px;
}
.or-dot { width: 8px; height: 8px; background: var(--or); border-radius: 50%; }
.topbar-sep { color: rgba(255,255,255,.3); }
.topbar-title { font-size: 13px; color: rgba(255,255,255,.75); font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 13px; border-radius: 6px; font-size: 12px;
  font-weight: 600; cursor: pointer; border: none;
  font-family: inherit; transition: all .15s; white-space: nowrap;
  text-decoration: none;
}
.btn-primary { background: var(--bleu-cl); color: var(--blanc); }
.btn-primary:hover { background: #245a8a; }
.btn-success { background: var(--vert); color: var(--blanc); }
.btn-success:hover { background: #1b5e20; }
.btn-danger  { background: var(--rouge); color: var(--blanc); }
.btn-danger:hover { background: #9b1f1f; }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,.35); color: var(--blanc); }
.btn-outline:hover { background: rgba(255,255,255,.12); }
.btn-ghost   { background: transparent; color: var(--blanc); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-light   { background: rgba(255,255,255,.1); color: var(--blanc); border: 1px solid rgba(255,255,255,.2); }
.btn-light:hover { background: rgba(255,255,255,.2); }

/* ── Toolbar grille ──────────────────────────────────────── */
.grid-toolbar {
  background: var(--blanc);
  border-bottom: 2px solid var(--gris-bd);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar-group { display: flex; align-items: center; gap: 6px; }
.toolbar-sep {
  width: 1px; height: 24px;
  background: var(--gris-bd);
  margin: 0 4px;
}

.search-wrap {
  display: flex; align-items: center;
  background: var(--gris);
  border: 1px solid var(--gris-bd);
  border-radius: 6px;
  padding: 0 10px;
  gap: 6px;
  transition: border-color .15s;
}
.search-wrap:focus-within { border-color: var(--bleu-cl); }
.search-icon { color: var(--texte-cl); font-size: 13px; }
.search-input {
  border: none; background: transparent;
  font-family: inherit; font-size: 13px;
  color: var(--texte); outline: none;
  width: 220px; padding: 6px 0;
}

.filter-select {
  border: 1px solid var(--gris-bd);
  border-radius: 6px; padding: 5px 8px;
  font-family: inherit; font-size: 12px;
  color: var(--texte); background: var(--gris);
  cursor: pointer; outline: none;
}
.filter-select:focus { border-color: var(--bleu-cl); }

.toolbar-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.stat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.stat-chip-total   { background: var(--bleu-pale); color: var(--bleu); }
.stat-chip-select  { background: var(--or); color: #5a3d00; }
.stat-chip-modif   { background: #fff3e0; color: #e65100; }

/* ── Barre de statut édition ─────────────────────────────── */
.edit-bar {
  background: #fff3e0;
  border-bottom: 1px solid #ffe0b2;
  padding: 8px 20px;
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #5d4037;
  flex-shrink: 0;
}
.edit-bar.visible { display: flex; }
.edit-bar strong { color: #e65100; }
.edit-bar-actions { margin-left: auto; display: flex; gap: 6px; }

/* ── Grille ──────────────────────────────────────────────── */
.grid-wrap {
  flex: 1;
  overflow: hidden;
  padding: 0;
}

#myGrid {
  height: 100%;
  width: 100%;
}

/* ── Thème AG Grid personnalisé AEA ──────────────────────── */
.ag-theme-alpine {
  --ag-font-family: 'Source Sans 3', sans-serif;
  --ag-font-size: 13px;
  --ag-header-background-color: #1a3a5c;
  --ag-header-foreground-color: #ffffff;
  --ag-header-cell-hover-background-color: #2e6da4;
  --ag-selected-row-background-color: #e8f0f8;
  --ag-row-hover-color: #f0f5fb;
  --ag-border-color: #d0d7e3;
  --ag-odd-row-background-color: #fafbfd;
  --ag-cell-horizontal-padding: 10px;
  --ag-row-height: 38px;
  --ag-header-height: 42px;
  --ag-range-selection-border-color: #2e6da4;
  --ag-input-focus-border-color: #2e6da4;
}
.ag-theme-alpine .ag-header-cell-label { font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.ag-theme-alpine .ag-cell { display: flex; align-items: center; }
.ag-theme-alpine .ag-cell-edit-wrapper { height: 100%; }

/* Cellule modifiée */
.cell-modified { background: #fff9c4 !important; }
.cell-new-row  { background: #e8f5e9 !important; }

/* ── Renderers custom ────────────────────────────────────── */
.cell-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.badge-actif   { background: #e8f5e9; color: #2e7d32; }
.badge-radie   { background: #ffebee; color: #c62828; }
.badge-honneur { background: #fff3e0; color: #e65100; }
.badge-decede  { background: #eceff1; color: #546e7a; }

.cell-link {
  color: var(--bleu-cl); text-decoration: none; font-weight: 500;
  cursor: pointer;
}
.cell-link:hover { color: var(--bleu); text-decoration: underline; }

/* ── Pied de page ────────────────────────────────────────── */
.statusbar {
  background: var(--bleu);
  height: 28px;
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
}
.statusbar-item {
  font-size: 11px; color: rgba(255,255,255,.6);
  display: flex; align-items: center; gap: 4px;
}
.statusbar-item strong { color: rgba(255,255,255,.9); }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 40px; right: 20px;
  padding: 11px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  z-index: 999;
  transform: translateY(80px);
  opacity: 0;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  display: flex; align-items: center; gap: 8px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { background: #2e7d32; color: #fff; }
.toast-error   { background: var(--rouge); color: #fff; }
.toast-info    { background: var(--bleu-cl); color: #fff; }

/* ── Modal confirmation ──────────────────────────────────── */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(26,58,92,.6) !important;
  z-index: 99999 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0 !important;
  transition: opacity .2s !important;
  pointer-events: none !important;
}
.modal-overlay.open {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
.modal-overlay .modal {
  background: #ffffff !important;
  border-radius: 10px !important;
  padding: 28px !important;
  max-width: 400px !important;
  width: 90% !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.3) !important;
  transform: translateY(20px) !important;
  transition: transform .2s !important;
  position: relative !important;
  z-index: 100000 !important;
  pointer-events: auto !important;
}
.modal-overlay.open .modal {
  transform: translateY(0) !important;
}
/* Tous les éléments enfants de la modal doivent être cliquables */
.modal-overlay.open .modal * {
  pointer-events: auto !important;
}
.modal h3 {
  font-family: 'Libre Baskerville',serif;
  color: #1a3a5c;
  margin-bottom: 10px;
}
.modal p {
  font-size: 13px;
  color: #5a6a7a;
  margin-bottom: 20px;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-modal-cancel { background:var(--gris); color:var(--texte); border:1px solid var(--gris-bd); padding:7px 16px; border-radius:6px; cursor:pointer; font-family:inherit; font-size:13px; }
.btn-modal-confirm { background:var(--rouge); color:var(--blanc); padding:7px 16px; border-radius:6px; cursor:pointer; border:none; font-family:inherit; font-size:13px; font-weight:600; }
.btn-modal-save { background:var(--vert); color:var(--blanc); padding:7px 16px; border-radius:6px; cursor:pointer; border:none; font-family:inherit; font-size:13px; font-weight:600; }

/* ── Modal édition rapide ────────────────────────────────── */
.modal-overlay .modal-large {
  max-width: 700px !important;
  max-height: 85vh !important;
  overflow-y: auto !important;
  background: #ffffff !important;
}
.modal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--gris-bd);
}
.modal-tab {
  padding: 10px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
  color: var(--texte-cl);
}
.modal-tab:hover { color: var(--bleu); }
.modal-tab.active {
  color: var(--bleu);
  border-bottom-color: var(--bleu);
  font-weight: 600;
}
.modal-body { margin-bottom: 20px; }
.modal-tab-pane { display: none; }
.modal-tab-pane.active { display: block; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--texte);
}
.modal-input {
  padding: 8px 12px;
  border: 1px solid #d0d7e3;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  color: #1a1a2e;
  transition: border-color .2s;
  background: #ffffff;
}
.modal-input:focus {
  outline: none;
  border-color: #2e6da4;
}
.modal-input:read-only, .modal-input:disabled {
  background: #f4f6f9;
  color: #5a6a7a;
  cursor: not-allowed;
}
.checkbox-field label {
  flex-direction: row;
  align-items: center;
  cursor: pointer;
}
.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.info-message {
  padding: 12px;
  background: var(--bleu-pale);
  border-left: 3px solid var(--bleu-cl);
  border-radius: 4px;
  font-size: 12px;
  color: var(--texte-cl);
  margin-bottom: 16px;
}
