/* ResaPlateforme — CSS écrit à la main, sans framework ni étape de build. */

:root {
  --blue: #1f4e79;
  --blue-dark: #163a5a;
  --grey: #6b7785;
  --grey-light: #f4f6f8;
  --border: #d5dbe1;
  --red: #c0392b;
  --orange: #e67e22;
  --green: #1e8449;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  color: #22282e;
  background: #fff;
}

a { color: var(--blue); }

/* --- Navigation --- */
.navbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.6rem 1.5rem;
  background: var(--blue);
  color: #fff;
  flex-wrap: wrap;
}
.navbar a { color: #fff; text-decoration: none; }
.navbar a:hover { text-decoration: underline; }
.brand { font-weight: 700; font-size: 1.15rem; }
.nav-links { display: flex; gap: 1rem; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.nav-right .user { font-weight: 600; }
form.inline { display: inline; margin: 0; }
button.link {
  background: none; border: none; color: #fff; cursor: pointer;
  font: inherit; text-decoration: underline; padding: 0;
}

/* --- Cloche de notifications --- */
.bell { position: relative; }
#bell-button {
  background: none; border: none; color: #fff; cursor: pointer;
  font-size: 1.25rem; position: relative; padding: 0.1rem 0.3rem;
}
.badge {
  position: absolute; top: -6px; right: -10px;
  background: var(--orange); color: #fff; border-radius: 10px;
  font-size: 0.7rem; padding: 0 0.35rem; font-weight: 700;
}
.bell-dropdown {
  position: absolute; right: 0; top: 130%; width: 22rem; z-index: 50;
  background: #fff; color: #22282e;
  border: 1px solid var(--border); border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
/* Le menu est imbriqué dans .navbar : on annule `.navbar a { color: #fff }`,
   sinon les liens seraient blancs sur le fond blanc du menu. */
.bell-dropdown a { color: var(--blue); text-decoration: underline; }
.bell-dropdown ul { list-style: none; margin: 0; padding: 0; max-height: 20rem; overflow-y: auto; }
.bell-dropdown li { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--grey-light); font-size: 0.88rem; }
.bell-dropdown li.unread { background: #fdf6ec; font-weight: 600; }
.bell-dropdown li .date { display: block; color: var(--grey); font-size: 0.75rem; }
.bell-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0.75rem; background: var(--grey-light); font-size: 0.85rem;
}
.bell-footer button {
  background: none; border: none; color: var(--blue);
  cursor: pointer; font: inherit; text-decoration: underline; padding: 0;
}

/* --- Contenu --- */
.content { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.page-header { display: flex; align-items: center; gap: 1rem; }
.page-header h1 { margin-right: auto; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; margin-top: 2rem; }

.card {
  border: 1px solid var(--border); border-radius: 4px;
  padding: 1.25rem 1.5rem; background: #fff;
}
.card-narrow { max-width: 34rem; margin: 0 auto; }

.toolbar {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 0.75rem 0 1rem; flex-wrap: wrap;
}
.legend { margin-left: auto; color: var(--grey); font-size: 0.85rem; }
.chip {
  display: inline-block; width: 0.9rem; height: 0.9rem;
  border-radius: 2px; vertical-align: middle; margin: 0 0.2rem 0 0.6rem;
}
.chip-approved { background: var(--red); }
.chip-pending { background: var(--orange); }
.chip-unavailable { background: #95a5a6; }

/* --- Formulaires --- */
.field { margin-bottom: 0.9rem; }
.field label, .card label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
input[type="text"], input[type="password"], input[type="date"],
input[type="number"], select, textarea {
  width: 100%; padding: 0.4rem 0.5rem;
  border: 1px solid var(--border); border-radius: 3px;
  font: inherit; background: #fff;
}
input[type="checkbox"] { width: auto; }
.hint { color: var(--grey); font-size: 0.85rem; }
.error { color: var(--red); font-size: 0.85rem; display: block; }

/* Case à cocher de confirmation : libellé sur la même ligne que la case. */
.field-check label { font-weight: 400; display: flex; gap: 0.5rem; align-items: flex-start; }

/* Sections de la fiche de réservation (cf. tableaux du formulaire legacy). */
.form-section {
  border: 1px solid var(--border); border-radius: 3px;
  padding: 0.9rem 1rem 0.2rem; margin: 0 0 1.2rem;
}
.form-section legend {
  font-weight: 600; font-size: 0.95rem; padding: 0 0.4rem;
  color: var(--blue-dark, #22282e);
}
/* Groupe de boutons radio : une option par ligne. */
.field-radio ul { list-style: none; margin: 0; padding: 0; }
.field-radio li label { font-weight: 400; display: flex; gap: 0.5rem; align-items: center; }
/* Valeur non saisissable (le centre, dérivé du compte). */
.field-readonly .static-value { margin: 0; }
.overlap-list {
  margin: 0.4rem 0; padding-left: 1.2rem; font-size: 0.88rem;
}

.btn {
  display: inline-block; padding: 0.4rem 0.9rem;
  border: 1px solid var(--border); border-radius: 3px;
  background: var(--grey-light); color: #22282e;
  cursor: pointer; font: inherit; text-decoration: none;
}
.btn:hover { background: #e8ecef; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #a5322a; }

/* --- Messages --- */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.msg {
  padding: 0.6rem 0.9rem; margin-bottom: 0.4rem; border-radius: 3px;
  border-left: 4px solid var(--grey);
  background: var(--grey-light);
}
.msg-success { border-color: var(--green); background: #eaf6ee; }
.msg-error { border-color: var(--red); background: #fbeceb; }
.msg-warning { border-color: var(--orange); background: #fdf3e7; }
.msg-info { border-color: var(--blue); background: #eef3f8; }

/* --- Tableaux --- */
/* Les tableaux ne s'effondrent pas : on les fait défiler sur écran étroit. */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.table th, .table td {
  border: 1px solid var(--border); padding: 0.5rem 0.6rem;
  text-align: left; vertical-align: top;
}
.table th { background: var(--grey-light); }
.table td.purpose { max-width: 20rem; white-space: pre-wrap; }
/* Texte libre saisi par l'utilisateur : retours à la ligne conservés. */
.table td.pre { white-space: pre-wrap; }
/* L'objet passe à la ligne sous l'intitulé. */
.table td.purpose .hint { display: block; }
.table td.actions { min-width: 14rem; }
.table td.actions form { margin-bottom: 0.4rem; }

.status { padding: 0.1rem 0.45rem; border-radius: 10px; font-size: 0.8rem; color: #fff; white-space: nowrap; }
.status-pending { background: var(--orange); }
.status-approved { background: var(--green); }
.status-rejected { background: var(--red); }
.status-cancelled { background: var(--grey); }

/* --- Validation staff : cartes de revue --- */
/* En-tête de section, aligné sur `.page-header` mais pour un niveau h2. */
.section-header {
  display: flex; align-items: baseline; gap: 1rem;
  flex-wrap: wrap; margin-top: 2rem;
}
.section-header h2 { margin: 0 auto 0 0; }

.review-list { display: grid; gap: 1rem; margin: 1rem 0; }
/* Liseré gauche : orange = en attente, rouge = approbation bloquée,
   vert = déjà approuvée (cohérent avec les badges `.status-*`). */
.review-card { border-left: 4px solid var(--orange); padding: 1.1rem 1.35rem; }
.review-card-blocked { border-left-color: var(--red); background: #fdf8f7; }
.review-card-approved { border-left-color: var(--green); }

.review-head {
  display: flex; align-items: baseline; gap: 0.5rem 1rem; flex-wrap: wrap;
}
.review-head h3 {
  margin: 0 auto 0 0; font-size: 1.1rem; font-weight: 700;
  color: var(--blue); line-height: 1.3;
}
/* Métadonnées du créneau : une seule ligne séparée par des « · », assez aérée
   pour rester lisible quand elle se replie. */
.review-meta {
  margin: 0.3rem 0 0; color: var(--grey); font-size: 0.88rem; line-height: 1.5;
}
.review-alerts { margin-top: 0.9rem; }
.review-alerts .msg:last-child { margin-bottom: 0; }
/* Motif de décision : les retours à la ligne du texte saisi sont conservés. */
.review-alerts .pre { display: block; white-space: pre-wrap; }

/* Trois colonnes de largeur égale, séparées de l'en-tête par un filet : la
   fiche se lit comme un bloc distinct des alertes et du pied d'actions.
   `align-items: start` évite que les colonnes courtes s'étirent. */
.review-body {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem 2rem; align-items: start;
  border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 1rem;
}
/* Colonne : empile ses groupes avec un interligne franc (les groupes sont
   regroupés dans le gabarit, pas laissés au flux automatique de la grille). */
.review-col { display: grid; gap: 1.1rem; align-content: start; min-width: 0; }
.review-group { min-width: 0; }
.review-group-title {
  margin: 0 0 0.5rem; padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--blue); font-weight: 700;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
}
/* Même principe que `.detail-grid`, mais la colonne de libellés s'ajuste à son
   contenu : 16rem seraient trop larges dans une carte à trois colonnes, et une
   largeur fixe ferait replier « Création plan de vol ». */
.review-grid {
  display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: 0.35rem 0.9rem; margin: 0; font-size: 0.92rem; line-height: 1.45;
}
.review-grid dt { font-weight: 600; color: var(--grey); white-space: nowrap; }
.review-grid dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* Objet : seul dans sa colonne, en bloc de texte plutôt qu'en paire
   libellé/valeur, pour que les descriptions longues restent lisibles. */
.review-text {
  margin: 0; padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--border); border-radius: 0 3px 3px 0;
  background: var(--grey-light);
  font-size: 0.92rem; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
}

.tag {
  display: inline-block; margin: 0 0.2rem 0.2rem 0; padding: 0.05rem 0.4rem;
  border: 1px solid var(--border); border-radius: 3px;
  background: var(--grey-light); font-size: 0.8rem;
}
.nowrap { white-space: nowrap; }

.review-actions {
  display: flex; align-items: flex-start; gap: 0.75rem; flex-wrap: wrap;
  border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 0.9rem;
}
.review-actions form { margin: 0; }
/* Le motif de refus/annulation est replié : l'approbation est le cas dominant. */
.reject-box summary { cursor: pointer; color: var(--red); }
.reject-box[open] summary { margin-bottom: 0.5rem; }
.reject-box label { font-weight: 600; font-size: 0.88rem; }
/* Contourne `textarea { width: 100% }` pour éviter un champ démesuré. */
.reject-box textarea { max-width: 30rem; margin-bottom: 0.5rem; }

/* Attribution de la plateforme : le <select> tient sur la ligne d'actions,
   aligné sur le bouton. `select { width: 100% }` est contourné. */
.approve-form { display: flex; align-items: flex-end; gap: 0.6rem; flex-wrap: wrap; }
.approve-form > div { display: flex; flex-direction: column; }
.approve-form label { font-weight: 600; font-size: 0.88rem; margin-bottom: 0.2rem; }
.approve-form select { width: auto; min-width: 18rem; }
@media (max-width: 700px) {
  .approve-form { align-items: stretch; }
  .approve-form select { min-width: 0; width: 100%; }
}

/* Les colonnes du gabarit restent solidaires : seules leurs positions
   changent (3 → 2 → 1), jamais la composition des groupes. */
@media (max-width: 1150px) {
  .review-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .review-body { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .review-grid { grid-template-columns: 1fr; gap: 0 0; }
  .review-grid dt { white-space: normal; }
  .review-grid dd { margin-bottom: 0.4rem; }
}

/* --- Fiche détaillée d'une réservation --- */
.detail-grid {
  display: grid; grid-template-columns: 16rem 1fr;
  gap: 0.4rem 1rem; margin: 0;
}
.detail-grid dt { font-weight: 600; color: var(--grey); }
.detail-grid dd { margin: 0; }
.detail-grid dd.pre { white-space: pre-wrap; }
@media (max-width: 700px) {
  .detail-grid { grid-template-columns: 1fr; gap: 0 0; }
  .detail-grid dd { margin-bottom: 0.5rem; }
}

/* --- Liste de notifications --- */
.notification-list { list-style: none; padding: 0; }
.notification-list li {
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--grey-light);
}
.notification-list li.unread { background: #fdf6ec; font-weight: 600; }
.notification-list .date { color: var(--grey); font-size: 0.8rem; margin-right: 0.6rem; }

/* --- Calendrier --- */
#calendar { max-width: 100%; }
/* En vue mois, le titre d'un événement d'arrière-plan (indisponibilité) est
   rendu en haut à gauche de la case, sous le numéro du jour : on le décale
   pour éviter la superposition. */
.fc-daygrid-day-bg .fc-bg-event .fc-event-title { margin-top: 1.7em; }
/* Réservation dont la fiche est consultable par l'utilisateur courant. */
.fc-event.clickable { cursor: pointer; }
