/* ============================================================
   VARIABLES — THÈME ARC-EN-CIEL
   ============================================================ */
:root {
  /* Couleurs principales arc-en-ciel */
  --rainbow-1: #E74C3C;   /* rouge */
  --rainbow-2: #E67E22;   /* orange */
  --rainbow-3: #F1C40F;   /* jaune */
  --rainbow-4: #2ECC71;   /* vert */
  --rainbow-5: #3498DB;   /* bleu */
  --rainbow-6: #9B59B6;   /* violet */
  --rainbow-7: #1ABC9C;   /* turquoise */

  /* Couleur principale du thème */
  --primary:        #7C3AED;
  --primary-dark:   #5B21B6;
  --primary-light:  #A78BFA;
  --accent:         #EDE9FE;

  /* Sidebar gradient arc-en-ciel */
  --sidebar-grad:   linear-gradient(180deg,#1a0533 0%,#2d1b69 30%,#1e3a5f 60%,#0f4c3a 100%);

  /* Couleurs fonctionnelles */
  --gold:           #F59E0B;
  --gold-light:     #FEF3C7;
  --success:        #10B981;
  --success-light:  #D1FAE5;
  --warning:        #F59E0B;
  --warning-light:  #FEF3C7;
  --danger:         #EF4444;
  --danger-light:   #FEE2E2;
  --info:           #3B82F6;
  --info-light:     #DBEAFE;

  /* Neutres */
  --bg:             #F5F3FF;
  --bg-card:        #FFFFFF;
  --border:         #E5E7EB;
  --text:           #1F2937;
  --text-muted:     #6B7280;
  --text-light:     #D1D5DB;

  /* Layout */
  --sidebar-w:      264px;
  --topbar-h:       64px;
  --radius:         14px;
  --radius-sm:      9px;
  --shadow:         0 2px 16px rgba(124,58,237,0.08);
  --shadow-lg:      0 8px 32px rgba(124,58,237,0.16);
  --transition:     0.25s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg,var(--rainbow-6),var(--rainbow-5));
  border-radius: 10px;
}

/* ============================================================
   SIDEBAR ARC-EN-CIEL
   ============================================================ */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-grad);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition), transform var(--transition);
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar.collapsed { width: 70px; }
.sidebar.mobile-hidden { transform: translateX(-100%); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 80px;
  background: rgba(0,0,0,0.2);
}

.sidebar-logo { display: flex; align-items: center; gap: 12px; overflow: hidden; }

.sidebar-logo > i {
  font-size: 28px;
  background: linear-gradient(135deg,#F59E0B,#EF4444,#8B5CF6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 28px;
}

.sidebar-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: #fff;
  white-space: nowrap;
  background: linear-gradient(90deg,#fff,#A78BFA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo span {
  font-size: 10px;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  display: block;
}

.sidebar-toggle {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  padding: 7px;
  border-radius: 8px;
  transition: all var(--transition);
}
.sidebar-toggle:hover { color: #fff; background: rgba(255,255,255,0.18); }

.sidebar-search { margin: 12px 14px; position: relative; }
.sidebar-search i {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.4); font-size: 13px;
}
.sidebar-search input {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  padding: 8px 10px 8px 30px;
  color: #fff; font-size: 13px; outline: none;
  transition: background var(--transition);
}
.sidebar-search input::placeholder { color: rgba(255,255,255,0.35); }
.sidebar-search input:focus { background: rgba(255,255,255,0.16); border-color: rgba(167,139,250,0.5); }

.sidebar.collapsed .sidebar-search { display: none; }
.sidebar.collapsed .sidebar-logo > div { display: none; }
.sidebar.collapsed .nav-section-title { display: none; }
.sidebar.collapsed .nav-link span { display: none; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-link i { margin: 0; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0 20px; }

.nav-section-title {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  padding: 14px 18px 5px;
}

/* Couleurs arc-en-ciel pour les liens nav au survol */
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: rgba(255,255,255,0.72);
  transition: all var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}
.nav-link i { font-size: 16px; min-width: 20px; text-align: center; }
.nav-link span { font-size: 13px; font-weight: 500; white-space: nowrap; }

.nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-link.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: #F59E0B;
}

