* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
  margin: 0;
  background: #f6f7fb;
  color: #111;
}

/* === Layout général === */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #1f2937;
  color: #fff;
}

.topbar a {
  color: #fff;
  margin-left: 12px;
  text-decoration: none;
}

.container {
  max-width: 1000px;
  margin: 24px auto;
  padding: 0 16px;
}

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

.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
}

.btn {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.btn.danger {
  background: #dc2626;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #eee;
  text-align: left;
}

th {
  background: #f0f2f7;
}

.form-row {
  margin-bottom: 10px;
}

.messages {
  list-style: none;
  padding: 0;
}

/* extras */

input[type="search"],
select {
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
}

.filters {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pagination {
  margin: 16px 0;
  text-align: center;
}

.pager {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

table tr:hover {
  background: #fafafa;
}

header.topbar h1 {
  font-size: 20px;
  margin: 0;
}

nav a:hover {
  text-decoration: underline;
}


/* === Contacts table styling === */

.rc-card {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
  padding: 18px 18px 14px;
}

.rc-card-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.rc-card-header h1 {
  font-size: 1.45rem;
  margin: 0;
}

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

#contact-search {
  min-width: 260px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  padding: 8px 14px;
  font-size: .9rem;
}

.rc-actions .btn {
  border-radius: 999px;
  font-weight: 600;
  padding-inline: 18px;
}

.rc-table-wrap {
  max-height: 65vh;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(to bottom, #f9fafb, #ffffff);
}

.rc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .92rem;
}

.rc-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  padding: .6rem .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: .78rem;
  color: #64748b;
}

.rc-table tbody td {
  padding: .55rem .75rem;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}

.rc-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.rc-table tbody tr:hover {
  background: #eef2ff;
}

.rc-table tbody td:nth-child(4),
.rc-table tbody td:nth-child(5) {
  text-align: center;
  white-space: nowrap;
}

.rc-table tbody td a {
  text-decoration: none;
}

.rc-table tbody td a:hover {
  text-decoration: underline;
}

.rc-table .is-service td {
  font-style: italic;
  color: #4b5563;
}

.rc-meta {
  padding: 8px 2px 0;
  color: #6b7280;
  font-size: .85rem;
}

/* Responsive */
@media (max-width: 720px) {
  .rc-card-header {
    align-items: flex-start;
  }
  .rc-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  #contact-search {
    flex: 1;
    min-width: 0;
  }
}

/* Bouton de déconnexion dans la barre de nav */

.btn-nav-logout {
  background: #b91c1c;
  color: #fef2f2;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid rgba(248, 250, 252, 0.3);
}

.btn-nav-logout:hover {
  background: #991b1b;
  text-decoration: none;
}

/* === Barre de navigation moderne + menu compte === */

.topbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-inner .brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links a {
  color: #e5e7eb;
  margin: 0;
  text-decoration: none;
  font-size: .95rem;
}

.nav-links a:hover {
  text-decoration: underline;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 999px;
  margin: 3px 0;
}

/* Menu compte en haut à droite */

.account-menu {
  margin-left: auto;
  position: relative;
}

.account-trigger {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: none;
  background: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.account-trigger img {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  object-fit: cover;
}

.avatar-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #4f46e5;
  color: #e5e7eb;
  font-weight: 600;
}

.avatar-initial.large {
  width: 42px;
  height: 42px;
  font-size: 1.05rem;
}

.account-dropdown {
  position: absolute;
  top: 42px;
  right: 0;
  width: 260px;
  background: #fff;
  color: #111827;
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .35);
  padding: 10px 0 8px;
  display: none;
  z-index: 40;
}

body.account-open .account-dropdown {
  display: block;
}

.account-header {
  display: flex;
  gap: 10px;
  padding: 10px 16px 8px;
  border-bottom: 1px solid #e5e7eb;
}

.account-avatar img {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: cover;
}

.account-name {
  font-weight: 600;
}

.account-email {
  font-size: .84rem;
  color: #6b7280;
}

/* Contenu du menu compte */

.account-body {
  padding: 8px 16px;
}

/* Mon compte + Se déconnecter : même style de bouton */

.account-link,
.btn-account-logout {
  display: block;
  width: 100%;
  text-align: center;
  padding: 10px 16px;
  border-radius: 999px;
  background-color: #4f46e5;
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  border: none;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
}

.account-link:hover,
.btn-account-logout:hover {
  background: #4338ca;
  transform: translateY(-1px);
}

.account-footer {
  padding: 8px 16px 10px;
  border-top: 1px solid #e5e7eb;
}

/* === Page Mon compte === */

.account-page {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.account-card-main {
  background: #fff;
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 6px 30px rgba(15, 23, 42, .06);
  max-width: 520px;
  width: 100%;
}

.account-card-header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.account-avatar-large img {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  object-fit: cover;
}

.account-card-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.account-card-username {
  font-size: .9rem;
  color: #6b7280;
}

.account-card-role {
  font-size: .86rem;
  color: #4b5563;
}

.account-form .form-row label {
  display: block;
  font-size: .9rem;
  margin-bottom: 2px;
}

.account-form input[type="email"],
.account-form input[type="file"] {
  width: 100%;
}

.account-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn.btn-outlined {
  background: transparent;
  color: #374151;
  border: 1px solid #d1d5db;
}

/* Responsive header */

@media (max-width: 900px) {
  .topbar-inner {
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: block;
  }

  .nav-links {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .account-menu {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
  }

  body.nav-open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* === Badges de rôle sur la page Mon compte === */

.badge-role {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-role-direction {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-role-educateur {
  background: #dbeafe;
  color: #1d4ed8;
}

/* === Page de connexion === */

.auth-page{
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding:40px 16px;
}

@media (min-height:700px){
  .auth-page{
    align-items:center;
    min-height:calc(100vh - 56px); /* hauteur approximative de la topbar */
  }
}

.auth-card{
  background:#ffffff;
  border-radius:24px;
  padding:24px 26px 22px;
  max-width:420px;
  width:100%;
  box-shadow:0 20px 55px rgba(15,23,42,0.18);
  border:1px solid #e5e7eb;
}

.auth-title{
  font-size:1.35rem;
  margin:0 0 4px;
}

.auth-subtitle{
  margin:0 0 18px;
  color:#6b7280;
  font-size:0.92rem;
}

/* Message d'erreur */
.auth-alert{
  background:#fef2f2;
  border:1px solid #fecaca;
  color:#b91c1c;
  border-radius:10px;
  padding:8px 10px;
  font-size:0.88rem;
  margin-bottom:14px;
}

/* Formulaire */
.auth-form .form-row{
  margin-bottom:12px;
}

.auth-form .form-row label{
  display:block;
  font-size:0.9rem;
  font-weight:500;
  margin-bottom:4px;
  color:#374151;
}

.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input[type="email"]{
  width:100%;
  border:1px solid #d1d5db;
  border-radius:10px;
  padding:8px 10px;
  background:#f9fafb;
  font-size:0.95rem;
}

.auth-form input:focus{
  outline:none;
  border-color:#2563eb;
  box-shadow:0 0 0 1px rgba(37,99,235,0.2);
}

/* Bouton */
.auth-actions{
  margin-top:16px;
  display:flex;
  justify-content:flex-start;
}

.auth-btn-primary{
  border-radius:999px;
  padding:9px 20px;
  font-weight:600;
  background:#2563eb;
}

.auth-btn-primary:hover{
  background:#1d4ed8;
}
