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

/*
 * Stylesheet for the Government of San Andreas portal.
 *
 * The site uses a restrained palette inspired by real‑world government
 * websites: deep blues for structure, rich gold accents for highlights
 * and crisp off‑white text for readability. A consistent border radius and
 * generous spacing give the pages a modern feel while maintaining a
 * sense of gravitas befitting an official portal.  The CSS variables
 * defined at the top make it easy to adjust colours globally.
 */

:root {
  /*
   * Colour palette tuned for a modern yet official look.
   * Primary tones are deep blues for identity, while
   * secondary surfaces are light and airy to reduce visual weight.
   */
  --primary-color: #0a2f5a;      /* rich navy for headers and nav backgrounds */
  --secondary-color: #f5f7fb;    /* very light background for page surfaces */
  --accent-color: #d4af37;       /* gold accent inspired by official crests */
  --light-color: #ffffff;        /* white for cards and forms */
  --text-color: #1d2d44;         /* dark blue‑grey for body text */
  --muted-text: #556b8d;         /* muted tone for secondary text */
  --shadow-color: rgba(0, 0, 0, 0.1);
  --border-radius: 8px;
  --border-color: #e3e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--secondary-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Subtle texture for the page background */
  background-image: linear-gradient(180deg, #ffffff 0%, #f5f7fb 100%);
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: #b18e2e;
}

header {
  background: var(--primary-color);
  box-shadow: 0 2px 4px var(--shadow-color);
  padding: 0.8rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

/*
 * Customised site title styling. The title is split into two
 * elements: a logo image and a text container. By using a
 * dedicated class we avoid side effects on generic h1 tags.
 */
header h1.site-title {
  display: flex;
  align-items: center;
  /* Slightly widen spacing between logo and text */
  gap: 0.8rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
  /* Allow the title to wrap on multiple lines within the container */
  white-space: normal;
}

header h1.site-title img.logo {
  height: 44px;
  width: 44px;
}

header h1.site-title .site-title-text {
  /* Allow natural wrapping and adjust line height for multi‑line headings */
  white-space: normal;
  line-height: 1.1;
  font-size: 1.6rem;
}

nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  /* Reduce spacing so that items fit on a single line more comfortably on medium screens */
  gap: 1rem;
}

nav a {
  /* Use inline‑flex to align text vertically and keep widths flexible */
  display: inline-flex;
  align-items: center;
  position: relative;
  /* Slightly larger vertical padding for better alignment */
  padding: 0.45rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  /* Moderate font size so that many items fit on one line */
  font-size: 0.9rem;
  /* Uniform white text for inactive links */
  color: #ffffff;
  white-space: nowrap;
  transition: color 0.3s ease;
}

nav a:hover,
nav a:focus {
  color: var(--accent-color);
  background: transparent;
}

/* Underline animation for nav links */
nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: width 0.3s ease, left 0.3s ease;
}

nav a:hover::after,
nav a.active::after {
  width: 100%;
  left: 0;
}

nav a.active {
  color: var(--accent-color);
  background: transparent;
}

.hero {
  position: relative;
  background: linear-gradient(135deg, #1d4a89 0%, #0d2a5a 100%);
  /* Réduire la hauteur de la bannière héroïque lorsque le bouton d'appel à l'action est retiré */
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--light-color);
}

.hero h2 {
  font-size: 2.4rem;
  margin-bottom: 0.6rem;
}

.hero p {
  font-size: 1.15rem;
  margin-bottom: 1.6rem;
  max-width: 700px;
}

.btn {
  display: inline-block;
  background: var(--accent-color);
  color: var(--primary-color);
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  transition: background 0.2s ease;
}

.btn:hover {
  background: #b18e2e;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  margin: 3rem auto;
  max-width: 1200px;
  padding: 0 1rem;
}

.feature {
  background: var(--light-color);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px var(--shadow-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-color);
}

.feature h3 {
  font-size: 1.45rem;
  margin-bottom: 0.8rem;
  color: var(--primary-color);
}