/* Couleurs icônes nav selon la section */
#navSectionPrincipalItems .nav-link i,
#navSectionEgliseItems .nav-link i { color: #A78BFA; }
#navSectionHierarchieItems .nav-link i { color: #34D399; }
#navSectionMembres ~ ul .nav-link i { color: #60A5FA; }
#navSectionEvenements ~ ul .nav-link i { color: #FB923C; }
#navSectionImportItems .nav-link i { color: #F472B6; }
#navAdminItems .nav-link i { color: #FCD34D; }

/* ============================================================
   USER INFO SIDEBAR
   ============================================================ */
#sidebarUser {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.2);
  flex-shrink: 0;
}
#sidebarUserAvatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg,#7C3AED,#3B82F6);
  border: 2px solid rgba(167,139,250,0.5);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
}
#sidebarUserInfo { flex: 1; overflow: hidden; }
#sidebarUserName {
  font-size: 12px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#sidebarUserRole { font-size: 10px; color: rgba(255,255,255,0.45); }
.sidebar.collapsed #sidebarUserInfo { display: none; }

/* ============================================================
   MAIN WRAPPER & TOPBAR
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left var(--transition);
}
.main-wrapper.sidebar-collapsed { margin-left: 70px; }

.topbar {
  position: sticky; top: 0;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg,#7C3AED,#3B82F6,#10B981,#F59E0B,#EF4444) 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 50;
  box-shadow: 0 2px 12px rgba(124,58,237,0.08);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-menu-btn {
  display: none; background: transparent; border: none;
  font-size: 20px; color: var(--text); padding: 6px;
}

.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
}
.breadcrumb span {
  background: linear-gradient(90deg,var(--primary),var(--info));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; font-weight: 600;
}
.breadcrumb .sep { color: var(--text-light); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date {
  font-size: 12px; color: var(--text-muted);
  background: var(--bg); padding: 4px 10px; border-radius: 6px;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content { flex: 1; padding: 28px 28px 40px; overflow-y: auto; }

.loading-spinner {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; height: 300px;
}
.loading-spinner i {
  font-size: 40px;
  background: linear-gradient(135deg,#7C3AED,#3B82F6,#10B981);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.loading-spinner p { font-size: 16px; color: var(--text-muted); }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header-left h2 {
  font-family: 'Playfair Display', serif;
  font-size: 24px; color: var(--primary-dark);
}
.page-header-left p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   STATS CARDS — couleurs arc-en-ciel
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px; margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
  border-left: 4px solid var(--primary);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 60px; height: 100%;
  background: linear-gradient(135deg,transparent,rgba(124,58,237,0.04));
  pointer-events: none;
}

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

.stat-card.primary { border-left-color: #7C3AED; }
.stat-card.success { border-left-color: #10B981; }
.stat-card.warning { border-left-color: #F59E0B; }
.stat-card.danger  { border-left-color: #EF4444; }
.stat-card.info    { border-left-color: #3B82F6; }
.stat-card.gold    { border-left-color: #F59E0B; }

.stat-icon {
  width: 52px; height: 52px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-card .stat-icon         { background: #EDE9FE; color: #7C3AED; }
.stat-card.primary .stat-icon { background: #EDE9FE; color: #7C3AED; }
.stat-card.success .stat-icon { background: #D1FAE5; color: #10B981; }
.stat-card.warning .stat-icon { background: #FEF3C7; color: #F59E0B; }
.stat-card.danger  .stat-icon { background: #FEE2E2; color: #EF4444; }
.stat-card.info    .stat-icon { background: #DBEAFE; color: #3B82F6; }
.stat-card.gold    .stat-icon { background: #FEF3C7; color: #D97706; }

.stat-info h3 { font-size: 28px; font-weight: 800; color: var(--text); }
.stat-info p  { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg,rgba(124,58,237,0.04),rgba(59,130,246,0.04));
}
.card-header h3 {
  font-size: 15px; font-weight: 600; color: var(--primary-dark);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 20px 22px; }

/* ============================================================
   GRIDS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 20px; }

/* ============================================================
   ENTITY CARDS — dégradés arc-en-ciel
   ============================================================ */
