/* Theme Utilities for Django Templates - Light mode only */

/* Text contrast utilities */
.text-contrast-high {
  color: rgb(17 24 39);
}

.text-contrast-medium {
  color: rgb(55 65 81);
}

.text-contrast-low {
  color: rgb(107 114 128);
}

.text-muted {
  color: rgb(156 163 175);
}

/* Background utilities */
.bg-card {
  background-color: rgb(255 255 255);
}

.bg-card-secondary {
  background-color: rgb(249 250 251);
}

/* Border utilities */
.border-card {
  border-color: rgb(229 231 235);
}

/* Hover states */
.hover-card:hover {
  background-color: rgb(249 250 251);
}

/* Menu items */
.menu-item {
  color: rgb(55 65 81);
}

.menu-item:hover {
  background-color: rgb(243 244 246);
}

.menu-item-active {
  background-color: rgb(243 244 246);
  color: rgb(17 24 39);
}

/* Form elements */
.form-input {
  background-color: rgb(255 255 255);
  border-color: rgb(209 213 219);
  color: rgb(17 24 39);
}

.form-input::placeholder {
  color: rgb(107 114 128);
  opacity: 1;
}

/* Button utilities */
.btn-primary {
  background: linear-gradient(to right, rgb(147 51 234), rgb(168 85 247));
  color: rgb(255 255 255);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: linear-gradient(to right, rgb(126 34 206), rgb(147 51 234));
}

/* Prose / CKEditor : images incrustees centrees (quand pas 100% largeur) */
.prose img,
.content-page.prose img,
.qualiopi-content.prose img,
.news-article-content.prose img {
  display: block !important;
  float: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
/* figure.image : CKEditor utilise display:table, on centre sans ecraser la largeur (50%, etc.) */
.prose figure,
.prose figure.image,
.content-page.prose figure,
.qualiopi-content.prose figure,
.news-article-content.prose figure {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
  float: none !important;
  text-align: center;
}
.prose figure img,
.content-page.prose figure img,
.qualiopi-content.prose figure img,
.news-article-content.prose figure img {
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Prose / CKEditor : listes et puces plus visibles */
.prose ul,
.prose ol {
  padding-left: 2em;
  list-style-position: outside;
}
.prose ul > li::marker {
  color: #334e68;
}
.prose ol > li::marker {
  color: #334e68;
}
/* CKEditor 5 : images centrees dans l'editeur */
.ck-content img {
  display: block !important;
  float: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.ck-content figure {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  text-align: center;
  float: none !important;
}

/* CKEditor 5 : meme style dans l'editeur */
.ck-content ul,
.ck-content ol {
  padding-left: 2em;
  list-style-position: outside;
}
.ck-content ul > li::marker {
  color: #334e68;
}
.ck-content ol > li::marker {
  color: #334e68;
}

/* CKEditor 5 : sous-titres (h2) et sous-sous-titres (h3) bien visibles dans l'editeur */
.ck-content h2 {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  color: #0a2a49 !important;
  margin-top: 1.5rem !important;
  margin-bottom: 0.75rem !important;
  padding: 0.5rem 0 0.5rem 1rem !important;
  border-left: 4px solid rgb(10 168 201) !important;
  background-color: rgba(10, 168, 201, 0.08) !important;
  border-radius: 0 0.375rem 0.375rem 0 !important;
}
.ck-content h3 {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  color: #334e68 !important;
  margin-top: 1.25rem !important;
  margin-bottom: 0.5rem !important;
  padding: 0.35rem 0 0.35rem 0.75rem !important;
  border-left: 3px solid rgba(10, 168, 201, 0.5) !important;
  background-color: rgba(10, 168, 201, 0.05) !important;
  border-radius: 0 0.25rem 0.25rem 0 !important;
}

/* Paragraphes des articles CKEditor : même typo que le hero landing (sauf liens et boutons) */
.content-page.prose p,
.qualiopi-content.prose p,
.news-article-content.prose p {
  font-family: Athelas, Georgia, Cambria, "Times New Roman", Times, serif !important;
  font-size: 1.25rem !important;
  line-height: 1.625;
}
.content-page.prose p a,
.qualiopi-content.prose p a,
.news-article-content.prose p a,
.content-page.prose a,
.qualiopi-content.prose a,
.news-article-content.prose a {
  font-family: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}
/* Liens et boutons : garder la police par défaut (sans-serif) */
.content-page.prose p a,
.qualiopi-content.prose p a,
.news-article-content.prose p a,
.content-page.prose a.content-btn,
.qualiopi-content.prose a.content-btn,
.news-article-content.prose a.content-btn {
  font-family: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* Lien style bouton dans le contenu (choix Lien / Bouton dans CKEditor) */
.prose a.content-btn,
.content-page a.content-btn,
.qualiopi-content a.content-btn,
.news-article-content a.content-btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: opacity 0.2s, background-color 0.2s;
}
.prose a.content-btn:hover,
.content-page a.content-btn:hover,
.qualiopi-content a.content-btn:hover,
.news-article-content a.content-btn:hover {
  opacity: 0.9;
  text-decoration: none !important;
}

/* Boutons : couleur selon la carte, largeur et centrage */
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 1) .prose-section-card a.content-btn {
  display: block;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  background-color: #0aa8c9;
  color: white !important;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 2) .prose-section-card a.content-btn {
  display: block;
  width: 100%;
  text-align: center;
  background-color: #92bd3f;
  color: white !important;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n) .prose-section-card a.content-btn {
  display: block;
  width: 100%;
  text-align: center;
  background-color: #c9cc2e;
  color: #0a2a49 !important;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 1) .prose-section-card a.content-btn:hover,
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 2) .prose-section-card a.content-btn:hover {
  color: white !important;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n) .prose-section-card a.content-btn:hover {
  color: #0a2a49 !important;
}

/* Même style dans l'éditeur CKEditor */
.ck-content a.content-btn {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: rgb(10 42 73);
  color: white !important;
  border-radius: 0.375rem;
  font-weight: 600;
  text-decoration: none !important;
}

/* Sections CKEditor : sous-titre au-dessus de chaque carte */
.prose-sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
/* Bloc 1, 4, 7... : pleine largeur */
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 1) {
  grid-column: 1 / -1;
}
.prose-section-title {
  margin-top: 1.75rem;
  margin-bottom: 1.75rem;
}
.prose-section-card {
  padding: 1.5rem 1.5rem 1.5rem 1.25rem;
  background-color: rgb(255 255 255);
  border: 1px solid rgb(229 231 235);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}
/* Premier element dans une carte : reduire marge haute */
.prose-section-card > h3:first-child {
  margin-top: 0 !important;
}
/* Images centrees dans chaque carte (sans ecraser la largeur 50%, etc. definie par l'utilisateur) */
.prose-section-card img {
  display: block !important;
  float: none !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.prose-section-card figure,
.prose-section-card figure.image {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
  text-align: center;
}
.prose-section-card figure img {
  margin-left: auto !important;
  margin-right: auto !important;
}
/* Contours selon position */
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 1) .prose-section-card {
  border-left: 4px solid #c7e7ec;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 2) .prose-section-card {
  border-left: 4px solid #92bd3f;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n) .prose-section-card {
  border-left: 4px solid #c9cc2e;
}

/* Sous-titres (au-dessus des cartes) : couleur selon la section */
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 1) .prose-section-title {
  border-left-color: #c7e7ec !important;
  color: #0aa8c9 !important;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 2) .prose-section-title {
  border-left-color: #92bd3f !important;
  color: #92bd3f !important;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n) .prose-section-title {
  border-left-color: #c9cc2e !important;
  color: #c9cc2e !important;
}

