/* ===== CalcGrid — styles écran ===== */
.calcgrid-widget{ background:#f9f9f9; padding:1rem; border:1px solid #ccc; display:block; }
#calendrier-container{ width:100%; max-width:1200px; margin:0 auto; }
.calendrier-annuel-2colonnes{ display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.calendrier-mois{ border:1px solid #ddd; margin-bottom: 1rem; border-radius:6px; padding:0.5rem; background:#fff; }
.calendrier-mois .titre-mois{ font-weight:700; text-align:center; margin:0 0 0.25rem 0; }
.calendrier-mois table{ width:100%; border-collapse:collapse; table-layout:fixed; }
.calendrier-mois th {background:#8FB5FF; }
.calendrier-mois th,.calendrier-mois td{ text-align:center; padding:0.15rem 0; border:0; white-space:nowrap; }
#calendrier-container .weekend{ background:#BFD5FF; }
.btn-imprimer-calendrier{ display:inline-block; padding:0.4rem 0.7rem; border:1px solid #999; background:#fff; cursor:pointer; margin:0.5rem 0; }
.calendrier-formulaire{ margin-bottom:1rem; }


/* ===== Print : ne garder que #calendrier-container dans l'article ===== */
@media print {

  /* Active uniquement quand le body a la classe (ajoutée par ton JS) */
  body.calcgrid-print-mode {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #fff !important;
    color: #000 !important;
  }

  /* 1) Dans l'article : cacher tout sauf le calendrier */
  body.calcgrid-print-mode .entry.themeform > *:not(#calendrier-container) {
    display: none !important;
  }

  /* 2) Masquer l’en-tête, sidebars, pied de page, etc. (hors de l'article) */
  body.calcgrid-print-mode header.page-header,
  body.calcgrid-print-mode a.btn-imprimer-calendrier,
  body.calcgrid-print-mode .page-sidebar,
  body.calcgrid-print-mode .page-col-sidebar-center,
  body.calcgrid-print-mode #footer,
  body.calcgrid-print-mode #footer-widgets,
  body.calcgrid-print-mode #footer-bottom,
  body.calcgrid-print-mode #back-to-top,
  body.calcgrid-print-mode .canvas-bottom,
  body.calcgrid-print-mode .canvas-wrapper,
  body.calcgrid-print-mode .ipr-container,
  body.calcgrid-print-mode .canvas-inner,
body.calcgrid-print-mode .entry-title,
body.calcgrid-print-mode .entry-footer,
  body.calcgrid-print-mode noscript,
  body.calcgrid-print-mode iframe[src*="googletagmanager.com"],
  body.calcgrid-print-mode .sharedaddy,
  body.calcgrid-print-mode .jetpack-likes-widget-wrapper,
  body.calcgrid-print-mode #likes-master,
  body.calcgrid-print-mode #likes-other-gravatars {
    display: none !important;
  }

  /* 3) Neutraliser wrappers pour éviter marges/sauts parasites */
  body.calcgrid-print-mode .page-wrapper,
  body.calcgrid-print-mode .page-inner,
  body.calcgrid-print-mode .page-inner-container,
  body.calcgrid-print-mode .page-row,
  body.calcgrid-print-mode .page-inner-container-footer,
  body.calcgrid-print-mode .page-card,
  body.calcgrid-print-mode .stickywrap,
  body.calcgrid-print-mode .stickywrap-inner,
  body.calcgrid-print-mode .page-col-center {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  /* 4) Optionnel : 2 colonnes stables pour le calendrier (si tu veux) */
  body.calcgrid-print-mode #calendrier-container .calendrier-annuel-2colonnes {

    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 2mm !important;


  }
  body.calcgrid-print-mode #calendrier-container .calendrier-mois {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  /* 5) Masquer le formulaire/boutons à l’intérieur du calendrier */
  body.calcgrid-print-mode #calendrier-container form,
  body.calcgrid-print-mode #calendrier-container button,
  body.calcgrid-print-mode #calendrier-container select,
  body.calcgrid-print-mode #calendrier-container label {
    display: none !important;
  }

  /* 6) Tuer la barre Google/cookies si elle apparaît dans la page */
  body.calcgrid-print-mode [id*="cookie"],
  body.calcgrid-print-mode [class*="cookie"],
  body.calcgrid-print-mode [id*="consent"],
  body.calcgrid-print-mode [class*="consent"],
  body.calcgrid-print-mode iframe[src*="consent"],
  body.calcgrid-print-mode iframe[src*="google_esf"],
  body.calcgrid-print-mode .goog-te-banner-frame,
  body.calcgrid-print-mode .goog-logo-link,
  body.calcgrid-print-mode iframe[src*="google"],
  body.calcgrid-print-mode iframe[id*="google"],
  body.calcgrid-print-mode iframe[name*="google"],
  body.calcgrid-print-mode iframe[src*="googletagmanager"],
  body.calcgrid-print-mode iframe[src*="googlesyndication"],
  body.calcgrid-print-mode iframe[src*="doubleclick"],
  body.calcgrid-print-mode iframe[src*="googleads"],
  body.calcgrid-print-mode iframe[src*="google_esf"],
  body.calcgrid-print-mode iframe[src*="safeframe"],
  body.calcgrid-print-mode iframe[src*="adsbygoogle"],
  body.calcgrid-print-mode iframe[src*="consent"],
  body.calcgrid-print-mode iframe[src*="cookie"],
  body.calcgrid-print-mode .google-iframe,
  body.calcgrid-print-mode .google_ads_frame,
  body.calcgrid-print-mode .google_esf,
  body.calcgrid-print-mode .google-ads-iframe,
  body.calcgrid-print-mode [id*="google_ads"],
  body.calcgrid-print-mode [id*="google_esf"],
  body.calcgrid-print-mode [class*="google_ads"],
  body.calcgrid-print-mode [class*="google_esf"],
  body.calcgrid-print-mode [id*="aswift_"],
  body.calcgrid-print-mode [name*="aswift_"],
  body.calcgrid-print-mode [id*="google_ads_iframe_"],
  body.calcgrid-print-mode [id*="google_ads_frame"],
  body.calcgrid-print-mode [class*="aswift_"],
  body.calcgrid-print-mode [src*="tpc.googlesyndication.com"],
  body.calcgrid-print-mode [src*="pagead2.googlesyndication.com"],
  body.calcgrid-print-mode [src*="adservice.google.com"],
  body.calcgrid-print-mode [src*="fundingchoicesmessages.google.com"]{
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
  }

}



/* ===========================
   PRINT — RÉGLAGES FINEMENT CONTRÔLABLES
   (ne modifie PAS le layout Grid : 2 colonnes)
   =========================== */
@media print {

  /* ---- 0) VARIABLES DE RÉGLAGE GLOBAL ----
     Ajuste uniquement ces valeurs pour “caler” le rendu sur 1 A4.
     Unités recommandées : mm/pt pour l'impression. */
  body.calcgrid-print-mode {
    /* Page et zones utiles */
    --page-margin: 6mm;           /* marges imprimante (@page) */
    --container-max: 198mm;       /* largeur utile ≈ 210 - 2*margin */

    /* Grille */
    --grid-gap: 3mm;              /* espace entre les 2 colonnes et les lignes */

    /* Carte mois */
    --mois-padding: 1.2mm;        /* padding interne de chaque mois */
    --mois-border: 0.25pt solid #000; /* liseré fin d’un mois */
    --mois-radius: 0;             /* arrondi (0 = droit) */
    --mois-vgap: 2.4mm;           /* marge bas entre deux mois (vertical) */

    /* Titre mois */
    --titre-size: 8.1pt;          /* taille du titre (mois) */
    --titre-leading: 1.1;         /* interligne du titre */
    --titre-mb: 1mm;              /* espace sous le titre */

    /* Tableau jours */
    --cell-size: 6.3pt;           /* taille des chiffres LU..DI */
    --cell-leading: 1.04;         /* interligne des cellules */
    --cell-padding-y: 0.4mm;      /* padding vertical des cellules */
    --thead-weight: 700;          /* épaisseur du LU/MA/ME... */

    /* Couleurs/effets */
    --weekend-bg: transparent;    /* fond des week-ends (transparent pour gagner de la place) */
    --print-text: #000;           /* couleur du texte à l’impression */
    --print-bg: #fff;             /* fond papier */

    /* Option de secours si ça déborde encore un peu
       (décommente plus bas la propriété transform si nécessaire) */
    --global-scale: 1;            /* 0.98 ou 0.97 pour “rentrer” d’1 cm */
  }

  /* ---- 1) PAGE & NORMALISATION ---- */
  @page {
    size: A4 portrait;
    margin: var(--page-margin);
  }
  body.calcgrid-print-mode {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: var(--print-bg) !important;
    color: var(--print-text) !important;
  }

  /* ---- 2) CONTENEUR CALENDRIER ----
     On fixe une largeur max cohérente avec l’aire imprimable,
     sans toucher à ton Grid (2 colonnes). */
  body.calcgrid-print-mode #calendrier-container {
    max-width: var(--container-max) !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: var(--print-bg) !important;

    box-shadow: none !important;

    /* Secours : mini-scale global si ça dépasse encore de quelques mm */
    transform-origin: top left;
    transform: scale(var(--global-scale));
  }

  /* ---- 3) GRID DU CALENDRIER (inchangé) ---- */
  body.calcgrid-print-mode #calendrier-container .calendrier-annuel-2colonnes {
    display: grid !important;                /* on conserve ta grille */
    grid-template-columns: 1fr 1fr !important;
    gap: var(--grid-gap) !important;         /* réglage fin de l’espace entre blocs */
    page-break-inside: avoid;
    break-inside: avoid;

  }

  /* ---- 4) BLOC MOIS ---- */
  body.calcgrid-print-mode #calendrier-container .calendrier-mois {
    box-sizing: border-box;                  /* padding/border inclus dans la largeur */
    border: var(--mois-border);
    border-radius: var(--mois-radius);
    padding: var(--mois-padding);
    margin: 0 0 var(--mois-vgap) 0;         /* espace vertical entre mois */
    background: var(--print-bg) !important;

    page-break-inside: avoid !important;     /* empêcher la casse d’un mois */
    break-inside: avoid-column !important;   /* utile si un jour tu passes en colonnes CSS */
 
  }

  /* ---- 5) TITRE DU MOIS ---- */
  body.calcgrid-print-mode #calendrier-container .calendrier-mois .titre-mois {
    display: block !important;
    color: var(--print-text) !important;
    font-size: var(--titre-size);
    line-height: var(--titre-leading);
    margin: 0 0 var(--titre-mb) 0;
    font-weight: 700;
    text-align: center;
  }

  /* ---- 6) TABLEAU DES JOURS ---- */
  body.calcgrid-print-mode #calendrier-container .calendrier-mois table {
    width: 100% !important;
    table-layout: fixed !important;          /* colonnes égales (compact) */
    border-collapse: collapse !important;    /* pas d’espace inter-cellule */

  }
  body.calcgrid-print-mode #calendrier-container .calendrier-mois thead {
    display: table-header-group !important;  /* garde les entêtes liées au mois */
  }
  body.calcgrid-print-mode #calendrier-container .calendrier-mois tbody {
    display: table-row-group !important;
  }
  body.calcgrid-print-mode #calendrier-container .calendrier-mois tr {
    page-break-inside: avoid !important;     /* on évite une ligne coupée */
    break-inside: avoid !important;
  }
  body.calcgrid-print-mode #calendrier-container .calendrier-mois th,
  body.calcgrid-print-mode #calendrier-container .calendrier-mois td {
    font-size: var(--cell-size);
    line-height: var(--cell-leading);
    padding: var(--cell-padding-y) 0;
    border: 0;
    white-space: nowrap;                      /* pas de retour à la ligne */
    text-align: center;
  }
  body.calcgrid-print-mode #calendrier-container .calendrier-mois th {
    font-weight: var(--thead-weight);
  }

  /* Largeur unitaire des 7 colonnes (si tu utilises une classe .jour) */
  body.calcgrid-print-mode #calendrier-container .calendrier-mois .jour {
    width: calc(100% / 7);
  }

  /* ---- 7) WEEK-ENDS ----
     Transparent = zéro “gonflement” visuel ; passe à #eee si tu veux griser. */
  body.calcgrid-print-mode #calendrier-container .weekend {
    background: var(--weekend-bg) !important;
  }

  /* ---- 8) CE QUI PEUT ÊTRE MASQUÉ DANS LE CONTAINER ---- */
  body.calcgrid-print-mode #calendrier-container form,
  body.calcgrid-print-mode #calendrier-container button,
  body.calcgrid-print-mode #calendrier-container select,
  body.calcgrid-print-mode #calendrier-container label {
    display: none !important;                /* on n’imprime pas le formulaire */
  }
}


