/* style.css — Design system PFPS CHU Rennes */

/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  /* CHU Rennes */
  --chu-blue:        #1565C0;
  --chu-blue-dark:   #0D47A1;
  --chu-blue-light:  #E8F0FE;
  --chu-yellow:      #F5A623;

  /* PFPS roue */
  --pfps-violet:     #5C6BC0;
  --pfps-teal:       #4DB6AC;
  --pfps-purple:     #AB47BC;
  --pfps-orange:     #FF7043;
  --pfps-pink:       #EC407A;
  --pfps-lavender:   #9FA8DA;

  /* Neutres */
  --gray-900:  #1A1A2E;
  --gray-700:  #3D3D5C;
  --gray-500:  #6B6B8A;
  --gray-300:  #C8C8DC;
  --gray-100:  #F4F6FA;
  --white:     #FFFFFF;

  /* Sémantiques */
  --success:  #2E7D32;
  --success-bg: #E8F5E9;
  --warning:  #E65100;
  --warning-bg: #FFF3E0;
  --danger:   #C62828;
  --danger-bg: #FFEBEE;
  --info:     #0277BD;
  --info-bg:  #E1F5FE;

  /* Typographie */
  --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Inter', sans-serif;

  /* Espacements */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  20px;

  /* Ombres */
  --shadow-sm: 0 1px 3px rgba(21,101,192,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(21,101,192,.12), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 24px rgba(21,101,192,.15), 0 4px 8px rgba(0,0,0,.08);

  /* Transitions */
  --t-fast: 150ms ease;
  --t-med:  250ms ease;
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--gray-100);
  color: var(--gray-900);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--chu-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ─── Header ────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 3px solid var(--chu-blue);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 70px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-logo {
  height: 48px;
  display: flex;
  align-items: center;
}
.header-logo img { height: 48px; width: auto; }
.header-sep {
  width: 1px;
  height: 36px;
  background: var(--gray-300);
}
.header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
  line-height: 1.3;
}
.header-title small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--gray-500);
}
.header-spacer { flex: 1; }
.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--gray-700);
}
.header-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--chu-blue-light);
  color: var(--chu-blue);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── Layout principal ──────────────────────────────────────────────────── */
.page-layout {
  display: flex;
  min-height: calc(100vh - 70px);
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--gray-300);
  padding: 24px 0;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
}
.sidebar-section {
  padding: 0 12px 12px;
}
.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-500);
  padding: 8px 12px 4px;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--gray-700);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  text-decoration: none;
}
.sidebar a:hover {
  background: var(--chu-blue-light);
  color: var(--chu-blue);
  text-decoration: none;
}
.sidebar a.active {
  background: var(--chu-blue-light);
  color: var(--chu-blue);
  font-weight: 600;
}

.main-content {
  flex: 1;
  padding: 32px;
  max-width: 960px;
}

/* ─── Page login ────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--chu-blue-light) 0%, var(--white) 60%);
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo img { height: 60px; }
.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  text-align: center;
  margin: 0 0 8px;
}
.login-sub {
  font-size: 14px;
  color: var(--gray-500);
  text-align: center;
  margin: 0 0 32px;
}

/* ─── Formulaires ───────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font-sans);
  color: var(--gray-900);
  background: var(--white);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--chu-blue);
  box-shadow: 0 0 0 3px rgba(21,101,192,.15);
}
.form-control::placeholder { color: var(--gray-300); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-hint {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ─── OTP ────────────────────────────────────────────────────────────────── */
.otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 24px 0;
}
.otp-digit {
  width: 52px;
  height: 64px;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  color: var(--chu-blue);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.otp-digit:focus {
  outline: none;
  border-color: var(--chu-blue);
  box-shadow: 0 0 0 3px rgba(21,101,192,.15);
}

/* ─── Boutons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  transition: all var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--chu-blue);
  color: var(--white);
}
.btn-primary:hover { background: var(--chu-blue-dark); color: var(--white); }
.btn-secondary {
  background: var(--chu-blue-light);
  color: var(--chu-blue);
}
.btn-secondary:hover { background: #d0dff8; }
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.btn-danger:hover { background: #ffcdd2; }
.btn-success {
  background: var(--success-bg);
  color: var(--success);
}
.btn-success:hover { background: #c8e6c9; }
.btn-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Cartes ────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-300);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-body { padding: 24px; }

/* ─── Tableaux ──────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  background: var(--gray-100);
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-300);
  white-space: nowrap;
}
tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  color: var(--gray-700);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--chu-blue-light); }

/* ─── Badges & tags ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue    { background: var(--chu-blue-light); color: var(--chu-blue); }
.badge-green   { background: var(--success-bg);     color: var(--success); }
.badge-orange  { background: var(--warning-bg);     color: var(--warning); }
.badge-red     { background: var(--danger-bg);      color: var(--danger); }
.badge-gray    { background: var(--gray-100);       color: var(--gray-500); }
.badge-violet  { background: #ede7f6; color: #6a1b9a; }

.formation-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Alertes ───────────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error   { background: var(--danger-bg);  color: var(--danger); }
.alert-info    { background: var(--info-bg);    color: var(--info); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }

/* ─── Page title ────────────────────────────────────────────────────────── */
.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--gray-900);
  margin: 0 0 4px;
}
.page-sub {
  font-size: 14px;
  color: var(--gray-500);
  margin: 0 0 28px;
}