.entity-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 2px solid transparent;
}
.entity-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(124,58,237,0.18);
  border-color: var(--primary-light);
}

.entity-card-header {
  background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
  padding: 18px 20px; color: #fff;
}
.entity-card-header.region {
  background: linear-gradient(135deg, #059669 0%, #065F46 100%);
}
.entity-card-header.sous-region {
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
}
.entity-card-header.eglise {
  background: linear-gradient(135deg, #7C3AED 0%, #4F46E5 100%);
}

.entity-card-header h4 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.entity-card-header p  { font-size: 12px; opacity: 0.82; }

.entity-card-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; float: right; margin-top: -2px;
}

.entity-card-body { padding: 16px 20px; }
.entity-card-body .meta {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
}
.entity-card-body .meta i { color: var(--primary-light); }

.entity-card-footer {
  display: flex; gap: 8px; padding: 12px 20px;
  border-top: 1px solid var(--border); background: var(--bg);
}

/* ============================================================
   BUTTONS — palette arc-en-ciel
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; border: none;
  transition: all var(--transition); white-space: nowrap;
}
.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-xs  { padding: 4px 9px; font-size: 11px; border-radius: 6px; }
.btn-lg  { padding: 12px 24px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }

.btn-primary {
  background: linear-gradient(135deg, #7C3AED, #5B21B6);
  color: #fff; box-shadow: 0 2px 8px rgba(124,58,237,0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #6D28D9, #4C1D95);
  box-shadow: 0 4px 14px rgba(124,58,237,0.45); transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #10B981, #059669); color: #fff;
}
.btn-success:hover { background: linear-gradient(135deg, #059669, #047857); }

.btn-warning {
  background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff;
}
.btn-warning:hover { background: linear-gradient(135deg, #D97706, #B45309); }

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626); color: #fff;
}
.btn-danger:hover { background: linear-gradient(135deg, #DC2626, #B91C1C); }

.btn-info {
  background: linear-gradient(135deg, #3B82F6, #2563EB); color: #fff;
}
.btn-info:hover { background: linear-gradient(135deg, #2563EB, #1D4ED8); }

.btn-gold {
  background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff;
}
.btn-gold:hover { background: linear-gradient(135deg, #D97706, #B45309); }

.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #D1D5DB; }

.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); border-color: var(--primary-light); }

.btn-outline-primary {
  background: transparent;
  border: 1.5px solid var(--primary); color: var(--primary);
}
.btn-outline-primary:hover {
  background: linear-gradient(135deg,#7C3AED,#5B21B6); color: #fff;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }

table { width: 100%; border-collapse: collapse; background: var(--bg-card); }

thead {
  background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 50%, #4F46E5 100%);
  color: #fff;
}
thead th {
  padding: 13px 16px;
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px; white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:hover { background: #F5F3FF; }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 12px 16px; font-size: 13px; color: var(--text); vertical-align: middle; }

.td-actions { display: flex; gap: 6px; align-items: center; }

/* ============================================================
   BADGES — arc-en-ciel
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}
.badge-success   { background: #D1FAE5; color: #065F46; }
.badge-warning   { background: #FEF3C7; color: #92400E; }
.badge-danger    { background: #FEE2E2; color: #991B1B; }
.badge-info      { background: #DBEAFE; color: #1E40AF; }
.badge-primary   { background: #EDE9FE; color: #5B21B6; }
.badge-secondary { background: var(--border); color: var(--text-muted); }
.badge-gold      { background: #FEF3C7; color: #92400E; }
.badge-dark      { background: #374151; color: #F9FAFB; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.6px; margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text); background: var(--bg-card);
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
.form-control.invalid { border-color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

/* ============================================================
   MODAL — en-tête dégradé arc-en-ciel
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card); border-radius: var(--radius);
  width: 90%; max-width: 680px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(124,58,237,0.2);
  transform: translateY(20px); transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal.large { max-width: 920px; }
.modal.small { max-width: 460px; }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 50%, #4F46E5 100%);
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: #fff; }
.modal-close {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.35); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px; border-top: 1px solid var(--border);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-radius: var(--radius-sm);
  background: var(--bg-card); box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500; min-width: 280px;
  border-left: 4px solid var(--primary);
  animation: slideInRight 0.3s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.error i { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning i { color: var(--warning); }
.toast i { font-size: 16px; color: var(--primary); }

@keyframes slideInRight {
  from { transform: translateX(100px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   SEARCH RESULTS
   ============================================================ */
.search-results {
  position: fixed; top: 64px; left: var(--sidebar-w); right: 0;
  background: var(--bg-card); box-shadow: var(--shadow-lg);
  z-index: 999; max-height: 420px; overflow-y: auto;
  display: none;
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg,#7C3AED,#3B82F6,#10B981) 1;
}
.search-results.active { display: block; }

.search-result-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background var(--transition);
}
.search-result-item:hover { background: #F5F3FF; }
.search-result-item .icon {
  width: 36px; height: 36px; border-radius: 9px;
  background: #EDE9FE; color: #7C3AED;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.search-result-item .info h4 { font-size: 13px; font-weight: 600; color: var(--text); }
.search-result-item .info p  { font-size: 11px; color: var(--text-muted); }
.search-no-result { padding: 30px; text-align: center; color: var(--text-muted); font-size: 14px; }

/* ============================================================
   MEMBER AVATAR
   ============================================================ */
.member-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg,#7C3AED,#3B82F6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.member-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.member-info h4 { font-size: 13px; font-weight: 600; }
.member-info p  { font-size: 12px; color: var(--text-muted); }
.member-row { display: flex; align-items: center; gap: 12px; }

/* ============================================================
   PROFILE DETAIL
   ============================================================ */
.profile-banner {
  background: linear-gradient(135deg, #5B21B6 0%, #7C3AED 50%, #4F46E5 100%);
  color: #fff; padding: 28px 28px 50px; text-align: center; position: relative;
}
.profile-banner::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg,#F59E0B,#EF4444,#7C3AED,#3B82F6,#10B981);
}
.profile-avatar-lg {
  width: 88px; height: 88px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.35);
  margin: 0 auto 12px;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; overflow: hidden;
}
.profile-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.profile-banner h2 { font-size: 20px; font-weight: 700; }
.profile-banner p  { font-size: 13px; opacity: 0.8; }

.profile-body { padding: 20px 22px; }
.profile-tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border); margin-bottom: 20px;
}
.profile-tab {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}
.profile-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item label {
  font-size: 11px; text-transform: uppercase; color: var(--text-muted);
  font-weight: 700; margin-bottom: 4px; display: block;
}
.detail-item p { font-size: 13px; color: var(--text); font-weight: 500; }

