/**
 * OG Pub — Front CSS
 * Styles pour toutes les zones de bannières côté visiteur.
 * Utilise les CSS variables injectées en PHP inline sur chaque bannière.
 *
 * Variables disponibles sur chaque .og-pub :
 *   --og-bg        : couleur de fond
 *   --og-text      : couleur du texte
 *   --og-btn       : couleur du bouton CTA
 *   --og-btn-text  : couleur du texte bouton
 *   --og-overlay   : couleur de l'overlay (popup)
 *   --og-badge-bg  : couleur de fond du badge
 *
 * @package OG_Pub
 * @since   1.0.0
 */

/* ─────────────────────────────────────────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────────────────────────────────────────── */

.og-pub,
.og-pub *,
.og-pub *::before,
.og-pub *::after {
    box-sizing: border-box;
    margin:     0;
    padding:    0;
}

.og-pub {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size:   15px;
    line-height: 1.5;
    color:       var(--og-text, #ffffff);
}

/* Bannières masquées par défaut — le JS décide quand afficher */
.og-pub--popup,
.og-pub--slide,
.og-pub--sticky {
    display: none;
}

/* Zone inline : toujours visible (pas de logique de trigger) */
.og-pub--inline {
    display: block;
}

/* ─────────────────────────────────────────────────────────────────────────────
   CARTE COMMUNE
───────────────────────────────────────────────────────────────────────────── */

.og-pub__card {
    background:    var(--og-bg, #1a1a2e);
    border-radius: 12px;
    overflow:      hidden;
    position:      relative;
}

.og-pub__body {
    padding: 24px;
}

.og-pub__title {
    font-size:   1.2em;
    font-weight: 700;
    color:       var(--og-text, #fff);
    margin:      0 0 8px;
    line-height: 1.3;
}

.og-pub__subtitle {
    font-size:   0.9em;
    color:       var(--og-text, #fff);
    opacity:     0.85;
    margin:      0 0 16px;
}

.og-pub__image {
    width:       100%;
    height:      auto;
    display:     block;
    object-fit:  cover;
}

.og-pub__image-wrap {
    max-height: 200px;
    overflow:   hidden;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BOUTON CTA
───────────────────────────────────────────────────────────────────────────── */

.og-pub__cta {
    display:         inline-block;
    padding:         10px 22px;
    background:      var(--og-btn, #e94560);
    color:           var(--og-btn-text, #fff) !important;
    text-decoration: none !important;
    border-radius:   6px;
    font-weight:     700;
    font-size:       0.9em;
    transition:      opacity 0.18s ease, transform 0.18s ease;
    cursor:          pointer;
    border:          none;
    line-height:     1.4;
}

.og-pub__cta:hover {
    opacity:   0.88;
    transform: translateY(-1px);
}

.og-pub__cta:active {
    transform: translateY(0);
    opacity:   0.95;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BADGE
───────────────────────────────────────────────────────────────────────────── */

.og-pub__badge {
    display:       inline-block;
    padding:       3px 10px;
    background:    var(--og-badge-bg, #e94560);
    color:         #fff;
    font-size:     11px;
    font-weight:   700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 3px;
    position:      absolute;
    top:           14px;
    right:         14px;
    z-index:       2;
}

.og-pub__badge--inline {
    position: static;
    margin-bottom: 8px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   BOUTON FERMETURE
───────────────────────────────────────────────────────────────────────────── */

.og-pub__close {
    position:   absolute;
    top:        10px;
    right:      10px;
    background: rgba(0,0,0,0.25);
    border:     none;
    color:      #fff;
    width:      28px;
    height:     28px;
    border-radius: 50%;
    cursor:     pointer;
    font-size:  14px;
    line-height: 1;
    display:    flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s;
    z-index:    10;
    flex-shrink: 0;
}

.og-pub__close:hover {
    background: rgba(0,0,0,0.45);
}

.og-pub__close--small {
    width:     22px;
    height:    22px;
    font-size: 12px;
    top:       8px;
    right:     8px;
}

.og-pub__close--sticky {
    position: static;
    background: rgba(255,255,255,0.2);
    margin-left: auto;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   ZONE : POPUP
───────────────────────────────────────────────────────────────────────────── */

.og-pub--popup {
    position:   fixed;
    inset:      0;
    z-index:    99990;
    display:    flex;
    align-items: center;
    justify-content: center;
    padding:    16px;
}

.og-pub__overlay {
    position: absolute;
    inset:    0;
    background: var(--og-overlay, rgba(0,0,0,0.6));
    cursor:   pointer;
}

.og-pub__card--popup {
    position:   relative;
    z-index:    1;
    width:      100%;
    max-width:  480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Animation popup */
.og-pub--popup.og-pub--entering .og-pub__card--popup {
    animation: ogPubPopupIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.og-pub--popup.og-pub--leaving .og-pub__card--popup {
    animation: ogPubPopupOut 0.2s ease-in forwards;
}

@keyframes ogPubPopupIn {
    from { opacity: 0; transform: scale(0.85) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes ogPubPopupOut {
    from { opacity: 1; transform: scale(1); }
    to   { opacity: 0; transform: scale(0.92); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   ZONE : SLIDE-IN
───────────────────────────────────────────────────────────────────────────── */

.og-pub--slide {
    position: fixed;
    bottom:   24px;
    z-index:  99985;
    width:    320px;
}

.og-pub--slide-left  { left: 24px; }
.og-pub--slide-right { right: 24px; }

.og-pub__card--slide {
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.og-pub__image-wrap--slide {
    max-height: 140px;
}

.og-pub__body--slide {
    padding: 16px;
}

.og-pub__title--sm   { font-size: 1em; }
.og-pub__subtitle--sm { font-size: 0.85em; margin-bottom: 12px; }
.og-pub__cta--sm      { padding: 8px 16px; font-size: 0.85em; }

/* Animation slide-in */
.og-pub--slide-left.og-pub--entering {
    animation: ogPubSlideInLeft 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.og-pub--slide-right.og-pub--entering {
    animation: ogPubSlideInRight 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.og-pub--slide.og-pub--leaving {
    animation: ogPubSlideOut 0.22s ease-in forwards;
}

@keyframes ogPubSlideInLeft {
    from { opacity: 0; transform: translateX(-110%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes ogPubSlideInRight {
    from { opacity: 0; transform: translateX(110%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes ogPubSlideOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(20px); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   ZONE : STICKY TOP / BOTTOM
───────────────────────────────────────────────────────────────────────────── */

.og-pub--sticky {
    position:  fixed;
    left:      0;
    right:     0;
    z-index:   99980;
    background: var(--og-bg, #1a1a2e);
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.og-pub--sticky-top    { top: 0; }
.og-pub--sticky-bottom { bottom: 0; }

.og-pub__sticky-inner {
    display:     flex;
    align-items: center;
    gap:         12px;
    padding:     10px 20px;
    max-width:   1200px;
    margin:      0 auto;
    flex-wrap:   wrap;
}

.og-pub__title--sticky   { font-size: 0.95em; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.og-pub__subtitle--sticky { font-size: 0.85em; opacity: 0.85; flex: 1; min-width: 0; }
.og-pub__cta--sticky      { padding: 7px 16px; font-size: 0.85em; white-space: nowrap; flex-shrink: 0; }

/* Animation sticky */
.og-pub--sticky-top.og-pub--entering {
    animation: ogPubStickyTopIn 0.3s ease-out forwards;
}
.og-pub--sticky-bottom.og-pub--entering {
    animation: ogPubStickyBottomIn 0.3s ease-out forwards;
}
.og-pub--sticky.og-pub--leaving {
    animation: ogPubStickyOut 0.2s ease-in forwards;
}

@keyframes ogPubStickyTopIn {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

@keyframes ogPubStickyBottomIn {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes ogPubStickyOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   ZONE : INLINE
───────────────────────────────────────────────────────────────────────────── */

.og-pub--inline {
    margin: 16px 0;
}

.og-pub__card--inline {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.og-pub__image-wrap--inline {
    max-height: 180px;
}

.og-pub__body--inline {
    padding: 20px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE MOBILE
───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {

    /* Popup */
    .og-pub__card--popup {
        max-width: 100%;
        border-radius: 12px 12px 0 0;
    }

    .og-pub--popup {
        align-items:  flex-end;
        padding:      0;
    }

    .og-pub--popup.og-pub--entering .og-pub__card--popup {
        animation: ogPubPopupInMobile 0.3s ease-out forwards;
    }

    @keyframes ogPubPopupInMobile {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    /* Slide → passe en bas de l'écran sur mobile */
    .og-pub--slide {
        left:   0 !important;
        right:  0 !important;
        bottom: 0;
        width:  100%;
        border-radius: 12px 12px 0 0;
    }

    .og-pub--slide-left.og-pub--entering,
    .og-pub--slide-right.og-pub--entering {
        animation: ogPubSlideInBottom 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    @keyframes ogPubSlideInBottom {
        from { opacity: 0; transform: translateY(110%); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* Sticky inner : scroll horizontal si trop d'éléments */
    .og-pub__sticky-inner {
        padding:   8px 12px;
        gap:       8px;
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .og-pub__title--sticky {
        white-space: normal;
    }

    .og-pub__body {
        padding: 16px;
    }
}
