/* ==========================================================
   Noovelis — Overrides globaux (SAFE)
   Fichier: C:\noovelis\noovelis_project\static\css\nv_overrides.css

   Objectifs:
   1) Images CKEditor raisonnables (éviter images géantes)
   2) Logos /static/logos/* :
      - petits DANS le contenu (CKEditor/prose)
      - lisibles dans l’UI (header/cartes), et plus gros sur /pages/
   ========================================================== */

/* ----------------------------------------------------------
   Variables
   ---------------------------------------------------------- */
:root {
  /* Images dans contenu (desktop) */
  --nv-ck-img-max-w: 460px;
  --nv-ck-img-max-h: 30vh;

  /* Mobile */
  --nv-ck-img-max-w-sm: 320px;
  --nv-ck-img-max-h-sm: 26vh;

  /* Logos UI (hors contenu) */
  --nv-ui-logo-size: 52px;
  /* taille lisible par défaut */
  --nv-ui-logo-size-sm: 44px;
  /* mobile */
}

/* Sur la page /.../pages/ -> logo plus grand (UX) */
body[data-route$="/pages/"] {
  --nv-ui-logo-size: 72px;
  --nv-ui-logo-size-sm: 60px;
}

/* ----------------------------------------------------------
   A) LOGOS UI (hors contenu) : lisibles + pas “géants”
   IMPORTANT:
   - on ne touche PAS au contenu CKEditor ici
   - on cible les logos typiques de tes templates (w-10 h-10 rounded)
   ---------------------------------------------------------- */
.page-wrap img.w-10.h-10.rounded[src*="/static/logos/"],
.page-wrap img.w-10.h-10.rounded[src^="static/logos/"] {
  width: var(--nv-ui-logo-size) !important;
  height: var(--nv-ui-logo-size) !important;
  max-width: var(--nv-ui-logo-size) !important;
  max-height: var(--nv-ui-logo-size) !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block !important;
  flex: 0 0 auto !important;
}

@media (max-width: 768px) {

  .page-wrap img.w-10.h-10.rounded[src*="/static/logos/"],
  .page-wrap img.w-10.h-10.rounded[src^="static/logos/"] {
    width: var(--nv-ui-logo-size-sm) !important;
    height: var(--nv-ui-logo-size-sm) !important;
    max-width: var(--nv-ui-logo-size-sm) !important;
    max-height: var(--nv-ui-logo-size-sm) !important;
  }
}

/* ----------------------------------------------------------
   B) LOGOS DANS LE CONTENU (CKEditor/prose) : petits
   -> ici OUI on limite /static/logos/ pour éviter les “logos géants”
   ---------------------------------------------------------- */
.nv-editor-content img[src*="/static/logos/"],
.prose img[src*="/static/logos/"],
.ck-content img[src*="/static/logos/"],
.nv-editor-content img[src^="static/logos/"],
.prose img[src^="static/logos/"],
.ck-content img[src^="static/logos/"] {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block !important;
  margin: 0.9rem auto !important;
}

/* ----------------------------------------------------------
   C) IMAGES / SVG DANS LE CONTENU (CKEditor + prose)
   ---------------------------------------------------------- */
.nv-editor-content img,
.nv-editor-content svg,
.nv-editor-content figure img,
.prose img,
.prose svg,
.prose figure img,
.ck-content img,
.ck-content svg,
.ck-content figure img {
  width: min(100%, var(--nv-ck-img-max-w)) !important;
  max-width: var(--nv-ck-img-max-w) !important;
  max-height: var(--nv-ck-img-max-h) !important;
  height: auto !important;
  object-fit: contain !important;
  display: block !important;
  margin: 0.9rem auto !important;
}

.nv-editor-content figure,
.prose figure,
.ck-content figure {
  max-width: 100% !important;
  margin: 1rem auto !important;
}

.nv-editor-content figcaption,
.prose figcaption,
.ck-content figcaption {
  text-align: center;
  font-size: 0.875rem;
  opacity: 0.75;
  margin-top: 0.35rem;
}

/* Médias intégrés */
.nv-editor-content video,
.nv-editor-content iframe,
.prose video,
.prose iframe,
.ck-content video,
.ck-content iframe {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
}

/* Tables : scroll horizontal */
.nv-editor-content table,
.prose table,
.ck-content table {
  width: 100%;
  max-width: 100%;
  display: block;
  overflow-x: auto;
}

/* CKEditor: neutraliser les widths inline des figures resized */
.ck-content figure.image_resized[style],
.nv-editor-content figure.image_resized[style] {
  width: auto !important;
  max-width: 100% !important;
}

.ck-content figure.image_resized>img,
.nv-editor-content figure.image_resized>img {
  max-width: var(--nv-ck-img-max-w) !important;
  max-height: var(--nv-ck-img-max-h) !important;
  width: auto !important;
  height: auto !important;
}

/* Mobile */
@media (max-width: 768px) {

  .nv-editor-content img,
  .nv-editor-content svg,
  .nv-editor-content figure img,
  .prose img,
  .prose svg,
  .prose figure img,
  .ck-content img,
  .ck-content svg,
  .ck-content figure img {
    width: min(100%, var(--nv-ck-img-max-w-sm)) !important;
    max-width: var(--nv-ck-img-max-w-sm) !important;
    max-height: var(--nv-ck-img-max-h-sm) !important;
  }

  .ck-content figure.image_resized>img,
  .nv-editor-content figure.image_resized>img {
    max-width: var(--nv-ck-img-max-w-sm) !important;
    max-height: var(--nv-ck-img-max-h-sm) !important;
  }
}


/* ==========================================================
   Noovelis — Boutons pills (outline, bleu "lumière")
   ========================================================== */

.nv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .55rem 1rem;
  border-radius: 9999px;
  /* pill */
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.1;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
  white-space: nowrap;
}

.nv-btn:active {
  transform: translateY(1px);
}

/* Outline neutre */
.nv-btn-outline {
  border: 1px solid rgba(148, 163, 184, 0.55);
  color: rgba(51, 65, 85, 1);
  background: transparent;
}

.dark .nv-btn-outline {
  border-color: rgba(148, 163, 184, 0.35);
  color: rgba(226, 232, 240, 1);
}

.nv-btn-outline:hover {
  background: rgba(148, 163, 184, 0.12);
}

.dark .nv-btn-outline:hover {
  background: rgba(148, 163, 184, 0.12);
}

/* Outline bleu "lumière" */
.nv-btn-outline-primary {
  border: 1px solid rgba(56, 189, 248, 0.75);
  /* sky-400-ish */
  color: rgba(3, 105, 161, 1);
  /* sky-700-ish */
  background: transparent;
}

.dark .nv-btn-outline-primary {
  border-color: rgba(56, 189, 248, 0.55);
  color: rgba(186, 230, 253, 1);
  /* sky-200-ish */
}

.nv-btn-outline-primary:hover {
  background: rgba(56, 189, 248, 0.12);
}

.dark .nv-btn-outline-primary:hover {
  background: rgba(56, 189, 248, 0.14);
}
