/*
 * Theme chat button (Magento_Theme/templates/html/sr-chat-button.phtml) in place of Zendesk's
 * launcher. Iconsax TwoTone conversation-box, white on logo orange.
 * Selectors use button.sr-chat-button to win over Luma's global button styles.
 */

/* Zendesk's own launcher stays hidden; its chat window (iframe#webWidget) is unaffected */
iframe#launcher {
    display: none !important;
}

button.sr-chat-button {
    position: fixed;
    right: max(24px, env(safe-area-inset-right, 0px));
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 56px;
    height: 56px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: #f26a21;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

button.sr-chat-button[hidden] {
    display: none;
}

button.sr-chat-button:hover,
button.sr-chat-button:focus,
button.sr-chat-button:active {
    border: 0;
    background-color: #d95b17;
    color: #ffffff;
}

button.sr-chat-button:hover {
    transform: translateY(-2px);
}

button.sr-chat-button:focus-visible {
    outline: 3px solid rgba(242, 106, 33, 0.4);
    outline-offset: 4px;
}

.sr-chat-button__icon {
    display: block;
    width: 28px;
    height: 28px;
    background-color: currentColor;
    -webkit-mask: url('../images/icons/conversation-box.svg') center / 28px 28px no-repeat;
    mask: url('../images/icons/conversation-box.svg') center / 28px 28px no-repeat;
}

@media (max-width: 448px) {
    button.sr-chat-button {
        right: max(16px, env(safe-area-inset-right, 0px));
        bottom: max(16px, env(safe-area-inset-bottom, 0px));
        width: 52px;
        height: 52px;
    }
}

@media (prefers-reduced-motion: reduce) {
    button.sr-chat-button {
        transition: none;
    }

    button.sr-chat-button:hover {
        transform: none;
    }
}

/* ---------- Consent modal (#sr-chat-consent), opened by the button while Zendesk has no consent ---------- */
.sr-modal-dialog .sr-chat-consent__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.sr-modal-dialog .sr-chat-consent button.sr-chat-consent__accept,
.sr-modal-dialog .sr-chat-consent button.sr-chat-consent__cancel {
    box-sizing: border-box;
    min-height: 48px;
    margin: 0;
    padding: 0 24px;
    border: 1px solid #f26a21;
    border-radius: 24px;
    background: #f26a21;
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sr-modal-dialog .sr-chat-consent button.sr-chat-consent__accept:hover {
    border-color: #d95b17;
    background: #d95b17;
}

.sr-modal-dialog .sr-chat-consent button.sr-chat-consent__cancel {
    border-color: #86868b;
    background: transparent;
    color: #333333;
}

.sr-modal-dialog .sr-chat-consent button.sr-chat-consent__cancel:hover {
    border-color: #333333;
}

.sr-modal-dialog .sr-chat-consent button:focus-visible {
    outline: 3px solid rgba(242, 106, 33, 0.4);
    outline-offset: 4px;
}

@media (max-width: 448px) {
    .sr-modal-dialog .sr-chat-consent button.sr-chat-consent__accept,
    .sr-modal-dialog .sr-chat-consent button.sr-chat-consent__cancel {
        flex: 1 1 100%;
    }
}
