/**
 * Forms Widget - LD Solutions
 * Widget flottant qui déploie les 4 formulaires ldprojet au hover
 *
 * Positionné au-dessus du widget Cal.com (bottom-right)
 *
 * @package ldsolutions
 * @version 1.0.0
 */

/* ============================================================
   CONTENEUR
   ============================================================ */

.lds-forms-widget {
    position: fixed;
    right: 2rem;
    /* Positionné au-dessus du widget Cal.com (56px + 2rem + gap 14px) */
    bottom: calc(2rem + 56px + 14px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
}

/* ============================================================
   BOUTON TRIGGER
   ============================================================ */

.lds-forms-widget__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 56px;
    height: 56px;
    padding: 0;
    background: #125AF8;
    color: #ffffff;
    border: 2.5px solid rgba(100, 170, 255, 0.5);
    border-radius: 28px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    box-shadow:
        0 4px 12px rgba(18, 90, 248, 0.28),
        0 2px 4px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition:
        width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        gap 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.3s ease,
        border-color 0.3s ease,
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.lds-forms-widget.is-open .lds-forms-widget__trigger,
.lds-forms-widget__trigger:focus-visible {
    width: 220px;
    gap: 0.75rem;
    padding: 0 20px;
    background: #0d4ad4;
    border-color: rgba(130, 190, 255, 0.6);
    transform: translateY(-2px);
    box-shadow:
        0 8px 24px rgba(18, 90, 248, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.12);
}

.lds-forms-widget__trigger:focus {
    outline: 2px solid rgba(100, 170, 255, 0.5);
    outline-offset: 2px;
}

.lds-forms-widget__trigger:active {
    transform: translateY(0);
}

.lds-forms-widget__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lds-forms-widget__icon svg {
    width: 24px;
    height: 24px;
}

.lds-forms-widget__text {
    white-space: nowrap;
    overflow: hidden;
    opacity: 0;
    width: 0;
    transition:
        opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1) 0.1s,
        width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lds-forms-widget.is-open .lds-forms-widget__text,
.lds-forms-widget__trigger:focus-visible .lds-forms-widget__text {
    opacity: 1;
    width: 120px;
}

/* ============================================================
   PANNEAU AU HOVER
   ============================================================ */

.lds-forms-widget__panel {
    position: relative;
    width: 320px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow:
        0 20px 50px rgba(2, 27, 80, 0.18),
        0 6px 16px rgba(2, 27, 80, 0.08);
    padding: 18px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.96);
    transform-origin: bottom right;
    transition:
        opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.28s;
    pointer-events: none;
}

.lds-forms-widget.is-open .lds-forms-widget__panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.lds-forms-widget__panel::after {
    content: "";
    position: absolute;
    bottom: -8px;
    right: 22px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    transform: rotate(45deg);
    box-shadow: 4px 4px 8px rgba(2, 27, 80, 0.06);
}

.lds-forms-widget__panel-head {
    padding: 4px 6px 12px;
    border-bottom: 1px solid rgba(2, 27, 80, 0.08);
    margin-bottom: 10px;
}

.lds-forms-widget__panel-eyebrow {
    display: inline-block;
    font-family: Arial, sans-serif;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #125AF8;
    margin-bottom: 6px;
}

.lds-forms-widget__panel-title {
    font-family: 'Chillax', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    color: #021B50;
    margin: 0;
}

/* ============================================================
   LISTE DES FORMULAIRES
   ============================================================ */

.lds-forms-widget__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lds-forms-widget__item {
    margin: 0;
}

.lds-forms-widget__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #021B50;
    background: transparent;
    transition:
        background 0.2s ease,
        transform 0.2s ease,
        color 0.2s ease;
}

.lds-forms-widget__link:hover,
.lds-forms-widget__link:focus-visible {
    background: rgba(18, 90, 248, 0.06);
    transform: translateX(2px);
    text-decoration: none;
}

.lds-forms-widget__link:focus {
    outline: 2px solid rgba(18, 90, 248, 0.4);
    outline-offset: 2px;
}

.lds-forms-widget__link-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.lds-forms-widget__link-label {
    font-family: Arial, sans-serif;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #021B50;
    line-height: 1.2;
}

.lds-forms-widget__link-desc {
    font-family: Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    color: rgba(21, 30, 40, 0.6);
    line-height: 1.3;
    margin-top: 2px;
}

.lds-forms-widget__link-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(2, 27, 80, 0.35);
    transform: translateX(-4px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
}

.lds-forms-widget__link:hover .lds-forms-widget__link-arrow {
    opacity: 1;
    transform: translateX(0);
    color: #125AF8;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .lds-forms-widget {
        right: 1.5rem;
        bottom: calc(1.5rem + 56px + 12px);
    }

    .lds-forms-widget__panel {
        width: 280px;
        padding: 14px;
    }
}

@media (max-width: 480px) {
    .lds-forms-widget {
        right: 1rem;
        bottom: calc(1rem + 56px + 10px);
    }

    .lds-forms-widget__panel {
        width: min(300px, calc(100vw - 2rem));
    }

    /* Sur mobile, garder l'icône seule au repos */
    .lds-forms-widget__text {
        display: none;
    }

    .lds-forms-widget__trigger,
    .lds-forms-widget.is-open .lds-forms-widget__trigger {
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 28px;
    }
}

/* ============================================================
   OUVERTURE AU SURVOL — POINTEUR FIN UNIQUEMENT
   ------------------------------------------------------------
   Le panneau s'ouvrait sur `.lds-forms-widget:hover`, sans garde.
   Sur un ecran tactile, le navigateur simule le survol au contact
   du doigt et le conserve jusqu'au toucher suivant : poser le pouce
   en bas a droite pour faire defiler la page ouvrait le panneau, qui
   passait alors en `pointer-events: auto` et interceptait les
   touchers suivants — la navigation devenait impossible.

   Le survol est donc reserve aux peripheriques a pointeur fin
   (souris, trackpad). Sur tactile, seul le clic sur le declencheur
   (classe `.is-open`, geree en JS) ouvre le panneau. Le comportement
   au bureau est inchange.
   ============================================================ */

@media (hover: hover) and (pointer: fine) {
    .lds-forms-widget:hover .lds-forms-widget__trigger {
        width: 220px;
        gap: 0.75rem;
        padding: 0 20px;
        background: #0d4ad4;
        border-color: rgba(130, 190, 255, 0.6);
        transform: translateY(-2px);
        box-shadow:
            0 8px 24px rgba(18, 90, 248, 0.35),
            0 2px 8px rgba(0, 0, 0, 0.12);
    }

    .lds-forms-widget:hover .lds-forms-widget__text {
        opacity: 1;
        width: 120px;
    }

    .lds-forms-widget:hover .lds-forms-widget__panel {
        opacity: 1;
        visibility: visible;
        transform: translateY(0) scale(1);
        pointer-events: auto;
    }
}
