/* ============================================================
   FRANCE UNIVE — Back-office CMS
   Interface d'administration
   ============================================================ */

:root {
  --bg:        #05080f;
  --sidebar-w: 260px;
  --bg-panel:  #080d1a;
  --bg-card:   #0a1220;
  --blue:      #3b82f6;
  --blue-light:#60a5fa;
  --gold:      #f59e0b;
  --green:     #4ade80;
  --red:       #f87171;
  --white:     #f0f4ff;
  --white-2:   #94a3b8;
  --muted:     #475569;
  --border:    rgba(59,130,246,0.15);
  --radius:    10px;
  --font:      'Plus Jakarta Sans', sans-serif;
  --font-d:    'Ubuntu', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--white);
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
ul { list-style: none; }

/* ========================================
   ÉCRAN DE CONNEXION
   ======================================== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse 60% 60% at 50% 40%, rgba(59,130,246,0.10) 0%, transparent 70%);
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  font-family: var(--font-d);
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}

.login-logo span { color: var(--blue-light); }

.login-box h2 {
  font-family: var(--font-d);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-box p {
  font-size: 13px;
  color: var(--white-2);
  margin-bottom: 32px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  text-align: left;
}

.login-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--white-2);
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-field input {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 44px 12px 14px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--white);
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}

.login-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.toggle-pwd {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.toggle-pwd:hover { color: var(--white); }

.login-btn {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  color: white;
  font-size: 15px;
  font-weight: 700;
  margin-top: 8px;
  transition: opacity 0.2s, transform 0.2s;
}

.login-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.login-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--red);
  background: rgba(248,113,113,0.10);
  border: 1px solid rgba(248,113,113,0.20);
  border-radius: 6px;
  padding: 10px;
  display: none;
}

/* ========================================
   LAYOUT PRINCIPAL (après connexion)
   ======================================== */
#admin-app {
  display: none;
  min-height: 100vh;
  flex-direction: row;
}

#admin-app.visible { display: flex; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 800;
}

.sidebar-logo span { color: var(--blue-light); }

.sidebar-role {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 8px;
  margin-top: 8px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--white-2);
  cursor: pointer;
  transition: all 0.18s;
  margin-bottom: 2px;
}

.nav-item svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(59,130,246,0.08);
  color: var(--white);
}

.nav-item.active {
  background: rgba(59,130,246,0.14);
  color: var(--blue-light);
}

.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: rgba(59,130,246,0.15);
  color: var(--blue-light);
  padding: 2px 7px;
  border-radius: 99px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--red);
  transition: background 0.18s;
}

.logout-btn:hover { background: rgba(248,113,113,0.08); }
.logout-btn svg { width: 18px; height: 18px; }

/* ---- CONTENU PRINCIPAL ---- */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

.page-header {
  padding: 28px 32px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--bg-panel);
}

.page-header h1 {
  font-family: var(--font-d);
  font-size: 22px;
  font-weight: 700;
}

.page-header p {
  font-size: 13px;
  color: var(--white-2);
  margin-top: 2px;
}

.page-body {
  padding: 32px;
}

/* Panneaux de section */
.admin-panel {
  display: none;
}

.admin-panel.active { display: block; }

/* ========================================
   STAT CARDS (TABLEAU DE BORD)
   ======================================== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.stat-card-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.stat-card-icon.blue { background: rgba(59,130,246,0.12); }
.stat-card-icon.gold { background: rgba(245,158,11,0.12); }
.stat-card-icon.green{ background: rgba(74,222,128,0.12); }
.stat-card-icon.red  { background: rgba(248,113,113,0.12); }

.stat-card-num {
  font-family: var(--font-d);
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-num.blue  { color: var(--blue-light); }
.stat-card-num.gold  { color: var(--gold); }
.stat-card-num.green { color: var(--green); }
.stat-card-num.red   { color: var(--red); }

.stat-card-label { font-size: 13px; color: var(--muted); }

/* ========================================
   TABLEAU DE DONNÉES
   ======================================== */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.table-toolbar {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.table-toolbar h3 {
  font-family: var(--font-d);
  font-size: 16px;
  font-weight: 700;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--white);
  outline: none;
  width: 200px;
  transition: border-color 0.2s;
}

