/* ═══════════════════════════════════════════════
   Trail Promo – Sticky Bar & Exit Popup
   ═══════════════════════════════════════════════ */

/* ─── STICKY BAR ──────────────────────────────── */

#trail-promo-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 20px;
    background: #1a1a2e;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-wrap: wrap;
}

#trail-promo-bar.tpp-visible {
    transform: translateY(0);
}

#trail-promo-bar .tpp-bar-text {
    flex: 1 1 auto;
    text-align: center;
    min-width: 160px;
}

#trail-promo-bar .tpp-bar-btn {
    display: inline-block;
    background: #ff6600;
    color: #ffffff !important;
    text-decoration: none;
    padding: 7px 20px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 102, 0, 0.4);
    flex-shrink: 0;
}

#trail-promo-bar .tpp-bar-btn:hover {
    background: #e05500 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255, 102, 0, 0.5);
}

#trail-promo-bar .tpp-bar-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    flex-shrink: 0;
    transition: color 0.2s;
}

#trail-promo-bar .tpp-bar-close:hover {
    color: #ffffff;
}

/* Push body down when bar is visible */
body.tpp-bar-active {
    padding-top: 46px;
    transition: padding-top 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── POPUP OVERLAY ───────────────────────────── */

#trail-promo-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    transition: background 0.5s ease, backdrop-filter 0.5s ease;
}

#trail-promo-overlay.tpp-overlay-active {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
}

/* ─── POPUP BOX ───────────────────────────────── */

#trail-promo-popup {
    position: relative;
    z-index: 999999;
    /* Carré adapté au format 600×600 : max 480px sur desktop */
    width: min(480px, 88vw);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 102, 0, 0.15);
    transform: scale(0.85) translateY(30px);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}

#trail-promo-overlay.tpp-overlay-active #trail-promo-popup {
    transform: scale(1) translateY(0);
    opacity: 1;
}

#trail-promo-popup .tpp-popup-img-wrap {
    display: block;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    /* Ratio carré 1:1 garanti quelle que soit la taille affichée */
    aspect-ratio: 1 / 1;
}

#trail-promo-popup .tpp-popup-img-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 102, 0, 0);
    transition: background 0.25s ease;
}

#trail-promo-popup .tpp-popup-img-wrap:hover::after {
    background: rgba(255, 102, 0, 0.08);
}

#trail-promo-popup .tpp-popup-img-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    /* object-fit: cover pour remplir le carré sans déformation */
    object-fit: cover;
    object-position: center;
    transition: transform 0.4s ease;
}

#trail-promo-popup .tpp-popup-img-wrap:hover img {
    transform: scale(1.03);
}

#trail-promo-popup .tpp-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: rgba(0, 0, 0, 0.55);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 18px;
    line-height: 34px;
    text-align: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s ease, transform 0.2s ease;
    padding: 0;
}

#trail-promo-popup .tpp-popup-close:hover {
    background: #ff6600;
    transform: rotate(90deg);
}

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

@media (max-width: 600px) {
    #trail-promo-bar {
        font-size: 13px;
        padding: 8px 12px;
        gap: 8px;
    }
    #trail-promo-bar .tpp-bar-text {
        text-align: left;
        min-width: 0;
    }
    body.tpp-bar-active {
        padding-top: 60px;
    }
    /* Sur mobile le popup occupe presque toute la largeur,
       le ratio 1:1 s'ajuste automatiquement via aspect-ratio */
    #trail-promo-popup {
        width: 92vw;
    }

    /* Sur très petits écrans, le popup ne dépasse pas la hauteur visible */
    #trail-promo-overlay {
        align-items: center;
        padding: 12px;
        box-sizing: border-box;
    }
}
