:root {
  --sidebar-bg: #0f172a;
  --sidebar-width: 260px;
  --accent: #f97316;
  --accent-dark: #ea6c0a;
  --accent-light: #fff7ed;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --navbar-h: 60px;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  margin: 0;
  padding: 0;
}

/* ── TOP NAVBAR ── */
.top-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  z-index: 1040;
  gap: 1rem;
}

.top-navbar .brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  text-decoration: none;
  white-space: nowrap;
}

.top-navbar .brand .brand-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}

.top-navbar .spacer { flex: 1; }

.top-navbar .sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem .5rem;
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 1.25rem;
  display: none;
  transition: background .15s;
}
.top-navbar .sidebar-toggle:hover { background: var(--bg); color: var(--text-main); }

.user-menu .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: .35rem .6rem;
  border-radius: 8px;
  font-size: .875rem;
  color: var(--text-main);
  font-weight: 500;
  transition: background .15s;
}
.user-menu .dropdown-toggle:hover { background: var(--bg); }
.user-menu .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.user-menu .user-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--navbar-h));
  background: var(--sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease, width .25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.sidebar-user {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-user img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.15);
  flex-shrink: 0;
}
.sidebar-user .user-info { min-width: 0; }
.sidebar-user .user-info .name {
  color: #fff;
  font-weight: 600;
  font-size: .875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-info .role {
  color: var(--accent);
  font-size: .72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.sidebar-nav { padding: .75rem 0; flex: 1; }

.sidebar-section {
  padding: .35rem 1rem .1rem;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.3);
  margin-top: .5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem 1rem;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: all .15s;
  margin: .05rem .5rem;
  border-radius: 6px;
}
.sidebar-link i { font-size: 1rem; width: 1.1rem; flex-shrink: 0; }
.sidebar-link:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
  text-decoration: none;
}
.sidebar-link.active {
  background: rgba(249,115,22,.15);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--navbar-h);
  min-height: calc(100vh - var(--navbar-h));
  padding: 1.75rem;
  transition: margin-left .25s ease;
}

.page-header {
  margin-bottom: 1.5rem;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}
.page-header .breadcrumb {
  margin: .25rem 0 0;
  font-size: .8rem;
}