/* ============================================================
   TABS
   ============================================================ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 20px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); background: transparent; border: none;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  cursor: pointer; transition: color var(--transition), border-color var(--transition);
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   SEARCH BAR (PAGE)
   ============================================================ */
.page-search {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.search-input-wrapper { position: relative; flex: 1; min-width: 200px; }
.search-input-wrapper i {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px;
}
.search-input-wrapper input {
  width: 100%; padding: 10px 12px 10px 36px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; outline: none; background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

/* ============================================================
   FILTER CHIPS
   ============================================================ */
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 5px 14px; border-radius: 20px; font-size: 12px;
  font-weight: 600; cursor: pointer;
  background: var(--border); color: var(--text-muted);
  border: 1.5px solid transparent; transition: all var(--transition);
}
.chip.active { background: #EDE9FE; color: #7C3AED; border-color: #A78BFA; }

/* ============================================================
   CALENDAR
   ============================================================ */
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.calendar-day-header {
  text-align: center; padding: 8px; font-size: 11px;
  font-weight: 700; text-transform: uppercase; color: var(--text-muted);
}
.calendar-day {
  min-height: 82px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 7px; padding: 6px;
}
.calendar-day.other-month { opacity: 0.35; }
.calendar-day.today {
  border-color: #7C3AED;
  background: linear-gradient(135deg,#F5F3FF,#EDE9FE);
}
.calendar-day-num { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 4px; }

.calendar-event {
  font-size: 10px; padding: 2px 5px; border-radius: 4px;
  background: #7C3AED; color: #fff; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calendar-event.messe         { background: #7C3AED; }
.calendar-event.reunion        { background: #3B82F6; }
.calendar-event.bapteme        { background: #10B981; }
.calendar-event.mariage        { background: #F59E0B; }
.calendar-event.funerailles    { background: #6B7280; }
.calendar-event.fete-paques    { background: #059669; }
.calendar-event.fete-pentecote { background: #EF4444; }
.calendar-event.fete-liturgique{ background: #D97706; }

/* ============================================================
   HIERARCHY
   ============================================================ */
.hierarchy-trail {
  display: flex; align-items: center; gap: 8px; margin-bottom: 20px;
  padding: 10px 16px; background: var(--bg-card);
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  flex-wrap: wrap;
}
.hierarchy-trail .trail-item {
  display: flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--text-muted); cursor: pointer;
}
.hierarchy-trail .trail-item:hover { color: var(--primary); }
.hierarchy-trail .trail-item.active { color: var(--primary); font-weight: 700; }
.hierarchy-trail .trail-sep { color: var(--text-light); font-size: 16px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar-container { background: var(--border); border-radius: 10px; height: 8px; overflow: hidden; width: 100%; }
.progress-bar-fill {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, #7C3AED, #3B82F6); transition: width 0.5s ease;
}
.progress-bar-fill.success { background: linear-gradient(90deg,#10B981,#059669); }
.progress-bar-fill.warning { background: linear-gradient(90deg,#F59E0B,#D97706); }
.progress-bar-fill.danger  { background: linear-gradient(90deg,#EF4444,#DC2626); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i {
  font-size: 60px; margin-bottom: 16px;
  background: linear-gradient(135deg,#A78BFA,#60A5FA);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  opacity: 0.6;
}
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.empty-state p  { font-size: 14px; margin-bottom: 20px; }

/* ============================================================
   DROP ZONE
   ============================================================ */
.drop-zone {
  border: 2px dashed #A78BFA; border-radius: var(--radius);
  padding: 40px; text-align: center; cursor: pointer;
  transition: all var(--transition); background: #F5F3FF;
}
.drop-zone:hover { border-color: #7C3AED; background: #EDE9FE; }
.drop-zone i { font-size: 48px; color: #A78BFA; margin-bottom: 12px; }
.drop-zone h3 { font-size: 16px; color: #7C3AED; margin-bottom: 6px; }
.drop-zone p  { font-size: 13px; color: var(--text-muted); }

/* ============================================================
   MONTANT
   ============================================================ */
.amount { font-weight: 700; color: var(--text); }
.amount.large { font-size: 24px; }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
#notifDropdown { display: none; }
#notifDropdown.open { display: block !important; }

#notifBadge {
  display: none; position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff; border-radius: 10px;
  min-width: 16px; height: 16px; font-size: 9px; font-weight: 700;
  align-items: center; justify-content: center;
  border: 2px solid #fff; padding: 0 3px;
}
#notifBadge.show { display: flex !important; }

/* ============================================================
   OFFLINE BANNER
   ============================================================ */
#offlineBanner {
  display: none;
  background: linear-gradient(90deg,#FEF3C7,#FEF9EC);
  border-bottom: 1px solid #F59E0B;
  padding: 8px 24px; font-size: 13px; color: #92400E;
  align-items: center; gap: 8px;
}

/* ============================================================
   PWA INSTALL BANNER
   ============================================================ */
#pwaInstallBanner {
  display: none; position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg,#7C3AED,#4F46E5);
  color: #fff; border-radius: 30px; padding: 10px 20px;
  box-shadow: var(--shadow-lg); z-index: 500;
  align-items: center; gap: 10px; font-size: 13px; font-weight: 500;
}

/* ============================================================
   MISC UTILS
   ============================================================ */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-primary { color: var(--primary); }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .topbar-menu-btn { display: flex; }
  .search-results { left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .calendar-day { min-height: 52px; }
  .topbar { padding: 0 14px; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .modal-overlay, .toast-container, .btn { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .page-content { padding: 0; }
  body { font-size: 12px; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ============================================================
   LEAFLET
   ============================================================ */
.leaflet-container { font-family: 'Inter', sans-serif !important; }
.leaflet-popup-content-wrapper { border-radius: 10px !important; box-shadow: var(--shadow-lg) !important; }
.leaflet-popup-content { margin: 8px !important; }

/* ============================================================
   DÉCORATION GLOBALE ARC-EN-CIEL
   ============================================================ */
/* Barre colorée en haut de la page */
body::before {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg,
    #EF4444 0%, #F59E0B 16%, #F1C40F 32%,
    #10B981 48%, #3B82F6 64%, #8B5CF6 80%, #EC4899 100%);
  z-index: 9999;
}

/* ============================================================
   TITRES RAINBOW (arc-en-ciel)
   ============================================================ */
.rainbow-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  background: linear-gradient(90deg,
    #7C3AED 0%, #3B82F6 25%, #10B981 50%,
    #F59E0B 75%, #EF4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: rainbowShift 6s linear infinite;
}

@keyframes rainbowShift {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

/* Sidebar : barre latérale colorée animée */
.sidebar::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg,
    #EF4444, #F59E0B, #10B981,
    #3B82F6, #8B5CF6, #EC4899);
  opacity: 0.7;
}

/* Séparateur arc-en-ciel */
.divider-rainbow {
  border: none;
  height: 2px;
  background: linear-gradient(90deg,
    #EF4444, #F59E0B, #10B981, #3B82F6, #8B5CF6);
  margin: 16px 0;
  border-radius: 2px;
}

/* ============================================================
   BADGE DARK (funerailles)
   ============================================================ */
.badge-dark { background: #374151; color: #F9FAFB; }

/* ============================================================
   CALENDAR EVENT CLASSES (nouveaux types)
   ============================================================ */
.cal-sortie         { background: #CCE5FF; color: #004085; }
.cal-veillée        { background: #D1D3E2; color: #2D2D6B; }
.cal-messe8         { background: #FFEEBA; color: #856404; }
.cal-messe41        { background: #FFEEBA; color: #856404; }
.cal-paques         { background: #D4EDDA; color: #155724; }
.cal-pentecote      { background: #F8D7DA; color: #721C24; }
.cal-ascension      { background: #CCE5FF; color: #004085; }
.cal-reunion        { background: #D1ECF1; color: #0C5460; }
.cal-fete           { background: #FFF9C4; color: #795548; }
.cal-autre          { background: #F5F5F5; color: #616161; }
.cal-messe          { background: #E8D5F5; color: #6C3483; }
.cal-bapteme        { background: #D5E8D4; color: #117A65; }
.cal-mariage        { background: #FFF3CD; color: #856404; }
.cal-funerailles    { background: #E2E3E5; color: #383D41; }

/* ============================================================
   BOUTONS COLORÉS (section Mon Église)
   ============================================================ */
.btn-eglise {
  background: linear-gradient(135deg, #1A5276, #2E86C1);
  color: #fff; box-shadow: 0 2px 8px rgba(26,82,118,0.35);
}
.btn-eglise:hover {
  background: linear-gradient(135deg, #154360, #1A5276);
  transform: translateY(-1px);
}

/* ============================================================
   ANIMATION D'ENTRÉE DES CARTES
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.entity-card { animation: fadeInUp 0.3s ease both; }
.entity-card:nth-child(1)  { animation-delay: 0.05s; }
.entity-card:nth-child(2)  { animation-delay: 0.10s; }
.entity-card:nth-child(3)  { animation-delay: 0.15s; }
.entity-card:nth-child(4)  { animation-delay: 0.20s; }
.entity-card:nth-child(5)  { animation-delay: 0.25s; }
.entity-card:nth-child(6)  { animation-delay: 0.30s; }

/* ============================================================
   INDICATEUR DE SEXE
   ============================================================ */
.badge-homme { background: #DBEAFE; color: #1D4ED8; }
.badge-femme { background: #FCE7F3; color: #9D174D; }

/* ============================================================
   FORMULAIRE : section direction paroissiale
   ============================================================ */
.direction-block {
  background: linear-gradient(135deg, #fafbff, #f3e9ff);
  border: 1px solid rgba(108,52,131,0.15);
  border-radius: 10px; padding: 14px; margin-bottom: 10px;
}
.direction-block-title {
  font-size: 12px; font-weight: 700;
  color: var(--primary-dark); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}

/* ============================================================
   SIDEBAR NAV — couleurs par section (arc-en-ciel renforcé)
   ============================================================ */
#navSectionPrincipalItems .nav-link.active { border-left-color: #A78BFA; }
#navSectionHierarchieItems .nav-link.active { border-left-color: #34D399; }
#navSectionMembres ~ ul .nav-link.active { border-left-color: #60A5FA; }
#navSectionEvenements ~ ul .nav-link.active { border-left-color: #FB923C; }
#navSectionImportItems .nav-link.active { border-left-color: #F472B6; }
#navSectionEgliseItems .nav-link.active { border-left-color: #FCD34D; }

/* ============================================================
   TOPBAR : dégradé arc-en-ciel animé
   ============================================================ */
.topbar {
  border-bottom: 3px solid transparent !important;
  border-image: linear-gradient(90deg,
    #7C3AED, #3B82F6, #10B981, #F59E0B, #EF4444, #EC4899) 1 !important;
}

/* ============================================================
   PAGE HEADER : accent arc-en-ciel
   ============================================================ */
.page-header {
  border-left: 4px solid transparent;
  border-image: linear-gradient(180deg, #7C3AED, #3B82F6) 1;
  padding-left: 16px;
}

/* ============================================================
   STAT CARD : couleurs arc-en-ciel renforcées
   ============================================================ */
.stat-card.primary { border-left-color: #7C3AED; }
.stat-card.success { border-left-color: #10B981; }
.stat-card.warning { border-left-color: #F59E0B; }
.stat-card.danger  { border-left-color: #EF4444; }
.stat-card.info    { border-left-color: #3B82F6; }
.stat-card.gold    { border-left-color: #D97706; }
.stat-card.pink    { border-left-color: #EC4899; }
.stat-card.pink .stat-icon { background: #FCE7F3; color: #9D174D; }

/* ============================================================
   MODAL HEADER : dégradé arc-en-ciel
   ============================================================ */
.modal-header {
  background: linear-gradient(135deg,
    #5B21B6 0%, #7C3AED 40%, #4F46E5 70%, #2563EB 100%) !important;
}

/* ============================================================
   SCROLLBAR ARC-EN-CIEL AMÉLIORÉE
   ============================================================ */
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #7C3AED, #3B82F6, #10B981) !important;
}