.search-input:focus { border-color: var(--blue); }
.search-input::placeholder { color: var(--muted); }

.btn-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  color: white;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.2s;
}

.btn-add:hover { opacity: 0.85; }
.btn-add svg { width: 15px; height: 15px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--white-2);
  border-bottom: 1px solid rgba(59,130,246,0.06);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: rgba(59,130,246,0.03); }

.td-title {
  font-weight: 600;
  color: var(--white);
  max-width: 280px;
}

.td-title p {
  font-size: 12px;
  color: var(--white-2);
  font-weight: 400;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

/* Badges statuts */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}

.badge-green { background: rgba(74,222,128,0.12); color: var(--green); border: 1px solid rgba(74,222,128,0.2); }
.badge-gold  { background: rgba(245,158,11,0.12); color: var(--gold);  border: 1px solid rgba(245,158,11,0.2); }
.badge-blue  { background: rgba(59,130,246,0.12); color: var(--blue-light); border: 1px solid rgba(59,130,246,0.2); }
.badge-red   { background: rgba(248,113,113,0.12); color: var(--red);  border: 1px solid rgba(248,113,113,0.2); }

/* Actions ligne */
.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.btn-edit, .btn-del {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.18s;
}

.btn-edit { color: var(--blue-light); }
.btn-edit:hover { background: rgba(59,130,246,0.12); }
.btn-edit svg { width: 15px; height: 15px; }

.btn-del { color: var(--red); }
.btn-del:hover { background: rgba(248,113,113,0.12); }
.btn-del svg { width: 15px; height: 15px; }

.empty-table {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 13px;
}

/* ========================================
   MODAL / FORMULAIRE
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,8,15,0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s;
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white-2);
  transition: background 0.18s;
  flex-shrink: 0;
}

.modal-close:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body {
  padding: 0 24px 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--white-2);
  letter-spacing: 0.03em;
}

.field input,
.field select,
.field textarea {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--white);
  outline: none;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.field select option { background: var(--bg-panel); }

.field textarea {
  resize: vertical;
  min-height: 90px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-cancel {
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--white-2);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.18s;
}

.btn-cancel:hover {
  border-color: var(--white-2);
  color: var(--white);
}

.btn-save {
  padding: 10px 20px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), #1d4ed8);
  color: white;
  font-size: 13px;
  font-weight: 700;
  transition: opacity 0.18s;
}

.btn-save:hover { opacity: 0.85; }

/* ========================================
   TOAST NOTIFICATION
   ======================================== */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  white-space: nowrap;
}

#toast.show { transform: translateX(-50%) translateY(0); }
#toast.success { border-color: rgba(74,222,128,0.3); color: var(--green); }
#toast.error   { border-color: rgba(248,113,113,0.3); color: var(--red); }

/* ========================================
   RESPONSIVE SIDEBAR MOBILE
   ======================================== */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar.open { transform: none; }

  .main-content { width: 100%; }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 8px;
    color: var(--white-2);
    background: var(--bg-card);
    border: 1px solid var(--border);
  }

  .page-header {
    padding: 18px 20px;
  }

  .page-body {
    padding: 20px;
  }
}

@media (min-width: 901px) {
  .mobile-menu-btn { display: none; }
  .sidebar-overlay  { display: none !important; }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,8,15,0.7);
  z-index: 199;
  display: none;
}

.sidebar-overlay.show { display: block; }

/* ===== CARTE CANDIDAT (ATTESTATIONS) ===== */
.doc-candidate-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.doc-candidate-card:hover {
  border-color: var(--blue);
  background: var(--bg-card);
}

/* ===== UPLOAD PHOTOS LOGEMENT ===== */
.photo-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
  min-height: 64px;
}

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-thumb {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.65);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-photo-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  color: var(--blue-light);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s;
}
.btn-photo-add:hover { background: rgba(59,130,246,0.18); }
