/* Holistica Profile QR */

body.hpq-modal-open,
html.hpq-modal-open {
    overflow: hidden;
}

/* Barra pulsante QR / follow — inline, affiancabili sulla stessa riga */
.hpq-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0 0 16px;
    box-sizing: border-box;
}

.hpq-actions-row--left {
    justify-content: flex-start;
}

.hpq-actions-row--center {
    justify-content: center;
}

.hpq-actions-row--right {
    justify-content: flex-end;
}

.hpq-share-bar {
    display: inline-flex;
    align-items: center;
    width: auto;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
    vertical-align: middle;
}

.hpq-share-bar + .hpq-share-bar {
    margin-left: 0;
}

.hpq-share-bar--left {
    justify-content: flex-start;
}

.hpq-share-bar--center {
    justify-content: center;
}

.hpq-share-bar--right {
    justify-content: flex-end;
}

/* Shortcode adiacenti senza wrapper: stessa riga se il genitore lo consente */
.hpq-share-bar:not(.hpq-follow-bar) + .hpq-follow-bar,
.hpq-follow-bar + .hpq-share-bar:not(.hpq-follow-bar) {
    margin-left: 10px;
}

.hpq-actions-row .hpq-share-bar + .hpq-share-bar {
    margin-left: 0;
}

.hpq-share-bar .hpq-share-btn {
    position: static;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid rgba(148, 163, 184, 0.45) !important;
    border-radius: 999px;
    background: #ffffff !important;
    color: #1e293b !important;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.hpq-share-bar .hpq-share-btn:hover,
.hpq-share-bar .hpq-share-btn:focus {
    transform: translateY(-1px);
    border-color: #9333ea !important;
    color: #1e293b !important;
    background: #ffffff !important;
    box-shadow: 0 6px 22px rgba(147, 51, 234, 0.18);
    outline: none;
}

.hpq-share-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9333ea !important;
    flex-shrink: 0;
}

.hpq-share-btn__label {
    letter-spacing: 0.01em;
    color: #1e293b !important;
}

/* Pulsante follow operatore */
.hpq-follow-bar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}

.hpq-follow-bar.hpq-share-bar--left {
    justify-content: flex-start;
}

.hpq-follow-bar.hpq-share-bar--right {
    justify-content: flex-end;
}

.hpq-follow-bar .hpq-follow-btn {
    position: static;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: none !important;
    border-radius: 999px;
    background: transparent !important;
    color: #1e293b !important;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.hpq-follow-bar .hpq-follow-btn:hover,
.hpq-follow-bar .hpq-follow-btn:focus {
    transform: translateY(-1px);
    border: none !important;
    color: #1e293b !important;
    background: transparent !important;
    box-shadow: none;
    outline: none;
    opacity: 0.88;
}

.hpq-follow-btn--following {
    cursor: default;
    opacity: 0.88;
    box-shadow: none;
}

.hpq-follow-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9333ea !important;
    flex-shrink: 0;
}

.hpq-follow-btn__label {
    letter-spacing: 0.01em;
    color: #1e293b !important;
}

.hpq-follow-toast {
    flex: 0 0 100%;
    margin: 8px 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: #059669;
}

.hpq-follow-toast[hidden] {
    display: none !important;
}

/* Modale — sempre sopra header/footer app e carrello */
.hpq-modal {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.hpq-modal[hidden] {
    display: none !important;
}

.hpq-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.hpq-modal__dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 18px 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
    box-sizing: border-box;
}

.hpq-modal__brand {
    text-align: center;
    margin-bottom: 14px;
    padding-right: 28px;
}

.hpq-modal__brand-logo {
    display: inline-block;
    height: 32px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.hpq-modal__brand-name {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #1e293b;
}

.hpq-modal__brand-site {
    margin: 6px 0 0;
    font-size: 0.8rem;
    line-height: 1.3;
    color: #64748b;
    letter-spacing: 0.02em;
}

.hpq-modal__header {
    margin-bottom: 12px;
}

.hpq-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hpq-modal__card {
    text-align: center;
    padding-top: 0;
}

.hpq-modal__title {
    margin: 0 0 4px;
    font-size: 1.15rem;
    line-height: 1.3;
    color: #1e293b;
}

.hpq-modal__subtitle {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #64748b;
}

.hpq-modal__qr-wrap {
    display: flex;
    justify-content: center;
    margin: 14px 0 0;
}

.hpq-modal__qr-frame {
    position: relative;
    display: inline-block;
    padding: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    line-height: 0;
}

.hpq-modal__qr-inner {
    display: block;
    line-height: 0;
}

.hpq-modal__qr-inner img,
.hpq-modal__qr-inner canvas {
    display: block;
    width: 220px !important;
    height: 220px !important;
    max-width: 100%;
    aspect-ratio: 1 / 1;
}

.hpq-modal__qr-inner table {
    width: 220px !important;
    height: 220px !important;
    max-width: 100%;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    table-layout: fixed;
}

.hpq-modal__qr-inner table td {
    padding: 0 !important;
    margin: 0 !important;
    line-height: 0;
}

.hpq-modal__qr-avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    padding: 4px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 0 2px #ffffff;
    box-sizing: content-box;
    pointer-events: none;
}