/* h3, blockquotes dans les cartes : couleur selon la section */
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 1) .prose-section-card h3 {
  border-left-color: rgba(199, 231, 236, 0.8) !important;
  color: #334e68 !important;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 1) .prose-section-card blockquote {
  border-left-color: #c7e7ec !important;
  background-color: rgba(199, 231, 236, 0.3) !important;
}

.prose-sections-grid > .prose-section-wrap:nth-child(3n + 2) .prose-section-card h3 {
  border-left-color: rgba(146, 189, 63, 0.6) !important;
  color: #334e68 !important;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n + 2) .prose-section-card blockquote {
  border-left-color: #92bd3f !important;
  background-color: rgba(146, 189, 63, 0.15) !important;
}

.prose-sections-grid > .prose-section-wrap:nth-child(3n) .prose-section-card h3 {
  border-left-color: rgba(201, 204, 46, 0.7) !important;
  color: #334e68 !important;
}
.prose-sections-grid > .prose-section-wrap:nth-child(3n) .prose-section-card blockquote {
  border-left-color: #c9cc2e !important;
  background-color: rgba(201, 204, 46, 0.15) !important;
}

/* Mobile : une colonne */
@media (max-width: 767px) {
  .prose-sections-grid {
    grid-template-columns: 1fr;
  }
  .prose-sections-grid > .prose-section-wrap:nth-child(3n + 1) {
    grid-column: 1;
  }
}

/* CKEditor 5 : toolbar sticky sous le header CMS (4rem = 64px) */
.ck-sticky-panel__content.ck-sticky-panel__content_sticky {
  top: 64px !important;
  border-radius: 0px !important;
}

/* CKEditor 5 : style arrondi pour s'harmoniser avec le reste (rounded-xl) */
.ck.ck-editor {
  --ck-border-radius: 0.75rem;
}
.ck.ck-editor .ck-toolbar {
  border-radius: 0.75rem 0.75rem 0 0;
  border-width: 1px;
}
.ck.ck-editor .ck-editor__main > .ck-editor__editable {
  border-radius: 0 0 0.75rem 0.75rem;
  border-width: 1px;
  min-height: 200px;
}
.ck.ck-editor .ck-editor__main > .ck-editor__editable:not(.ck-focused) {
  border-color: rgb(209 213 219);
}
.ck.ck-editor .ck-editor__main > .ck-editor__editable.ck-focused {
  border-color: rgb(10 168 201);
  box-shadow: 0 0 0 2px rgba(10, 168, 201, 0.2);
}

/* Modal de previsualisation CMS : carte centree avec animation */
.cms-preview-overlay {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  z-index: 99999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.5);
  opacity: 1;
  transition: opacity 0.25s ease-out;
  pointer-events: auto;
}
.cms-preview-overlay.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}
.cms-preview-overlay.hidden .cms-preview-card {
  transform: scale(0.95);
  opacity: 0;
}
.cms-preview-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: calc(100vw - 4rem);
  height: 100%;
  max-height: calc(100vh - 4rem);
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: scale(1);
  opacity: 1;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}
.cms-preview-header {
  flex-shrink: 0;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border-bottom: 1px solid rgb(229 231 235);
  background: rgb(249 250 251);
}
.cms-preview-card #cms-preview-iframe {
  flex: 1;
  min-height: 0;
  border: 0;
}
