/* ============================================================
   Planification — feuille de style principale
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --color-navy:        #15233D;
  --color-navy-light:  #1F3258;
  --color-accent:      #1F6FEB;
  --color-accent-dark: #1558c7;
  --color-on-accent:   #ffffff;
  --color-on-navy:     #ffffff;
  --color-bg:          #F4F5F7;
  --color-card:        #FFFFFF;
  --color-text:        #1F2937;
  --color-heading:     #15233D;
  --color-muted:       #6B7280;
  --color-border:      #E2E4E9;
  --color-error:       #B3261E;
  --color-error-bg:    #FBEAE9;
  --color-success:     #1E7B34;
  --color-success-bg:  #EAF6EC;
  --color-warn:        #B45309;
  --color-warn-bg:     #FEF3C7;
  --radius:            8px;
  --font-heading:      'Space Grotesk', sans-serif;
  --font-body:         'Inter', sans-serif;
  --topbar-h:          56px;
}

/* ── Palette marine (défaut) ─────────────────────────────── */
[data-palette="marine"] {
  --color-navy: #15233D; --color-navy-light: #1F3258; --color-accent: #1F6FEB;
}
[data-palette="emeraude"] {
  --color-navy: #064E3B; --color-navy-light: #065F46; --color-accent: #059669;
}
[data-palette="bordeaux"] {
  --color-navy: #4C0519; --color-navy-light: #881337; --color-accent: #E11D48;
}
[data-palette="ardoise"] {
  --color-navy: #1E293B; --color-navy-light: #334155; --color-accent: #6366F1;
}
[data-palette="aubergine"] {
  --color-navy: #3B0764; --color-navy-light: #581C87; --color-accent: #9333EA;
}

/* ── Mode sombre ─────────────────────────────────────────── */
[data-theme="sombre"] {
  --color-bg:      #0F1117;
  --color-card:    #1A1D27;
  --color-text:    #E4E6EF;
  --color-heading: #F3F4F6;
  --color-muted:   #9CA3AF;
  --color-border:  #2D3148;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-heading);
  margin-top: 0;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: var(--color-navy);
  color: var(--color-on-navy);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.topbar-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-on-navy);
  text-decoration: none;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar-icones {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
}
.topbar-icone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.topbar-icone:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.topbar-icone svg { width: 20px; height: 20px; }

.notif-icone { position: relative; }
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: #EF4444;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

/* ── Menu profil ─────────────────────────────────────────── */
.profil-menu { position: relative; flex-shrink: 0; }
.profil-trigger {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: none;
  border: none;
  color: var(--color-on-navy);
  cursor: pointer;
  padding: .35rem .6rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .9rem;
  transition: background .15s;
}
.profil-trigger:hover { background: rgba(255,255,255,.1); }
.profil-avatar {
  width: 30px; height: 30px;
  background: var(--color-accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}
.profil-avatar-img {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
}
.profil-nom { font-weight: 500; }
.profil-chevron { width: 14px; height: 14px; opacity: .7; }
.profil-dropdown {
  position: absolute;
  right: 0; top: calc(100% + .4rem);
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  min-width: 200px;
  padding: .4rem 0;
  z-index: 200;
}
.profil-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1rem;
  color: var(--color-text);
  font-size: .9rem;
  text-decoration: none;
  transition: background .12s;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  font-family: var(--font-body);
}
.profil-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.profil-item:hover { background: var(--color-bg); text-decoration: none; }
.profil-item--danger { color: var(--color-error); }
.profil-item--danger:hover { background: var(--color-error-bg); }
.profil-separator { border-top: 1px solid var(--color-border); margin: .3rem 0; }

/* Toggle thème */
.profil-item--toggle { justify-content: flex-start; }
.profil-toggle-track {
  margin-left: auto;
  display: inline-flex;
  width: 32px; height: 18px;
  background: var(--color-border);
  border-radius: 9px;
  padding: 2px;
  transition: background .2s;
  flex-shrink: 0;
}
.profil-toggle-thumb {
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .2s;
}
.is-on .profil-toggle-track { background: var(--color-accent); }
.is-on .profil-toggle-thumb { transform: translateX(14px); }

