/* =========================================================
   DRAGON NEWS
   Composant autonome - classes préfixées pour limiter
   les risques de conflit avec le CSS du site.
   ========================================================= */

#dragon-news-container,
#dragon-news-container * {
    box-sizing: border-box;
}

#dragon-news-container {
    --dnews-blue: #0756a6;
    --dnews-blue-light: #eaf5ff;
    --dnews-green: #159b78;
    --dnews-white: #ffffff;
    --dnews-shadow: 0 10px 30px rgba(0, 50, 100, 0.18);

    position: fixed;
    right: 24px;
    bottom: 22px;
    z-index: 99990;

    width: min(430px, calc(100vw - 32px));

    font-family: Arial, Helvetica, sans-serif;
}

/* ---------------------------------------------------------
   BLOC PRINCIPAL
   --------------------------------------------------------- */

.dnews-widget {
    position: relative;
    min-height: 180px;
    pointer-events: none;
}

/* ---------------------------------------------------------
   BULLE
   --------------------------------------------------------- */

.dnews-bubble {
    position: absolute;
    right: 105px;
    bottom: 72px;

    width: min(360px, calc(100vw - 130px));
    padding: 22px 22px 18px;

    background: var(--dnews-white);
    border: 3px solid #65bdf4;
    border-radius: 28px;

    box-shadow: var(--dnews-shadow);

    opacity: 0;
    transform: translateY(18px) scale(0.94);
    transform-origin: bottom right;

    pointer-events: auto;

    transition:
        opacity 0.45s ease,
        transform 0.45s cubic-bezier(.2,.8,.2,1);
}

/* La petite pointe de la bulle */
.dnews-bubble::after {
    content: "";
    position: absolute;
    right: 32px;
    bottom: -20px;

    width: 30px;
    height: 30px;

    background: var(--dnews-white);
    border-right: 3px solid #65bdf4;
    border-bottom: 3px solid #65bdf4;

    transform: rotate(45deg);
}

/* État visible */
.dnews-widget.dnews-is-open .dnews-bubble {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ---------------------------------------------------------
   CONTENU DE LA BULLE
   --------------------------------------------------------- */

.dnews-title {
    margin: 0 0 9px;

    color: var(--dnews-blue);

    font-size: 20px;
    line-height: 1.2;
    font-weight: 700;
}

.dnews-text {
    margin: 0 0 16px;

    color: #23364a;

    font-size: 15px;
    line-height: 1.45;
}

.dnews-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 40px;
    padding: 9px 17px;

    border: 0;
    border-radius: 22px;

    background: var(--dnews-green);
    color: #fff;

    font-size: 14px;
    font-weight: 700;
    text-decoration: none;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        filter 0.2s ease,
        box-shadow 0.2s ease;
}

.dnews-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 6px 15px rgba(21, 155, 120, 0.25);
}

.dnews-button:focus-visible {
    outline: 3px solid #ffd447;
    outline-offset: 3px;
}

.dnews-arrow {
    font-size: 18px;
    line-height: 1;
}

/* ---------------------------------------------------------
   DRAGON
   --------------------------------------------------------- */

.dnews-dragon-button {
    position: absolute;
    right: 0;
    bottom: 0;

    width: 135px;
    height: 175px;

    padding: 0;
    border: 0;

    background: transparent;

    cursor: pointer;
    pointer-events: auto;

    filter: drop-shadow(0 8px 8px rgba(0,0,0,0.12));

    transition:
        transform 0.25s ease,
        filter 0.25s ease;
}

.dnews-dragon-button:hover {
    transform: translateY(-5px) rotate(-1deg);
    filter: drop-shadow(0 12px 12px rgba(0,0,0,0.17));
}

.dnews-dragon-button:focus-visible {
    outline: 3px solid #ffd447;
    outline-offset: 4px;
    border-radius: 20px;
}

.dnews-dragon-image {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
    object-position: bottom center;

    user-select: none;
    -webkit-user-drag: none;
}

/* Petit mouvement permanent, très léger */
.dnews-widget.dnews-is-compact .dnews-dragon-button {
    animation: dnews-dragon-breathe 3.8s ease-in-out infinite;
}

@keyframes dnews-dragon-breathe {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* ---------------------------------------------------------
   PASTILLE « NOUVEAU »
   --------------------------------------------------------- */

.dnews-badge {
    position: absolute;
    top: -3px;
    right: 5px;

    min-width: 27px;
    height: 27px;

    padding: 0 7px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #e53935;
    color: #fff;

    border: 3px solid #fff;

    font-size: 13px;
    font-weight: 700;

    box-shadow: 0 4px 10px rgba(0,0,0,0.15);

    pointer-events: none;
}

/* ---------------------------------------------------------
   MODE DISCRET
   --------------------------------------------------------- */

.dnews-widget.dnews-is-compact .dnews-bubble {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.92);
}

.dnews-widget.dnews-is-compact .dnews-badge {
    display: flex;
}

/* ---------------------------------------------------------
   ANIMATION D'ARRIVÉE
   --------------------------------------------------------- */

.dnews-widget.dnews-entering {
    animation: dnews-widget-in 0.7s ease both;
}

@keyframes dnews-widget-in {
    from {
        opacity: 0;
        transform: translateY(25px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------------------------------------------------------
   MOBILE
   --------------------------------------------------------- */

@media (max-width: 600px) {

    #dragon-news-container {
        right: 10px;
        bottom: 10px;
        width: calc(100vw - 20px);
    }

    .dnews-widget {
        min-height: 145px;
    }

    .dnews-dragon-button {
        width: 105px;
        height: 140px;
    }

    .dnews-bubble {
        right: 75px;
        bottom: 58px;

        width: calc(100vw - 105px);
        max-width: 330px;

        padding: 17px 17px 15px;
        border-radius: 22px;
    }

    .dnews-title {
        font-size: 17px;
    }

    .dnews-text {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .dnews-button {
        min-height: 36px;
        padding: 7px 13px;
        font-size: 13px;
    }
}

/* ---------------------------------------------------------
   ACCESSIBILITÉ : réduction des animations
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    .dnews-widget,
    .dnews-widget *,
    .dnews-dragon-button,
    .dnews-bubble,
    .dnews-button {
        animation: none !important;
        transition: none !important;
    }
}
