/* ==========================================================
   sidebar.css : sidebar de réservation (mascotte + boutons)
   Fichier : templates/shaper_helixultimate/css/sidebar.css
   À charger APRES custom.css (voir index.php)
   ========================================================== */

/* -------------------------------------------------- */
/* SIDEBAR PREMIUM */
/* -------------------------------------------------- */

.reservation-sidebar {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--light-gray-beaubloc);
    padding: 14px 12px;
    border-radius: 16px 0 0 16px;
    box-shadow: 0 6px 18px var(--shadow-color);
    z-index: 999;
    border: 1px solid var(--light-gray-color);
}


/* ✅ Checkbox invisible mais active */
.toggle-mascotte {
    display: block !important;
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Liens */
.reservation-sidebar a {
    text-decoration: none !important;
    color: var(--white-color) !important;
}

/* -------------------------------------------------- */
/* MASCOTTE */
/* -------------------------------------------------- */

.reservation-sidebar .mascotte img {
    width: 60px;
    height: auto;
    border-radius: 50%;
    transition: transform .3s ease, box-shadow .3s ease;
    box-shadow: 0 4px 10px var(--shadow-color);
    background-color: var(--light-gray-beaubloc);
}

.mascotte {
    position: relative;
}

.mascotte:hover img {
    transform: scale(1.08);
    box-shadow: 0 6px 14px var(--shadow-color-dark);
}

/* Popup mascotte */
.popup-mascotte {
    display: none;
    position: absolute;
    top: 50%;
    left: -230px;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--middle-blue-color), var(--dark-blue-color));
    color: var(--white-color);
    padding: 14px 18px;
    border-radius: 20px;
    box-shadow: 0 6px 14px var(--shadow-color-dark);
    max-width: 210px;
    text-align: center;
    font-size: clamp(.85rem, .8rem + .2vw, .95rem);
    /* CLAMP (avant : .95 / .9 / .85rem) */
}

.popup-mascotte::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -18px;
    transform: translateY(-50%);
    border-width: 10px;
    border-style: solid;
    border-color: transparent transparent transparent var(--dark-blue-color);
    box-shadow: 2px 2px 6px var(--shadow-color);
}


.mascotte:hover .popup-mascotte {
    display: block;
    animation: fadeIn .3s ease-in-out;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}


/* -------------------------------------------------- */
/* FIN SIDEBAR PREMIUM */
/* -------------------------------------------------- */

/* -------------------------------------------------- */
/* BOUTONS PREMIUM */
/* -------------------------------------------------- */

.btn-reservation {
    width: 60px;
    height: 60px;
    overflow: hidden;
    white-space: nowrap;
    padding: 12px 16px;
    border-radius: 50px !important;
    font-weight: 600;
    text-align: center;
    background-color: var(--button-arriere-color) !important;
    border: none;
    color: var(--white-color);
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: width .45s cubic-bezier(0.25, 0.8, 0.25, 1), background .3s ease, box-shadow .3s ease;
}

/* Icônes */
.btn-reservation::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 22px;
    margin-right: 20px;
    color: var(--white-color);
}

.btn-reservation.reserve::before {
    content: "\f002";
}

/* calendar-check */
.btn-reservation.tarifs::before {
    content: "\f02c";
}

/* book */
.btn-reservation.contact::before {
    content: "\f0e0";
}

/* envelope */
.btn-reservation.compteclient::before {
    content: "\f007";
}

/* user */

.btn-reservation span {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity .4s ease, transform .4s ease;
}

/* Hover premium */
.btn-reservation:hover {
    width: 180px;
    background: var(--button-arriere-color-hover) !important;
    box-shadow: 0 8px 18px var(--shadow-color-dark);
}

.btn-reservation:hover span {
    opacity: 1;
    transform: translateX(0);
}


/* -------------------------------------------------- */
/* ORDINATEUR + SOURIS : Loustic reste visible,       */
/* la sidebar s'ouvre quand on s'en approche          */
/* (tablettes / mobiles : le dock ci-dessous reste tel quel) */
/* -------------------------------------------------- */