/* ── Layout principal ────────────────────────────────────── */
.page-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 1.4rem; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-heading);
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.card-title svg { width: 18px; height: 18px; color: var(--color-accent); }

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary   { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--color-bg); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-border); text-decoration: none; }
.btn-danger    { background: var(--color-error); color: #fff; }
.btn-danger:hover { opacity: .85; text-decoration: none; color: #fff; }
.btn-success   { background: var(--color-success); color: #fff; }
.btn-success:hover { opacity: .85; text-decoration: none; color: #fff; }
.btn-sm { padding: .3rem .7rem; font-size: .82rem; }

/* ── Formulaires ─────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: .85rem;
  margin-bottom: .3rem;
  color: var(--color-heading);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: .95rem;
  background: var(--color-card);
  color: var(--color-text);
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(31,111,235,.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-hint { font-size: .8rem; color: var(--color-muted); margin-top: .25rem; }

/* ── Messages flash ──────────────────────────────────────── */
.msg {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.msg-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid #b7f0c3; }
.msg-error   { background: var(--color-error-bg);   color: var(--color-error);   border: 1px solid #f5c0bc; }
.msg-warn    { background: var(--color-warn-bg);    color: var(--color-warn);    border: 1px solid #fcd34d; }

/* ── Tableaux ────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-muted);
  padding: .6rem .75rem;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}
tbody td {
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  font-size: .9rem;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--color-bg); }

/* ── Badges statut ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue    { background: #DBEAFE; color: #1D4ED8; }
.badge-green   { background: #D1FAE5; color: #065F46; }
.badge-red     { background: #FEE2E2; color: #991B1B; }
.badge-orange  { background: #FEF3C7; color: #92400E; }
.badge-gray    { background: var(--color-bg); color: var(--color-muted); border: 1px solid var(--color-border); }

/* ── Page auth ───────────────────────────────────────────── */
.page-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--color-navy) 0%, var(--color-navy-light) 45%, var(--color-bg) 45%);
}
.auth-card {
  background: var(--color-card);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(21,35,61,.18);
  width: 100%;
  max-width: 380px;
}
.auth-card h1 { font-size: 1.4rem; }
.auth-subtitle { color: var(--color-muted); margin-top: -.5rem; margin-bottom: 1.5rem; font-size: .9rem; }
.auth-card label { display: block; font-weight: 600; font-size: .85rem; margin-top: 1rem; margin-bottom: .3rem; }
.auth-card input {
  width: 100%; padding: .6rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: .95rem;
  background: var(--color-card); color: var(--color-text);
}
.auth-card input:focus { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.auth-card button[type=submit] {
  width: 100%; margin-top: 1.5rem;
  padding: .65rem; background: var(--color-accent); color: #fff;
  border: none; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.auth-card button[type=submit]:hover { background: var(--color-accent-dark); }

/* ── Dashboard grid ──────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.stat-label { font-size: .82rem; color: var(--color-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 2rem; font-family: var(--font-heading); font-weight: 700; color: var(--color-heading); line-height: 1; }
.stat-sub   { font-size: .82rem; color: var(--color-muted); }

/* ── Planning calendar ───────────────────────────────────── */
.planning-nav {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.planning-nav h2 { margin: 0; font-size: 1.1rem; flex: 1; text-align: center; }

.planning-grid {
  overflow-x: auto;
}
.planning-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.planning-table th {
  background: var(--color-navy);
  color: var(--color-on-navy);
  padding: .5rem .75rem;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.planning-table th:first-child { border-radius: var(--radius) 0 0 0; }
.planning-table th:last-child  { border-radius: 0 var(--radius) 0 0; }
.planning-table td {
  padding: .3rem .5rem;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  vertical-align: middle;
  font-size: .85rem;
}
.planning-table td:first-child { border-left: 1px solid var(--color-border); white-space: nowrap; }
.planning-table tr:last-child td { border-bottom: 1px solid var(--color-border); }
.planning-table tr.semaine-courante td { background: rgba(31,111,235,.04); }

/* Bloc d'activité style Outlook */
.evt-bloc {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .6rem;
  border-radius: 4px;
  color: #fff;
  font-size: .82rem;
  font-weight: 500;
  cursor: default;
  min-height: 28px;
}
.evt-bloc.evt-moi { outline: 2px solid rgba(255,255,255,.6); outline-offset: -2px; font-weight: 700; }
.evt-bloc.evt-cliquable { cursor: pointer; transition: filter .15s; }
.evt-bloc.evt-cliquable:hover { filter: brightness(1.1); }
.evt-bloc .evt-user { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evt-bloc .evt-semaine { font-size: .72rem; opacity: .8; margin-left: auto; white-space: nowrap; }

.semaine-label { color: var(--color-muted); font-size: .78rem; }
.date-range    { font-weight: 600; color: var(--color-heading); }

/* ── Équipe ──────────────────────────────────────────────── */
.equipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.membre-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .4rem;
}
.membre-avatar {
  width: 48px; height: 48px;
  background: var(--color-navy-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700; font-size: 1.1rem;
  overflow: hidden;
}
.membre-avatar img { width: 100%; height: 100%; object-fit: cover; }
.membre-nom  { font-weight: 600; font-size: .9rem; color: var(--color-heading); }
.membre-next { font-size: .78rem; color: var(--color-muted); }
.membre-next strong { color: var(--color-accent); }

/* ── Notifications / échanges ────────────────────────────── */
.notif-list { display: flex; flex-direction: column; gap: .5rem; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-card);
  transition: background .12s;
}
.notif-item.non-lu { background: #EFF6FF; border-color: #BFDBFE; }
[data-theme="sombre"] .notif-item.non-lu { background: #1e2a3a; border-color: #2563eb55; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0; margin-top: 5px;
}
.notif-dot.lu { background: var(--color-border); }
.notif-body { flex: 1; font-size: .88rem; }
.notif-date { font-size: .76rem; color: var(--color-muted); margin-top: .2rem; }

/* ── Profil / paramètres ─────────────────────────────────── */
.avatar-preview {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--color-border);
}
.avatar-placeholder {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--color-navy-light);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.8rem; font-weight: 700; color: #fff;
}

/* ── Utilitaires ─────────────────────────────────────────── */
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; }
.gap-1         { gap: .5rem; }
.gap-2         { gap: 1rem; }
.mt-1          { margin-top: .5rem; }
.mt-2          { margin-top: 1rem; }
.mb-1          { margin-bottom: .5rem; }
.mb-2          { margin-bottom: 1rem; }
.text-muted    { color: var(--color-muted); font-size: .88rem; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.empty-state   { text-align: center; color: var(--color-muted); padding: 3rem 1rem; font-size: .95rem; }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 1rem; opacity: .4; display: block; margin-left: auto; margin-right: auto; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .form-row       { flex-direction: column; }
  .profil-nom     { display: none; }
}
@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}