.feature p {
  flex: 1;
  margin-bottom: 1.2rem;
  font-size: 1rem;
  color: var(--muted-text);
}

.read-more {
  align-self: flex-start;
  margin-top: auto;
  font-weight: 600;
  color: var(--accent-color);
}

main {
  flex: 1;
}

section.content {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--light-color);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px var(--shadow-color);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.card h2 {
  font-size: 1.6rem;
  margin-bottom: 0.8rem;
  color: var(--primary-color);
}

/* Styles for admin dashboard modules */
.admin-modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  list-style: none;
  padding: 0;
  margin: 2rem 0;
}

.admin-modules li {
  background: var(--light-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px var(--shadow-color);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.admin-modules li a {
  display: block;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  padding: 1.5rem;
  height: 100%;
}

.admin-modules li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-color);
}

.admin-modules li a:hover {
  color: var(--accent-color);
}

/* Styles for agent board and service list */
.agent-board {
  width: 100%;
  border-collapse: collapse;
}

/* Définition des cellules du tableau des agents pour un rendu plus fin et lisible */
.agent-board th,
.agent-board td {
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  text-align: left;
  font-size: 0.85rem;
}



/* Style pour le lien Retour en haut de chaque page */
/* Lien de retour modernisé : apparence de bouton avec icône plus grande */
.back-link {
  /* Style du lien retour : aspect plus compact et léger.
     Utiliser un fond semi‑transparent plutôt qu'un blanc plein et
     réduire l'espacement entre l'icône et le texte pour un rendu plus
     harmonieux. */
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius);
  padding: 0.35rem 0.65rem;
  margin-right: 1rem;
  box-shadow: 0 1px 2px var(--shadow-color);
  transition: background 0.2s ease, transform 0.1s ease;
  /* Réduire la hauteur de ligne pour aligner l'icône avec le texte */
  line-height: 1;
}

.back-link:hover {
  /* Légère opacité accrue au survol pour donner un retour visuel */
  background: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transform: translateY(-1px);
}

/* Calendrier interactif pour la page Agenda */
.calendar {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.calendar-header button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--primary-color);
}
.calendar-header span {
  font-weight: bold;
  font-size: 1.2rem;
  color: var(--primary-color);
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}
.calendar-grid .day {
  background: var(--light-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.6rem;
  min-height: 70px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-end;
  position: relative;
  box-shadow: 0 1px 3px var(--shadow-color);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  overflow: hidden;
}
.calendar-grid .day span {
  font-size: 0.8rem;
  font-weight: bold;
  align-self: flex-start;
}
.calendar-grid .day.has-event {
  background: rgba(232, 208, 105, 0.2);
  border-color: var(--accent-color);
}
.calendar-grid .day.has-event:hover {
  background: rgba(232, 208, 105, 0.35);
}
.calendar-grid .day:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-color);
}

/* Jours passés : apparence grisée mais toujours interactifs */
.calendar-grid .day.past {
  background: #f0f2f5;
  color: var(--muted-text);
  opacity: 0.6;
}

.calendar-grid .day.past.has-event {
  background: #f2eacc;
  border-color: var(--accent-color);
}
.calendar-grid .day.today {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-color);
}

/* Boutons stylés pour les actions (modifier, supprimer, etc.) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
  color: #fff;
}
.btn-edit {
  background: #2a6e4f;
}
.btn-edit:hover {
  background: #21593f;
}
.btn-delete {
  background: #e03a4c;
}
.btn-delete:hover {
  background: #c72f3f;
}

/* Bouton pour consulter un document ou une annonce */
.btn-view {
  background: var(--accent-color);
  color: var(--primary-color);
}
.btn-view:hover {
  background: #b18e2e;
}

/*
 * Styles pour les listes administratives de demandes et candidatures.
 * Utilise l’élément <details> pour afficher un résumé cliquable
 * et un contenu détaillé. Ces éléments remplacent les tableaux
 * pour offrir une présentation plus moderne et lisible.
 */