@media (min-width: 769px) and (hover: hover) and (pointer: fine) {

    /* Repliée : seule la mascotte est visible.
       On ancre le HAUT (pas le centre) pour que Loustic ne bouge pas
       quand la sidebar s'ouvre vers le bas. */
    .reservation-sidebar {
        top: max(90px, min(38vh, calc(100dvh - 350px)));
        transform: none;
        gap: 0;
        background: transparent;
        border-color: transparent;
        box-shadow: none;
        transition: background .35s ease, border-color .35s ease, box-shadow .35s ease;
    }

    /* Zone d'approche élargie : la sidebar s'ouvre avant d'être touchée */
    .reservation-sidebar::before {
        content: "";
        position: absolute;
        inset: -40px 0 -40px -90px;
    }

    /* Boutons masqués tant que la sidebar est repliée.
       Pour garder « Réserver » visible en permanence, remplacez
       a.btn-reservation par a.btn-reservation:not(.reserve) dans les 2 règles. */
    .reservation-sidebar > a.btn-reservation,
    .reservation-sidebar > .compteclient {
        display: none;
    }

    /* Ouverte : survol, ou navigation au clavier */
    .reservation-sidebar:hover,
    .reservation-sidebar:has(:focus-visible) {
        gap: 14px;
        background: var(--light-gray-beaubloc);
        border-color: var(--light-gray-color);
        box-shadow: 0 6px 18px var(--shadow-color);
    }

    .reservation-sidebar:hover > a.btn-reservation,
    .reservation-sidebar:hover > .compteclient,
    .reservation-sidebar:has(:focus-visible) > a.btn-reservation,
    .reservation-sidebar:has(:focus-visible) > .compteclient {
        animation: sidebarItemIn .35s ease both;
    }

    .reservation-sidebar:hover > a.btn-reservation,
    .reservation-sidebar:has(:focus-visible) > a.btn-reservation {
        display: flex;
    }

    .reservation-sidebar:hover > .compteclient,
    .reservation-sidebar:has(:focus-visible) > .compteclient {
        display: block;
    }

    .reservation-sidebar:hover > :nth-child(3),
    .reservation-sidebar:has(:focus-visible) > :nth-child(3) { animation-delay: .05s; }
    .reservation-sidebar:hover > :nth-child(4),
    .reservation-sidebar:has(:focus-visible) > :nth-child(4) { animation-delay: .10s; }
    .reservation-sidebar:hover > :nth-child(5),
    .reservation-sidebar:has(:focus-visible) > :nth-child(5) { animation-delay: .15s; }

    /* ---- Survol d'un bouton : ouverture plus douce ----
       Les boutons restent ancrés à DROITE (Loustic et les autres icônes ne
       glissent plus), l'icône reste fixe et l'étiquette se déploie vers la gauche. */
    .reservation-sidebar {
        align-items: flex-end;
    }

    .reservation-sidebar .btn-reservation {
        display: flex;
        flex-direction: row-reverse;
        align-items: center;
        gap: 14px;
        padding: 0 19px;
        transition: width .6s cubic-bezier(.4, 0, .2, 1), background .3s ease, box-shadow .3s ease;
    }

    .reservation-sidebar .btn-reservation::before {
        flex: none;
        width: 22px;
        margin: 0;
        text-align: center;
    }

    /* Étiquette : elle apparaît un peu après le début de l'ouverture */
    .reservation-sidebar .btn-reservation span,
    .reservation-sidebar .btn-reservation moncompte-account-name {
        opacity: 0;
        transform: translateX(14px);
        transition: opacity .2s ease, transform .3s ease;
    }

    .reservation-sidebar .btn-reservation:hover span,
    .reservation-sidebar .btn-reservation:hover moncompte-account-name {
        opacity: 1;
        transform: none;
        transition: opacity .35s ease .2s, transform .45s ease .2s;
    }

}

@keyframes sidebarItemIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .reservation-sidebar,
    .reservation-sidebar > a.btn-reservation,
    .reservation-sidebar > .compteclient {
        transition: none;
        animation: none !important;
    }
}


/* -------------------------------------------------- */
/* DOCK (TABLETTES + MOBILES ≤ 768px) */
/* (changement de structure : on garde le @media)    */
/* -------------------------------------------------- */

@media (max-width: 768px) {

    /* Checkbox active mais invisible en dock */
    .toggle-mascotte {
        display: block !important;
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
        pointer-events: none;
    }

    /* Dock en bas */
    .reservation-sidebar {
        top: auto;
        bottom: -10px;
        left: 50%;
        transform: translateX(-50%);
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding: 10px;
        border-radius: 14px 14px 0 0;
    }

    /* La mascotte sert de référence au popup */
    .mascotte {
        position: relative;
        /* ✅ INDISPENSABLE pour le triangle */
    }

    .mascotte label img {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        cursor: pointer;
    }

    /* Popup au-dessus de l’icône, centré */
    .popup-mascotte {
        position: absolute;
        top: -80px;
        /* ✅ au-dessus de l’icône */
        left: 50%;
        /* transform: translateX(-50%); */
        width: max-content;
        max-width: 220px;
        padding: 10px 14px;
        border-radius: 14px;
        background: linear-gradient(135deg, var(--middle-blue-color), var(--dark-blue-color));
        color: var(--white-color);
        text-align: center;
        box-shadow: 0 6px 14px var(--shadow-color-dark);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease, transform .25s ease;
        z-index: 10000;
    }

    /* Affichage au clic sur la mascotte (checkbox cochée) */
    .toggle-mascotte:checked~.popup-mascotte {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(-30%) translateY(-4px);
    }

    /* ✅ Triangle SOUS le popup, centré */
    .popup-mascotte::after {
        content: none;
        /* position: absolute;
        top: 80%;
        left: 50%;
        transform: translateX(-50%);
        border-width: 10px;
        border-style: solid;
        box-shadow: none;
        border-color: transparent transparent var(--dark-blue-color) transparent; */
    }

    /* Boutons compacts */
    .btn-reservation {
        width: 42px;
        height: 42px;
        padding: 8px;
        border-radius: 50px !important;
    }

    .btn-reservation span {
        display: none;
    }

    #cookiescript_badge {
        bottom: 100px !important;
        left: 30px !important;
    }
}


/* -------------------------------------------------- */
/* PETITS MOBILES (≤ 480px) */
/* -------------------------------------------------- */

@media (max-width: 480px) {

    .reservation-sidebar {
        gap: 20px;
        width: 80%;
        height: 80px;
    }

    .reservation-sidebar .mascotte label img {
        width: 50px;
        height: auto;
    }

    .reservation-sidebar .btn-reservation {
        width: 40px;
        height: 40px;

        display: flex;
        align-items: center;
        justify-content: center;
    }

    .reservation-sidebar .btn-reservation::before {
        margin-right: 0;
        /* 🔥 LA correction clé */
        font-size: 1rem;
    }

    .reservation-sidebar .popup-mascotte {
        bottom: 64px;
        padding: 8px 12px;
    }
}