/* ===== Republish CC (simplifié) ===== */
:root{
  --rep-grad-a:#00c196;
  --rep-grad-b:#1b6da0;
  --rep-shadow:0 4px 14px rgba(27,109,160,.15);
}

/* Wrapper (notice + bouton) */
.calcgrid-republish-block {text-align: center;padding: 1rem; margin-bottom:0.5rem; font-size: 0.9rem; line-height: 1.2rem; background: linear-gradient(90deg, #00c196 0%, #1b6da0 100%) !important; border-radius: 30px;color:#fff;}
.calcgrid-republish-block h3 {text-align: center; margin-top:0.2rem;margin-bottom:0.2rem;font-size: 1.3rem;color:#fff;}
.calcgrid-republish-block a {font-size: 0.9rem;color:#fff;}
.calcgrid-republish-wrap{
  margin:1rem 0;
  text-align:left;
}

/* Bouton d'ouverture */
.calcgrid-republish-open{
  appearance:none;
  cursor:pointer;
text-align: center;
  display:inline-flex; align-items:center; justify-content:center;
  gap:.5rem; padding:.65rem 2.25rem;
  border:1px solid var(--rep-grad-b);
  border-radius:999px;
  background:linear-gradient(90deg,var(--rep-grad-a),var(--rep-grad-b));
font-size:1rem;  
color:#fff; font-weight:700;
  box-shadow:var(--rep-shadow);
  transition:transform .08s ease, box-shadow .15s ease, opacity .2s ease;
}
.calcgrid-republish-open:hover{}

/* Modal */

.calcgrid-republish-header > h4 {font-size: 1rem; margin-top: 0.5rem;margin-bottom:0.5rem;}
.calcgrid-republish-modal{ position:fixed; inset:0; z-index:9999; display:none; }
.calcgrid-republish-modal.is-open{ display:block; }
.calcgrid-republish-backdrop{ position:absolute; inset:0; background:rgba(10,15,25,.56); }

/* Boîte de dialogue */
.calcgrid-republish-dialog{
  position:relative; margin:9rem auto 0; max-width:880px;
  background:#fff; border-radius:14px; box-shadow:0 30px 80px rgba(0,0,0,.35);
  display:flex; flex-direction:column; overflow:hidden;
}

/* En-tête */
.calcgrid-republish-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:1rem 1.25rem; border-bottom:1px solid #e8edf5; background:#f7f9fc;
}
.calcgrid-republish-title{
  margin:0;
  font:700 1.05rem/1.2 system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  color:#0b2239;
}
.calcgrid-republish-close{
  appearance:none; cursor:pointer; border:0; background:transparent;
  font-size:1.6rem; line-height:1; color:#334155; padding:.25rem .4rem; border-radius:8px;
}
.calcgrid-republish-close:hover{ background:#e9eef6; }

/* Corps */
.calcgrid-republish-body{ padding:1rem 1.25rem; }
.calcgrid-republish-help{ margin:.25rem 0 .75rem; font-size:.95rem; color:#000;}
.calcgrid-republish-textarea{
  width:100%; max-height:300px; resize:vertical;
  font:400 .85rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  padding:.7rem .8rem; color:#0b1020; background:#f8fafc;
  border:1px solid #cbd5e1; border-radius:10px; outline:none;
}
.calcgrid-republish-textarea:focus{
  border-color:var(--rep-grad-b);
  box-shadow:0 0 0 3px rgba(27,109,160,.18);
}

/* Pied */
.calcgrid-republish-footer{
  display:flex; justify-content:flex-end; gap:.5rem;
  padding:.75rem 1.25rem 1rem; border-top:1px solid #e8edf5; background:#fbfcfe;
}
.calcgrid-republish-close-btn{
  appearance:none; cursor:pointer;
  padding:.55rem .9rem; border-radius:8px; border:1px solid #cbd5e1;
  background:#fff; color:#0b2239; font-weight:600;
}
.calcgrid-republish-close-btn:hover{ background:#f2f5fa; }


/* =========================================================
   Republish CC — amélioration VISUELLE INTRO (uniquement)
   Cible : <div class="calcgrid-republish-intro">…</div>
   Ne touche pas à la modale
========================================================= */

.calcgrid-republish-intro{
  text-align:left;
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.22);
  border-radius:18px;
  padding:1rem 1.1rem;
  margin:0.35rem 0 0.75rem;
  color:#fff;
  backdrop-filter: blur(2px);
}

.calcgrid-republish-intro h3{
  margin:0 0 .5rem 0;
  font-size:1.15rem;
  line-height:1.25;
  color:#fff;
}

/* Logo CC : on garde ton inline style float, mais on le sécurise */
.calcgrid-republish-intro a{
  color:#fff;
  text-decoration:underline;
  text-decoration-thickness:1px;
  text-underline-offset:2px;
  opacity:.95;
}
.calcgrid-republish-intro a:hover{
  opacity:1;
}

/* Texte : respiration + lisibilité */
.calcgrid-republish-intro strong{
  display:block;
  font-weight:800;
  margin:.15rem 0 .35rem;
}

.calcgrid-republish-intro em{
  display:block;
  margin-top:.5rem;
  font-style:normal;           /* plus lisible sur fond gradient */
  opacity:.92;
  font-size:.88rem;
  line-height:1.25rem;
}

/* Petits détails : éviter que le float du logo casse le bloc */
.calcgrid-republish-intro::after{
  content:"";
  display:block;
  clear:both;
}

/* Optionnel : sur mobile, on évite un float trop serré */
@media (max-width: 520px){
  .calcgrid-republish-intro{
    padding:.9rem 1rem;
  }
  .calcgrid-republish-intro h3{
    font-size:1.1rem;
  }
  .calcgrid-republish-intro img{
    float:none !important;
    display:block;
    margin:0 0 .6rem 0 !important;
    max-width:120px;
    height:auto;
  }
}