.admin-list details {
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--light-color);
  box-shadow: 0 1px 3px var(--shadow-color);
  overflow: hidden;
}
.admin-list summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-color);
  background: var(--secondary-color);
  list-style: none;
}
.admin-list details[open] summary {
  border-bottom: 1px solid var(--border-color);
}
.admin-list details div {
  padding: 0.75rem 1rem;
  line-height: 1.5;
}
.admin-list img {
  max-width: 100%;
  height: auto;
  margin-top: 0.5rem;
  border-radius: var(--border-radius);
}
.event-details {
  background: #f6f6f6;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
}
.event-details h3 {
  margin-top: 0;
  color: var(--primary-color);
}
.event-details p {
  margin: 0.25rem 0;
}

/* Remplacé par un style modernisé plus haut. */

/* Toast notifications container */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

/* Individual toast message */
.toast {
  background: var(--primary-color);
  color: var(--light-color);
  padding: 0.8rem 1rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px var(--shadow-color);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  opacity: 0;
  transform: translateX(100%);
  animation: slideIn 0.4s forwards;
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.agent-board input[type="checkbox"] {
  transform: scale(1.3);
  margin-right: 0.4rem;
}

.agent-board select {
  width: 100%;
  max-width: 200px;
  padding: 0.3rem;
}

.agent-board input[type="text"] {
  width: 100%;
  max-width: 200px;
  padding: 0.3rem;
}

.agent-board button {
  background: var(--accent-color);
  border: none;
  color: #fff;
  padding: 0.35rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.agent-board button:hover {
  opacity: 0.9;
}

.service-list h3 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.service-card {
  background: var(--light-color);
  border: 1px solid var(--border-color);
  padding: 0.8rem 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px var(--shadow-color);
}

.service-card h4 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: var(--primary-color);
}

.service-card p {
  margin: 0.2rem 0;
  font-size: 0.9rem;
  color: var(--text-color);
}

/* Avatar / photo de profil dans les listes */
.user-photo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Avatar plus grand pour la liste des agents en service */
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.3rem;
}

.card p {
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
}

form {
  background: var(--light-color);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px var(--shadow-color);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--primary-color);
}

form input,
form select,
form textarea {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  background: var(--secondary-color);
  color: var(--text-color);
}

form button {
  background: var(--accent-color);
  color: var(--primary-color);
  border: none;
  padding: 0.7rem 1.2rem;
  border-radius: var(--border-radius);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

form button:hover {
  background: #b18e2e;
}

footer {
  background: var(--primary-color);
  text-align: center;
  padding: 1rem;
  font-size: 0.9rem;
  color: var(--light-color);
}

footer a {
  color: var(--accent-color);
}

/* Table styles for agenda and listings */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

table thead {
  background: var(--primary-color);
  color: var(--light-color);
}

table th, table td {
  padding: 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

table tbody tr:nth-child(even) {
  background: #f9fafc;
}

table tbody tr:nth-child(odd) {
  background: #eef2f7;
}

table tbody tr:hover {
  background: #e6ecf5;
}

/* Announcement and decree cards on lists */
.article-card {
  background: var(--light-color);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 4px var(--shadow-color);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.article-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.3rem;
  color: var(--primary-color);
}

.article-card p {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--muted-text);
}

.article-card .meta {
  font-size: 0.85rem;
  color: var(--muted-text);
  margin-bottom: 0.5rem;
}

.article-card a {
  color: var(--accent-color);
  font-weight: 600;
}

.article-card a:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero h2 {
    font-size: 1.8rem;
  }
  .hero p {
    font-size: 0.95rem;
  }
  header h1 {
    font-size: 1.4rem;
  }
  nav ul {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* -------------------------------------------------- */
/* Composants personnalisés en bas de fichier
 * Style pour le checkbox "Se souvenir de moi" sur la page de connexion.
 */
.remember-me input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--background-color);
  position: relative;
  cursor: pointer;
  margin-right: 0.4rem;
}
.remember-me input[type="checkbox"]:checked {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
}
.remember-me input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 4px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.1s ease-in-out;
}
.remember-me input[type="checkbox"]:checked::after {
  transform: rotate(45deg) scale(1);
}