/* ===========================
   Couleurs principales
   =========================== */
:root {
  --blue: #004a8f;        /* Bleu principal */
  --blue-dark: #003667;   /* Bleu foncé */
  --blue-light: #e8f2ff;  /* Bleu très clair */
  --grey-bg: #f5f5f5;     /* Fond gris clair */
  --text: #333333;        /* Texte */
  --border: #d0d7e0;      /* Lignes / contours doux */
}

/* ===========================
   Base
   =========================== */
* {
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--grey-bg);
  color: var(--text);
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===========================
   En-tête
   =========================== */
header {
  background: white;
  color: var(--blue-dark);
  padding: 20px 15px;
  text-align: center;
  border-bottom: 4px solid var(--blue);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

header p {
  margin: 8px 0 0;
  font-size: 1rem;
}

/* ===========================
   Structure générale
   =========================== */
main {
  max-width: 1000px;
  margin: 25px auto 40px;
  padding: 0 15px;
}

.intro,
.modules,
.download-pack {
  background: #ffffff;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.intro h2,
.modules h2,
.download-pack h2 {
  margin-top: 0;
  color: var(--blue-dark);
}

.intro p,
.modules p,
.download-pack p,
.intro ol {
  line-height: 1.5;
  font-size: 1.05rem;
}

.download-link {
  display: inline-block;
  margin-top: 8px;
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.download-link:hover {
  background: var(--blue-dark);
  text-decoration: none;
}

.download-note {
  margin-top: 10px;
  font-size: 0.95rem;
  color: #555555;
}

.needs-helper {
  background: #ffffff;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.needs-helper h2 {
  margin-top: 0;
  color: var(--blue-dark);
}

.needs-helper p {
  line-height: 1.5;
  font-size: 1.05rem;
}

.needs-helper label {
  display: block;
  margin: 14px 0 6px;
}

.solution-grid {
  margin-top: 16px;
}

.solution-hint {
  margin: 0 0 10px 0;
  font-weight: 600;
  color: var(--blue-dark);
}

.solution-cards {
  display: grid;
  gap: 14px;
}

@media (min-width: 700px) {
  .solution-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.solution-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.solution-card img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}

.solution-card h3 {
  margin: 4px 0;
  color: var(--blue-dark);
}

.solution-card p {
  margin: 0;
  line-height: 1.4;
  flex: 1;
}

.solution-link {
  align-self: flex-start;
  font-weight: bold;
}

/* ===========================
   Liste de modules (accueil)
   =========================== */
.module-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.module-list li {
  margin-bottom: 10px;
}

.module {
  display: block;
  padding: 15px;
  font-size: 1.05rem;
  border-radius: 8px;
  border: 2px solid var(--blue);
  background: white;
  text-align: center;
  font-weight: 600;
}

.module:hover {
  background: var(--blue-light);
}

.module.disabled {
  border-color: #aaa;
  color: #777;
  cursor: not-allowed;
  background: #eee;
  font-weight: 400;
}

/* ===========================
   Cours
   =========================== */
.container {
  max-width: 1000px;
  margin: 25px auto 40px;
  padding: 0 15px;
}

.course-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 12px;
}

.course-item {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.course-item h3 {
  margin: 0 0 6px;
  color: var(--blue-dark);
}

.course-item p {
  margin: 0 0 8px;
  line-height: 1.4;
}

.course-loader {
  display: grid;
  gap: 10px;
}

.course-content {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.course-content.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.skeleton-card {
  position: relative;
  overflow: hidden;
}

.skeleton-line,
.skeleton-block {
  background: linear-gradient(90deg, #f0f0f0 25%, #e5e5e5 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
  border-radius: 6px;
}

.skeleton-line {
  height: 12px;
  margin: 8px 0;
}

.skeleton-title {
  height: 18px;
  width: 60%;
}

.skeleton-short {
  width: 40%;
}

.skeleton-block {
  height: 90px;
}

@keyframes skeleton {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.block {
  margin: 14px 0;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
}

.block-image img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}

.block-links ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.muted {
  color: #666666;
  font-size: 0.95rem;
}

/* ===========================
   Admin
   =========================== */
.admin-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 900px) {
  .admin-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.small-btn {
  padding: 8px 12px;
  font-size: 0.95rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  width: min(900px, 100%);
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-overlay.is-visible .modal {
  transform: translateY(0);
  opacity: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #fdfdfd;
}

.modal-header h3 {
  margin: 0;
  color: var(--blue-dark);
}

.modal-body,
.modal-content {
  padding: 18px 20px 20px;
  overflow-y: auto;
}

.modal-close {
  background: transparent;
  color: var(--blue-dark);
  border: 1px solid transparent;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--blue-light);
}

.modal :focus-visible,
.modal-close:focus-visible {
  outline: 3px solid rgba(0, 74, 143, 0.35);
  outline-offset: 2px;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 650px) {
  .modal-overlay {
    padding: 12px;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
  }

  .modal-body,
  .modal-content {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal {
    transition: none;
  }

  .modal {
    transform: none;
  }
}

.danger-btn {
  background: #cc3030;
}

.danger-btn:hover {
  background: #a92727;
}

.block-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  background: #ffffff;
}

.block-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.block-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.links-items {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.link-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
}

.image-preview {
  margin: 10px 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: #fafafa;
}

.image-preview img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  max-height: 260px;
  object-fit: cover;
}

@media (max-width: 650px) {
  .link-row {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   Boutique (achat.html)
   =========================== */
.product-list {
  display: grid;
  gap: 15px;
}

@media (min-width: 700px) {
  .product-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.product-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: white;
  text-align: center;
}

.product-card img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin-bottom: 8px;
}

.product-card h3 {
  margin: 5px 0;
  color: var(--blue-dark);
}

/* Carte explicative (paiement, etc.) */
.fake-card {
  background: var(--blue-light);
  padding: 12px;
  border-radius: 6px;
  border-left: 4px solid var(--blue);
}

/* ===========================
   Formulaires / champs
   =========================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="month"],
input[type="date"],
select,
textarea {
  width: 100%;
  max-width: 450px;
  padding: 10px;
  margin-top: 4px;
  border-radius: 5px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

textarea {
  resize: vertical;
}

/* Boutons */
button[type="submit"],
button {
  padding: 12px 22px;
  font-size: 1.05rem;
  border-radius: 8px;
  border: none;
  background: var(--blue);
  color: white;
  cursor: pointer;
  font-weight: bold;
}

button:hover {
  background: var(--blue-dark);
}

/* ===========================
   Messages de feedback
   =========================== */
.success-message {
  margin-top: 20px;
  padding: 20px;
  border-radius: 10px;
  background: #e8f9e8;
  border: 2px solid #3c9a3c;
  text-align: center;
  font-size: 1.15rem;
}

.success-message .check {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 5px;
}

.error-message {
  margin-top: 20px;
  padding: 20px;
  border-radius: 10px;
  background: #fdeaea;
  border: 2px solid #cc3030;
  text-align: center;
  font-size: 1.05rem;
}

.error-message .cross {
  font-size: 2rem;
  display: block;
  margin-bottom: 5px;
}

.hidden {
  display: none;
}

/* ===========================
   Bouton Accueil centré
   =========================== */
.home-button-container {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.home-btn {
  padding: 14px 26px;
  background: var(--blue);
  color: white;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: bold;
  border: none;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.home-btn:hover {
  background: var(--blue-dark);
}

.admin-cta-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.admin-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--blue-dark);
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0, 54, 103, 0.25);
}

.admin-cta:hover {
  background: var(--blue);
  text-decoration: none;
}

.admin-cta:focus-visible {
  outline: 3px solid rgba(0, 74, 143, 0.4);
  outline-offset: 2px;
}

/* ===========================
   Champs mot de passe + œil
   =========================== */
.password-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 450px;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  width: 100%;
  padding-right: 40px; /* place pour l'icône œil */
}

.password-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  width: 22px;
  height: 22px;
  opacity: 0.6;
  user-select: none;
}

.password-eye:hover {
  opacity: 1;
}

/* Icône œil (ouvert) */
.password-eye.open::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' fill='%23666' viewBox='0 0 24 24'><path d='M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zm0 13c-3 0-5.5-2.46-5.5-5.5S9 6.5 12 6.5s5.5 2.46 5.5 5.5-2.5 5.5-5.5 5.5zm0-9c-1.93 0-3.5 1.57-3.5 3.5S10.07 15.5 12 15.5 15.5 13.93 15.5 12 13.93 8.5 12 8.5z'/></svg>");
}

/* Icône œil barré (fermé) */
.password-eye.closed::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' fill='%23666' viewBox='0 0 24 24'><path d='M12 6.5c3 0 5.5 2.46 5.5 5.5 0 .78-.16 1.53-.45 2.21l3.17 3.17-.71.71-3.07-3.07c-.91.88-2.11 1.43-3.44 1.43-3 0-5.5-2.46-5.5-5.5 0-1.33.55-2.53 1.43-3.44L6.39 6.39l.71-.71 3.17 3.17c.68-.29 1.43-.45 2.21-.45zm0-2c5 0 9.27 3.11 11 7.5-.73 1.84-1.89 3.44-3.33 4.72l-.71-.71c1.28-1.14 2.29-2.57 2.93-4.01C20.73 8.61 16 5.5 12 5.5c-1.71 0-3.33.41-4.77 1.12l-.76-.76C8.12 5.69 10 5 12 5z'/></svg>");
}

/* ===========================
   Pied de page
   =========================== */
footer {
  text-align: center;
  padding: 12px;
  background: var(--blue-dark);
  color: white;
  font-size: 0.9rem;
  margin-top: 40px;
}
