:root {
  --primary: #1e3a8a;
  --primary-hover: #1e40af;
  --danger: #b91c1c;
  --danger-hover: #991b1b;
  --bg-color: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --border-color: #e2e8f0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top left, #ffffff, #f1f5f9);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* OVERLAY LOGIN */
.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at bottom right, rgba(30, 58, 138, 0.1), transparent), var(--bg-color);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.login-card {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 12px;
  border-top: 4px solid var(--primary);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  text-align: center;
  max-width: 400px;
  width: 100%;
}
.logo { font-size: 3.5rem; margin-bottom: 1rem; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1)); }
.error-text { color: var(--danger); margin-top: 1rem; font-size: 0.875rem; font-weight: 500; }

/* NAVBAR */
.navbar {
  background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%);
  border-bottom: 3px solid var(--danger);
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.nav-brand { display: flex; align-items: center; gap: 0.75rem; }
.nav-brand h1 { font-size: 1.25rem; margin: 0; color: white; font-weight: 600; letter-spacing: 0.02em; }
.nav-brand .logo { font-size: 1.5rem; margin: 0; }

.nav-menu { display: flex; gap: 0.5rem; }
.nav-btn {
  background: none; border: none; padding: 0.5rem 1rem;
  cursor: pointer; color: #cbd5e1; font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.nav-btn.active { color: white; background: rgba(255, 255, 255, 0.1); }
.nav-btn:hover:not(:disabled) { color: white; background: rgba(255, 255, 255, 0.15); }
.nav-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.nav-user { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; color: #cbd5e1; }

/* MAIN CONTAINER */
.container { padding: 2rem; max-width: 1200px; margin: 0 auto; }
.header-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 2rem;
}
.header-actions h2 { margin: 0; font-weight: 600; color: var(--primary); }

/* BUTTONS */
.btn {
  padding: 0.6rem 1.2rem; border-radius: 6px; font-weight: 500; cursor: pointer; border: none;
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-primary { 
  background: linear-gradient(to bottom, #2563eb, #1e40af);
  color: white; 
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover:not(:disabled) { 
  background: linear-gradient(to bottom, #3b82f6, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.875rem; }

/* TABLE */
.table-container {
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.data-table {
  width: 100%; border-collapse: collapse; text-align: left;
}
.data-table th, .data-table td {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color);
}
.data-table th { 
  background: #f8fafc; font-weight: 600; color: var(--text-muted); 
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; 
}
.data-table tbody tr { transition: background-color 0.15s ease; }
.data-table tbody tr:hover { background: #f1f5f9; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ALERTS */
.alert { padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; font-weight: 500; }
.alert-success { background: #f0fdf4; color: #15803d; border-left: 4px solid #16a34a; }
.alert-error { background: #fef2f2; color: #b91c1c; border-left: 4px solid #dc2626; }
.alert-info { background: #eff6ff; color: #1d4ed8; border-left: 4px solid #2563eb; }

.badge {
  padding: 0.25rem 0.6rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600;
  display: inline-block;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* ── Duplicate Member Detail Cards ──────────────────────────── */
.duplicate-member-card {
  flex: 1;
  min-width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.duplicate-member-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.member-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.member-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 2px solid var(--primary);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.member-detail-name h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 2px 0;
}

.member-detail-name .name-ru {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.member-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.grade-badge {
  display: inline-block;
  background: rgba(185, 28, 28, 0.08);
  border: 1px solid rgba(185, 28, 28, 0.25);
  color: var(--danger);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 600;
}

.section-tag {
  display: inline-block;
  background: rgba(30, 58, 138, 0.06);
  border: 1px solid rgba(30, 58, 138, 0.2);
  color: var(--primary);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
}

.status-actif {
  background: #dcfce7;
  color: #166534;
  border: 1px solid rgba(22, 101, 52, 0.2);
}

.status-archive {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid rgba(153, 27, 27, 0.2);
}

.detail-section {
  margin-bottom: 1.25rem;
}

.detail-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.detail-field {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 2px;
}

.detail-value {
  font-size: 0.82rem;
  color: var(--text-main);
  font-weight: 500;
  word-break: break-word;
}

.detail-value.empty {
  color: #94a3b8;
  font-style: italic;
  font-weight: 400;
}

.detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.detail-list li {
  font-size: 0.8rem;
  color: var(--text-main);
  padding: 4px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.detail-list li:last-child {
  border-bottom: none;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.comments-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ── Member Edit Form Card & Modal Overlay ──────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6); /* slate-900 overlay with opacity */
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.edit-member-card {
  max-width: 850px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  margin: 0; /* override 2rem auto for vertical centring */
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-close-modal {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  font-size: 1.75rem;
  font-weight: 300;
  cursor: pointer;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background-color 0.2s ease, color 0.2s ease;
  z-index: 10;
}

.btn-close-modal:hover {
  background-color: var(--bg-color);
  color: var(--text-main);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 0.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

.form-group textarea {
  resize: vertical;
}

.rgpd-consent-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}

.rgpd-consent-row:hover {
  background: #f1f5f9;
}

.rgpd-consent-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

.rgpd-consent-row label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}