/* ── CARDS ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.03);
  margin-bottom: 1.25rem;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  background: none;
  border-radius: 12px 12px 0 0;
}
.card-body { padding: 1.25rem; }
.card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: none;
  border-radius: 0 0 12px 12px;
}

/* ── STAT CARDS ── */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-card .stat-icon.orange { background: #fff7ed; color: var(--accent); }
.stat-card .stat-icon.blue   { background: #eff6ff; color: var(--info); }
.stat-card .stat-icon.green  { background: #f0fdf4; color: var(--success); }
.stat-card .stat-icon.purple { background: #f5f3ff; color: #8b5cf6; }
.stat-card .stat-value { font-size: 1.875rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { color: var(--text-muted); font-size: .8rem; margin-top: .15rem; }

/* ── BUTTONS ── */
.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .5rem 1.1rem;
  font-weight: 600;
  font-size: .875rem;
  cursor: pointer;
  transition: background .15s, transform .1s;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.btn-accent:hover { background: var(--accent-dark); color: #fff; transform: translateY(-1px); }
.btn-accent:active { transform: translateY(0); }

/* ── FORMS ── */
.form-label { font-weight: 500; font-size: .875rem; color: var(--text-main); margin-bottom: .3rem; }
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem .75rem;
  font-size: .875rem;
  color: var(--text-main);
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.12);
  outline: none;
}

/* ── TABLES ── */
.table-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table-modern thead th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-modern tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tbody tr:hover { background: #fafafa; }

/* ── BADGES ── */
.badge-role {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .5rem;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-role.r1 { background: #fef2f2; color: #dc2626; }
.badge-role.r2 { background: #fff7ed; color: var(--accent); }
.badge-role.r3 { background: #eff6ff; color: var(--info); }
.badge-role.r4 { background: #f0fdf4; color: var(--success); }
.badge-role.r5 { background: #f5f3ff; color: #8b5cf6; }
.badge-role.r6 { background: #f1f5f9; color: var(--text-muted); }

/* ── ALERTS ── */
.alert {
  border-radius: 10px;
  border: none;
  padding: .85rem 1rem;
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.alert-success { background: #f0fdf4; color: #166534; }
.alert-danger   { background: #fef2f2; color: #991b1b; }
.alert-warning  { background: #fffbeb; color: #92400e; }
.alert-info     { background: #eff6ff; color: #1e40af; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: var(--accent);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  margin: 0 auto .75rem;
}
.login-logo h1 { font-size: 1.35rem; font-weight: 700; color: var(--text-main); margin: 0; }
.login-logo p  { font-size: .85rem; color: var(--text-muted); margin: .2rem 0 0; }

/* ── PLANNING ── */
.planning-grid { display: grid; gap: 1rem; }
.date-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.date-card-header {
  background: var(--sidebar-bg);
  color: #fff;
  padding: .65rem 1rem;
  font-weight: 600;
  font-size: .875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.date-card-body { padding: 1rem; }
.slot-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
}
.slot-row:last-child { border-bottom: none; }
.slot-time {
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  min-width: 80px;
}

/* ── PROFILE ── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1e3a5f 100%);
  border-radius: 12px;
  color: #fff;
  margin-bottom: 1.5rem;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.3);
  object-fit: cover;
  flex-shrink: 0;
}
.profile-header .profile-name { font-size: 1.35rem; font-weight: 700; }
.profile-header .profile-role { font-size: .82rem; color: var(--accent); font-weight: 600; margin-top: .1rem; }
.profile-header .profile-services { font-size: .8rem; color: rgba(255,255,255,.7); margin-top: .3rem; }

/* ── RESPONSIVE ── */
@media (max-width: 991.98px) {
  .top-navbar .sidebar-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1029;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 575.98px) {
  .main-content { padding: 1rem; }
  .login-card { padding: 1.75rem 1.25rem; }
}

/* ── FOOTER ── */
.main-footer {
  margin-top: 2rem;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .78rem;
  text-align: center;
}

/* ── MISC ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.text-accent { color: var(--accent); }
.bg-accent { background: var(--accent); }

.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.programme-nav { display: flex; align-items: center; gap: .5rem; }
.programme-nav .btn { border-radius: 8px; }

/* ── Photo lightbox ──────────────────────────────────────────────── */
.photo-thumb {
  width: 40px; height: 40px; object-fit: cover; border-radius: 50%;
  cursor: pointer; transition: transform .15s;
  border: 2px solid rgba(255,255,255,.5);
}
.photo-thumb:hover { transform: scale(1.2); box-shadow: 0 2px 8px rgba(0,0,0,.3); }

/* ── Planning tableaux ───────────────────────────────────────────── */
.cell-permanence { background: #26bf5c !important; }
.cell-dispo      { background: #f0c040 !important; }
.cell-both       { background: linear-gradient(135deg,#26bf5c 50%,#f0c040 50%) !important; }
.cell-disabled   { background: #adb5bd !important; cursor: not-allowed; }
.row-absent td, .row-absent th { background: rgba(203,67,53,.12) !important; }

/* ── Boutons dispo ───────────────────────────────────────────────── */
.btn-dispo {
  width: 26px; height: 26px; padding: 0; line-height: 1;
  font-size: 12px; border-radius: 4px; border: 1px solid #ccc;
}
.btn-dispo:hover { opacity: .85; }

/* ── Photo lightbox ──────────────────────────────────────────────── */
.photo-thumb {
  width: 40px; height: 40px; object-fit: cover; border-radius: 50%;
  cursor: pointer; transition: transform .15s;
  border: 2px solid rgba(255,255,255,.5);
}
.photo-thumb:hover { transform: scale(1.2); box-shadow: 0 2px 8px rgba(0,0,0,.3); }

/* ── Planning tableaux ───────────────────────────────────────────── */
.cell-permanence { background: #26bf5c !important; }
.cell-dispo      { background: #f0c040 !important; }
.cell-disabled   { background: #adb5bd !important; cursor: not-allowed; }
.row-absent td, .row-absent th { background: rgba(203,67,53,.12) !important; }

/* ── Boutons dispo ───────────────────────────────────────────────── */
.btn-dispo { width: 26px; height: 26px; padding: 0; line-height: 1; font-size: 12px; border-radius: 4px; border: 1px solid #ccc; }
.btn-dispo:hover { opacity: .85; }

/* ── Sidebar groups (collapsible) ───────────────── */
.sb-group { margin-bottom: 2px; }

.sb-group-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .5rem 1rem;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.72);
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.sb-group-toggle:hover,
.sb-group-toggle.active {
  color: #fff;
  background: rgba(255,255,255,.07);
}
.sb-chevron {
  transition: transform .2s;
  font-size: .7rem;
  margin-left: auto !important;
}
.sb-group-toggle[aria-expanded="true"] .sb-chevron {
  transform: rotate(180deg);
}
.sidebar-sub {
  padding-left: 1.7rem !important;
  font-size: .8rem !important;
}

/* ── Pagination bénévoles ───────────────────────── */
#pagination-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  padding: .5rem 0;
}
#pagination-controls button {
  min-width: 32px;
}

/* ── Note de service HTML ─────────────────────────────── */
.note-html p      { margin-bottom: .5rem; }
.note-html b,
.note-html strong { font-weight: 600; }
.note-html ul,
.note-html ol     { padding-left: 1.4rem; margin-bottom: .5rem; }
.note-html a      { color: #0d6efd; }

/* ── Mon Planning checkboxes ────────────────────────────── */
.mp-cell {
  padding: 4px 3px !important;
  min-width: 42px;
  vertical-align: middle !important;
}
.mp-cb {
  display: block;
  margin: 0 auto;
  width: 18px;
  height: 18px;
  transition: transform .1s;
}
.mp-cb:not(:disabled) { cursor: pointer; }
.mp-cb:not(:disabled):hover { transform: scale(1.2); }

/* ── Navbar mobile : brand text masqué + nom tronqué ── */
@media (max-width: 575.98px) {
  .top-navbar .brand-name { display: none; }
  .top-navbar .brand { gap: 0; }
  .user-menu .user-name { max-width: 90px; }
}

/* ── Select : flèche visible sur tous les <select> ─────────────────────── */
select:not(.form-select) {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236c757d' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  background-size: 12px 12px;
  padding-right: 1.8rem !important;
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236c757d' d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right .75rem center !important;
  background-size: 12px 12px !important;
}