/* ─── Stats cards ───────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--gray-300);
  box-shadow: var(--shadow-sm);
}
.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--chu-blue);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
}

/* ─── Session card ──────────────────────────────────────────────────────── */
.session-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-300);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow var(--t-fast);
}
.session-card:hover { box-shadow: var(--shadow-md); }
.session-card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.session-stripe {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  min-height: 40px;
  flex-shrink: 0;
}
.session-info { flex: 1; min-width: 0; }
.session-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 4px;
}
.session-meta {
  font-size: 13px;
  color: var(--gray-500);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.session-meta span { display: flex; align-items: center; gap: 4px; }
.session-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.session-card-body {
  border-top: 1px solid var(--gray-100);
  padding: 16px 20px;
}

/* ─── Disponibilité formateurs ──────────────────────────────────────────── */
.dispo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.dispo-item {
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color var(--t-fast);
}
.dispo-item.disponible  { border-color: var(--success); background: var(--success-bg); }
.dispo-item.indisponible{ border-color: var(--danger);  background: var(--danger-bg); }
.dispo-item.confirme    { border-color: var(--chu-blue); background: var(--chu-blue-light); }
.dispo-item.non-requis  { border-color: var(--gray-300); background: var(--gray-100); opacity: .7; }
.dispo-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--chu-blue-light);
  color: var(--chu-blue);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dispo-name { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.dispo-status { font-size: 12px; color: var(--gray-500); }

/* ─── Toggle dispo formateur ────────────────────────────────────────────── */
.dispo-toggle {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.dispo-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 2px solid var(--gray-300);
  background: var(--white);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  text-align: center;
}
.dispo-btn.dispo-oui { border-color: var(--success); color: var(--success); }
.dispo-btn.dispo-oui.active { background: var(--success); color: var(--white); }
.dispo-btn.dispo-non { border-color: var(--danger); color: var(--danger); }
.dispo-btn.dispo-non.active { background: var(--danger); color: var(--white); }

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in var(--t-med);
}
@keyframes modal-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 18px; font-weight: 700; margin: 0; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--gray-500);
  padding: 4px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.modal-close:hover { background: var(--gray-100); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-300);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray-500);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; margin: 0 0 20px; }

/* ─── Responsive desktop ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar cachée sur mobile — remplacée par FAB */
  .sidebar { display: none; }
  .page-layout { display: block; }
  .main-content { padding: 20px 16px; }
  .card-header { flex-direction: column; align-items: flex-start; }
  .login-card { padding: 32px 24px; }
  .header-inner { padding: 0 16px; }
  .header-title small { display: none; }
  /* Masquer le logo sur mobile */
  .header-logo, .header-sep { display: none; }
  .page-title { font-size: 22px; }
  .otp-inputs { gap: 6px; }
  .otp-digit  { width: 36px; height: 50px; font-size: 22px; padding: 0; }
  .dispo-grid { grid-template-columns: 1fr; }
}

/* ─── FAB menu mobile ────────────────────────────────────────────────────── */

/* Bouton FAB — visible uniquement mobile */
.fab-trigger {
  display: none;
}
@media (max-width: 768px) {
  .fab-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 24px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--chu-blue);
    color: var(--white);
    border: none;
    cursor: pointer;
    z-index: 400;
    box-shadow: 0 4px 16px rgba(21,101,192,.45);
    transition: transform var(--t-fast), background var(--t-fast);
  }
  .fab-trigger:hover { background: var(--chu-blue-dark); }
  .fab-trigger.open  { background: var(--gray-900); transform: rotate(45deg); }

  /* Les deux traits du ✕ / ☰ via pseudo-éléments */
  .fab-trigger::before,
  .fab-trigger::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 2.5px;
    background: var(--white);
    border-radius: 2px;
    transition: transform var(--t-med), opacity var(--t-med);
  }
  .fab-trigger::before { transform: translateY(-5px); }
  .fab-trigger::after  { transform: translateY( 5px); }

  .fab-trigger.open::before { transform: rotate( 45deg) translateY(0); }
  .fab-trigger.open::after  { transform: rotate(-45deg) translateY(0); }
}

/* Overlay pleine page */
.fab-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 71, 161, 0.97);
  z-index: 350;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px 100px;
  animation: fab-overlay-in 200ms ease;
}
.fab-overlay.open { display: flex; }

@keyframes fab-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Items du menu dans l'overlay */
.fab-overlay nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 320px;
}

.fab-overlay .fab-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,.45);
  margin: 16px 0 4px;
  align-self: flex-start;
}

.fab-overlay a {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  color: rgba(255,255,255,.9);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  animation: fab-item-in 250ms ease both;
}
.fab-overlay a:hover,
.fab-overlay a:active {
  background: rgba(255,255,255,.12);
  color: var(--white);
  text-decoration: none;
}
.fab-overlay a.active {
  background: rgba(255,255,255,.18);
  color: var(--white);
}
.fab-overlay a .fab-icon { display: none;
  font-size: 20px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

@keyframes fab-item-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* Infos utilisateur en haut de l'overlay */
.fab-user-info {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 500;
}
.fab-user-info .fab-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  color: var(--white);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Déconnexion en bas */
.fab-logout {
  position: absolute;
  bottom: 32px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}
.fab-logout a {
  color: rgba(255,255,255,.55) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  padding: 8px 20px !important;
  width: auto !important;
}
.fab-logout a:hover { color: var(--white) !important; background: transparent !important; }

/* ─── Utilitaires ───────────────────────────────────────────────────────── */
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: 4px !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-24 { margin-bottom: 24px !important; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--gray-500); }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