.hpq-modal__qr-avatar-img {
    display: block;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.hpq-modal__actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.hpq-modal__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hpq-modal__action[hidden] {
    display: none !important;
}

.hpq-modal__action:hover {
    border-color: #9333ea;
    color: #9333ea;
}

.hpq-modal__action--share {
    background: #9333ea;
    border-color: #9333ea;
    color: #ffffff;
}

.hpq-modal__action--share:hover {
    background: #7e22ce;
    border-color: #7e22ce;
    color: #ffffff;
}

.hpq-modal__toast {
    margin: 14px 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: #059669;
}

.hpq-modal__toast[hidden] {
    display: none !important;
}

/* Mobile: popup centrato — Scarica + Condividi */
@media (max-width: 640px) {
    body.mobile-app-body .hpq-modal {
        z-index: 1000001;
    }

    .hpq-modal {
        align-items: center;
        justify-content: center;
        padding: 16px;
        padding-top: max(16px, env(safe-area-inset-top, 0px));
        padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }

    .hpq-modal__backdrop {
        background: rgba(15, 23, 42, 0.62);
    }

    .hpq-modal__dialog {
        width: 100%;
        max-width: min(380px, calc(100vw - 32px));
        border-radius: 16px;
        padding: 20px 18px 18px;
        max-height: min(90vh, 720px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
        animation: hpq-modal-in 0.24s ease;
    }

    .hpq-modal__close {
        top: 10px;
        right: 10px;
    }

    .hpq-modal__brand {
        padding-right: 32px;
    }

    .hpq-modal__title {
        font-size: 1.05rem;
    }

    .hpq-modal__qr-inner img,
    .hpq-modal__qr-inner canvas {
        width: 200px !important;
        height: 200px !important;
    }

    .hpq-modal__qr-inner table {
        width: 200px !important;
        height: 200px !important;
    }

    .hpq-modal__qr-avatar,
    .hpq-modal__qr-avatar-img {
        width: 50px;
        height: 50px;
    }

    .hpq-modal__actions {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 14px;
    }

    .hpq-modal__action--download,
    .hpq-modal__action--share {
        min-height: 44px;
    }

    /* Pill bianca — sopra Divi .et_pb_button / Gecko (tutti i mobile, non solo app) */
    button.hpq-share-btn,
    .hpq-share-bar .hpq-share-btn {
        background: #ffffff !important;
        border: 1px solid rgba(148, 163, 184, 0.45) !important;
        color: #1e293b !important;
        box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12) !important;
        -webkit-appearance: none;
        appearance: none;
    }

    button.hpq-share-btn:hover,
    button.hpq-share-btn:focus,
    .hpq-share-bar .hpq-share-btn:hover,
    .hpq-share-bar .hpq-share-btn:focus {
        background: #ffffff !important;
        border-color: #9333ea !important;
        color: #1e293b !important;
        box-shadow: 0 6px 22px rgba(147, 51, 234, 0.18) !important;
    }

    .hpq-share-btn__icon {
        color: #9333ea !important;
    }

    .hpq-share-btn__label {
        color: #1e293b !important;
    }

    /* Link lunghi scheda operatore (Gecko/Divi, con o senza shell app) */
    body.single-operatore-olistico .et_pb_text a,
    body.single-operatore-olistico .et_pb_blurb a,
    body.single-operatore-olistico .et_pb_module a,
    .mobile-app-content .et_pb_text a,
    .mobile-app-content .et_pb_blurb a {
        overflow-wrap: anywhere;
        word-break: break-word;
        max-width: 100%;
    }
}

@keyframes hpq-modal-in {
    from {
        transform: scale(0.96);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}
