// (C) 2007-2026 GoodData Corporation
@use "Dialog/_mixins" as dialog-mixins;
@use "variables";
@use "Dialog/variables" as dialog-variables;
@use "mixins";
@use "typo-mixins";

// STYLES FROM GOODSTRAP
.modalityPlugin-mask {
    position: fixed;
    // Same layer as .overlay-wrapper. The later mask then covers open drawers and overlays.
    z-index: 5001;
    top: 0;
    left: 0;
    display: none;
    width: 100%;
    height: 100%;
    opacity: 0.9;
    background-color: dialog-variables.$gd-modal-outsideBackgroundColor;
}

.modalityPlugin-mask-visible {
    display: block;
}

.gd-dialog:not(.gd-dropdown),
.overlay.gd-dialog:not(.gd-dropdown) {
    position: relative;
    z-index: 2;
    padding: 20px;
    max-width: dialog-variables.$modalDialog-maxWidth;
    border-style: solid;
    border-color: dialog-variables.$gd-modal-borderColor;
    border-radius: dialog-variables.$gd-modal-borderRadius;
    border-width: dialog-variables.$gd-modal-borderWidth;
    box-shadow: dialog-variables.$gd-modal-boxShadow dialog-variables.$modal-shadow-darker;
    overflow-wrap: break-word;

    &.gd-dialog--wide {
        max-width: dialog-variables.$modalDialog-wide-maxWidth;
    }

    /**
     * Row inside a row has negative margin.
     * Dialog can be inserted anywhere to the DOM,
     * we have to set default value to be consistent
     * across all applications
     */
    .row {
        width: auto;
        margin-left: calc(-#{dialog-variables.$column-gutter} / 2);
        margin-right: calc(-#{dialog-variables.$column-gutter} / 2);
    }

    .gd-dialog-close,
    .gd-dialog-close.gd-button-link {
        position: absolute;
        z-index: 5;
        top: 14px;
        right: 14px;

        &::before {
            color: variables.$gd-color-link;
        }

        @include mixins.active-states {
            box-shadow: none;
            border-color: transparent;

            &::before {
                color: variables.$gd-palette-primary-base;
            }
        }
    }
}

.gd-dialog.gd-confirm {
    max-width: 350px;

    .gd-dialog-close,
    .gd-dialog-close.gd-button-link {
        top: 10px;
    }
}

.gd-dialog-header-wrapper {
    display: flex;
}

.gd-dialog-header {
    @include mixins.text-overflow();

    margin: 0 30px 20px 0;

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        margin: 0;
        padding: 0;
    }

    h2,
    h3,
    div {
        @include mixins.text-overflow();

        line-height: 1.2;
    }

    h2 {
        @include typo-mixins.gd-heading-2;
    }

    h3 {
        @include typo-mixins.gd-heading-3;
    }
}

.gd-dialog-header.gd-dialog-header-with-border {
    border-bottom: 1px solid dialog-variables.$gd-modal-title-lineColor;
}

.gd-dialog-icon {
    @include typo-mixins.gd-heading-1;

    display: inline-block;
    width: 35px;
    vertical-align: middle;

    &::before {
        color: variables.$gd-palette-primary-base;
    }
}

.gd-dialog-section {
    margin-bottom: 20px;

    & + .gd-dialog-footer {
        margin-top: 30px;
    }
}

.gd-dialog-section-separated {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid variables.$gd-border-color;

    & + .gd-dialog-footer {
        margin-top: 30px;
    }

    & + & {
        margin-top: 20px;
    }
}

.gd-dialog-warning {
    width: 100%;
    margin-bottom: 12px;
    padding: 8px;
    border-radius: 4px;
    background-color: #fff3f2;
    color: variables.$gd-palette-error-base;
}

.gd-dialog-content,
.gd-dialog-section,
.gd-dialog-section-separated {
    p {
        &:first-of-type {
            margin-top: 0;
        }

        &:last-of-type {
            margin-bottom: 0;
        }
    }
}

.gd-dialog-footer {
    margin-top: 20px;
    text-align: right;
}

.gd-dialog-spinner {
    position: relative;
    top: 4px;
    right: 16px;
    display: inline-block;
}

/* Export Dialog
   ========================================================================== */

.gd-export-dialog {
    min-width: 350px;

    .gd-dialog-header h3 {
        margin: 0;
        padding: 0;
    }

    .gd-export-dialog-item {
        margin-top: 10px;

        h4 {
            margin: 0;
        }

        &:first-of-type {
            margin-top: 0;
        }
    }

    .input-label-text {
        margin-left: 3px;
    }
}

/* Community edition Dialog
   ========================================================================== */

.gd-community-dialog-header {
    margin-top: 0;
    margin-bottom: 1em; // override goodstrap
}

.gd-community-dialog-info::after {
    // stylelint-disable-next-line declaration-no-important
    content: none !important; // override goodstrap
}

.gd-community-dialog-copyright {
    margin-top: 1em; // override goodstrap
}

.gd-community-dialog-links {
    padding: 0;
    list-style: none;

    li {
        &:not(:last-child) {
            margin-bottom: 0.7em;
        }

        a {
            color: variables.$default-gd-color-link;
            text-decoration: underline;
        }
    }
}

/* Conversion touch point Dialog
   ========================================================================== */
.overlay.gd-dialog.conversion-touch-point-dialog {
    width: 320px;
    height: 340px;

    @media screen and (max-width: 400px) {
        width: 290px;
    }

    .conversion-touch-point-dialog-wrapper {
        position: relative;
    }

    h3 {
        font-weight: 900;
        font-size: 20px;
        margin: 0 0 25px;
    }

    .gd-button-secondary {
        position: absolute;
        right: 85px;
        bottom: 0;
    }
}

.overlay.gd-dialog.conversion-touch-point-dialog .hubspot-form {
    .hs-form-field {
        label {
            font-size: 14px;
            line-height: 14px;
            color: #464e56;
        }

        .input {
            margin-top: 10px;
        }
    }

    ul.inputs-list {
        list-style-type: none;
        margin: 0 0 15px 0;
        padding: 0 0 0 5px;
    }

    .hs-form-radio {
        margin-bottom: 0;
    }

    textarea.hs-input {
        box-sizing: border-box;
        width: 100%;
        min-height: 92px;
        resize: none;
        margin: 0;
        padding: 6px 7px 5px;
        border: 1px solid var(--gd-palette-complementary-4, #ccd8e2);
        box-shadow: inset 0 1px 1px 0 rgba(31, 53, 74, 0.15);
        line-height: normal;
        vertical-align: middle;
        color: var(--gd-palette-complementary-8, #464e56);
        background: var(--gd-palette-complementary-0, #fff);
        font-size: 14px;
        font-family: gdcustomfont, avenir, "Helvetica Neue", arial, sans-serif;
        font-weight: 200;
        transition-property: all;
        transition-duration: 0.25s;
        transition-timing-function: ease-in-out;
        border-radius: 3px;

        &:hover {
            border-color: #b1c1d1;
        }
    }

    .hs-form-radio-display {
        position: relative;
        display: inline-block;
        height: 20px;
        padding: 0 10px 0 23px;
        line-height: 20px;
        margin-left: -3px;

        &:hover,
        &:active {
            & span::before {
                border-color: #94a1ad;
                box-shadow: inset 0 1px 2px 0 rgba(31, 53, 74, 0.25);
            }
        }

        input[type="radio"] {
            position: absolute;
            opacity: 0;

            &:checked ~ span::before {
                border-color: transparent;
                background-color: #14b2e2;
            }

            &:checked ~ span::after {
                transform: scale(1);
            }
        }

        span {
            line-height: inherit;
            vertical-align: middle;
            color: #464e56;

            &::before,
            &::after {
                content: "";
                position: absolute;
                box-sizing: content-box;
                cursor: pointer;
            }

            &::before {
                top: 0;
                left: 3px;
                width: 12px;
                height: 12px;
                border: 1px solid #b1c1d1;
                transition: all 0.2s;
                background-color: #fff;
                border-radius: 50%;
            }

            &::after {
                top: 4px;
                left: 7px;
                width: 6px;
                height: 6px;
                border-radius: 50%;
                background-color: #fff;
                transform: scale(0);
                transition: transform 0.2s;
            }
        }
    }

    .hs-submit {
        margin-top: 30px;
        text-align: right;

        input[type="submit"] {
            position: relative;
            display: inline-flex;
            justify-content: space-between;
            align-items: center;
            padding: 5px 14px;
            border: 1px solid rgba(0, 0, 0, 0.1);
            border-radius: var(--gd-button-borderRadius, 3px);
            box-shadow: var(--gd-button-dropShadow, 1px 1px 0)
                var(--gd-shadow-color-from-theme, rgba(20, 56, 93, 0.09));
            font:
                700 14px/20px gdcustomfont,
                avenir,
                "Helvetica Neue",
                arial,
                sans-serif;
            white-space: nowrap;
            vertical-align: middle;
            text-align: left;
            text-transform: var(--gd-button-textCapitalization, none);
            color: var(--gd-palette-complementary-0, #fff);
            background: var(--gd-palette-primary-base, #14b2e2);
            cursor: pointer;
            transition: all 0.25s ease-in-out;

            &:hover {
                box-shadow:
                    0 1px 1px 0 var(--gd-shadow-color, rgba(20, 56, 93, 0.15)),
                    inset 0 -1px 0 0 rgba(0, 0, 0, 0.15);
                background: var(--gd-palette-primary-base-d06, #129cc6);
            }

            &:focus {
                box-shadow:
                    var(--gd-button-dropShadow, 0 0 3px 1px)
                        var(--gd-palette-primary-focus, rgba(41, 190, 236, 0.6)),
                    var(--gd-button-dropShadow, 0 1px 1px 0) var(--gd-shadow-color, rgba(20, 56, 93, 0.15)),
                    inset 0 -1px 0 0 rgba(0, 0, 0, 0.15);
            }

            &:active {
                box-shadow: inset 0 2px 0 0 rgba(0, 0, 0, 0.15);
                background: var(--gd-palette-primary-base-d06, #129cc6);
                background-image: linear-gradient(
                    to top,
                    var(--gd-palette-primary-base-d12, #0f86aa),
                    var(--gd-palette-primary-base-d06, #129cc6)
                );
            }
        }
    }
}
