/* css/sidebar.css
 * Port FR du systeme sidebar de contadordeprazo.com.br (bumps 147 + 217 + 220 + 240).
 *
 * Layout cible (shifted-tool):
 *   <hero/>                           full-width, hors shift
 *   <div.cdp-tool-shift>              grid 2-col >= 1200px
 *     <main.cdp-tool-body>            contenu de l'outil (max 960px)
 *     <aside.cdp-tool-sidebar>        ad sticky 300x250 a droite
 *
 * Breakpoint : 1200px. Sous, sidebar stack en bas.
 */

/* === Layout shifted-tool : 2-col tool body + sidebar ad === */
/* Bug fix 2026-05-06 : !important sobrescreve `.container { max-width: 1000px !important }`
   que existe em jours-ouvres.css:605 e calendar-year.css:131. Sem isso, em pages
   tool-jours-ouvres / tool-jours-ouvrables, o cdp-tool-shift fica preso a 1000px e
   a sidebar 320px nao cabe no grid 2-col. */
.cdp-tool-shift {
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0 16px;
    max-width: 1600px !important;
    /* Largeur par defaut du body (overridable per-tool). 960px centrado em 1600 = ~144px de margem cada lado. */
    --tool-body-max-width: 960px;
}

.cdp-tool-body {
    min-width: 0;
    max-width: var(--tool-body-max-width);
    width: 100%;
}

@media (min-width: 1200px) {
    .cdp-tool-shift {
        display: grid;
        grid-template-columns: minmax(0, var(--tool-body-max-width)) 320px;
        justify-content: center;
        gap: 32px;
        align-items: start;
    }
    .cdp-tool-sidebar {
        align-self: start;
    }
    /* Sticky toggle : applique seulement si .cdp-tool-sidebar--sticky present (port CDP). */
    .cdp-tool-sidebar--sticky {
        position: sticky;
        top: 116px;
    }
}

@media (max-width: 1199px) {
    .cdp-tool-sidebar {
        margin: 24px auto 0;
        max-width: 320px;
    }
}

/* Per-tool max-width overrides */
.cdp-tool-shift--qst    { --tool-body-max-width: 1160px; }
.cdp-tool-shift--article { --tool-body-max-width: 1000px; }

/* === Sidebar ad-only (cdp-tool-sidebar) === */
.cdp-tool-sidebar {
    overflow: visible !important;
    box-sizing: border-box;
    /* Bug fix 2026-05-06 : reserve hauteur minimum pour que le slot soit visible
       avant le chargement async d'AdSense (CLS-friendly). Sans min-height, en local
       de dev (AdSense JS bloque ou non-charge) la sidebar reste 0px et l'utilisateur
       pense qu'elle est absente. En prod, AdSense charge le creative et le min-height
       est consume. */
    min-height: 280px;
}
/* Fixed-size 300x250 pour AdSense (sticky-compliant). */
.cdp-tool-sidebar .adsbygoogle.ad-slot--sidebar-300x250,
.cdp-tool-sidebar .ad-slot--sidebar-300x250 {
    min-height: 250px;
    min-width: 300px;
    background: #fafafa;
    display: block;
}
body.dark-mode .cdp-tool-sidebar .adsbygoogle.ad-slot--sidebar-300x250,
body.dark-mode .cdp-tool-sidebar .ad-slot--sidebar-300x250 {
    background: rgba(255,255,255,0.04);
}

/* === Ad wrap (commun aux 2 types de sidebar) === */
.cdp-ad-wrap {
    padding: 16px 0 24px;
    margin: 0;
    text-align: center;
    contain: none;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
}

.cdp-tool-sidebar .ad-slot--sidebar-vertical-fixed,
.cdp-tool-sidebar .ad-slot--sidebar-300x250 {
    margin: 0 auto;
    contain: none;
    overflow: visible;
}

/* === Label "Publicite" (RGPD / LCEN art. 20) === */
.cdp-ad-label {
    display: block;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    text-align: center;
    line-height: 1;
}

body.dark-mode .cdp-ad-label {
    /* Bump 65: WCAG AA — #6b7280 sobre #000 = 4.34:1 FAIL → #9ca3af = 5.2:1 PASS */
    color: #9ca3af;
}

/* === Bug fix 2026-05-06 : fériés in-range visuellement distincts === */
/* Calendrier multi-mois (lpMultiCalendar) en mode 'ouvrables' / 'uteis' :
   les cellules .holiday.skipped doivent etre roses (jamais vertes comme les
   jours ouvres). Force background rose + texte rouge avec !important pour
   surclasser les regles in-range qui peuvent fuiter du CSS bundle. */
#lpMultiCalendar .rmc-cal-day.holiday,
#lpMultiCalendar .rmc-cal-day.holiday.skipped,
.lp-multi-calendar .holiday,
.lp-multi-calendar .holiday.skipped {
    background: #ffe0e0 !important;
    color: #c00 !important;
    font-weight: 700;
}
body.dark-mode #lpMultiCalendar .rmc-cal-day.holiday,
body.dark-mode #lpMultiCalendar .rmc-cal-day.holiday.skipped,
body.dark-mode .lp-multi-calendar .holiday,
body.dark-mode .lp-multi-calendar .holiday.skipped {
    background: rgba(255, 69, 58, 0.18) !important;
    color: #ff9a94 !important;
}

/* === Print : sidebar et label cachees === */
@media print {
    .cdp-tool-shift {
        display: block !important;
    }
    .cdp-tool-sidebar,
    .cdp-ad-label {
        display: none !important;
    }
}
