// (C) 2007-2025 GoodData Corporation
@use "variables";
@use "zIndexes";
@use "@gooddata/sdk-ui-kit/styles/scss/Button/variables" as button-variables;
@use "@gooddata/sdk-ui-kit/styles/scss/variables" as kit-variables;

.visualizations-flex-dimensions {
    height: 100%;
}

.configuration-scrollable-panel {
    width: 100%;
    overflow: auto;
    overscroll-behavior: contain;
}

.configuration-panel {
    width: 100%;
    height: 100%;
    padding: 10px 0;
    background-color: variables.$dialog-background;
    display: flex;
    flex-direction: column;

    h2 {
        margin: 0 15px 6px;
        font-size: 16px;
        line-height: 24px;
        color: kit-variables.$gd-color-state-blank;
    }

    .dropdown-button {
        width: variables.$gd-configuration-panel-inner-width;
        text-align: left;
    }

    .gd-button {
        max-width: 100%;
    }

    .gd-rich-text-insight-description {
        height: 85px;
        overflow: auto;
        overscroll-behavior: contain;

        textarea {
            font-weight: 400;
            font-size: 14px;
            font-family: gdcustomfont, avenir, "Helvetica Neue", arial, sans-serif;
            line-height: 19px;
            color: var(--gd-palette-complementary-7, #6d7680);
            padding: 0;
        }

        .gd-bubble-trigger {
            margin: revert;
        }
    }
}

.creation-panel {
    h3 {
        padding-left: 15px;
    }
}

// sdk-edit-mode-on is in selector to override same classes in KD.
// Can be removed when old implementation in KD removed
.gd-configuration-bubble-wrapper.overlay-wrapper.sdk-edit-mode-on {
    $gd-configuration-bubble-arrow-offset: 35px;
    $gd-configuration-bubble-arrow-height: 14px;

    z-index: zIndexes.$configuration-panel;

    &.is-sticky {
        z-index: zIndexes.$configuration-panel-sticky;
    }

    // make configuration panel visible over dashboard headers when screen size is limited
    // and alignPoints matches the custom class
    &.target-br {
        z-index: zIndexes.$configuration-panel;
    }

    .gd-configuration-bubble {
        z-index: zIndexes.$configuration-panel-bubble;
        width: variables.$gd-configuration-bubble-width;

        &.is-sticky {
            z-index: zIndexes.$configuration-panel-bubble-sticky;
        }

        &.arrow-right-direction {
            margin-left: 20px;
        }

        .bubble-content {
            padding: 0;
        }

        .configuration-panel-kpi {
            .configuration-category.description-configuration-section {
                margin: 25px 0 0 0;
            }
        }

        .configuration-panel {
            max-height: variables.$gd-configuration-bubble-height;
            overflow-x: hidden;
            overflow-y: auto;
            overscroll-behavior: contain;
            padding: 0;
        }

        .configuration-category {
            margin-top: variables.$gd-configuration-bubble-margin;
            margin-left: variables.$gd-configuration-bubble-margin;
            margin-right: variables.$gd-configuration-bubble-margin;
            margin-bottom: 0;
            padding: 0;

            &:last-child {
                margin-bottom: variables.$gd-configuration-bubble-margin;
            }
        }

        .configuration-category h3 {
            padding-left: 0;
        }

        .configuration-category-item {
            display: block;
            padding: variables.$filter-config-padding 0;
            font-size: 12px;
            line-height: 20px;

            .input-label-text {
                display: flex;
            }

            // Same selector and rule as in KD to have consistent look in Dashboard component and in KD.
            label .gd-bubble-trigger {
                margin: 0 5px;
            }
        }

        .configuration-panel-header-title-button {
            border: none;
            padding: 0;
            background: transparent;
            cursor: pointer;

            &:hover {
                background: transparent;
            }
        }

        .configuration-panel-header-title {
            flex-grow: 1;
            color: kit-variables.$gd-color-state-blank;
            font-size: 11px;
            line-height: 20px;
            font-weight: bold;
            text-transform: uppercase;
        }

        .configuration-panel-header-title.clickable {
            cursor: pointer;
        }

        .configuration-panel-screen {
            overflow: hidden;
            display: flex;
        }

        .configuration-panel-header-title i {
            font-size: 14px;
            margin-right: 5px;
            position: relative;
            top: 2px;
        }

        .configuration-panel-header-close-button::before {
            font-size: 12px;
            padding-right: 0;
            margin-right: 0;
        }

        &.arrow-br .bubble-content .arrow-position,
        &.arrow-bl .bubble-content .arrow-position {
            top: auto;
            bottom: $gd-configuration-bubble-arrow-offset;
        }

        .arrow-position {
            top: $gd-configuration-bubble-arrow-offset;
        }

        .configuration-panel-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            padding: 3px 10px 3px 15px;
            background: kit-variables.$is-focused-background;
        }

        .configuration-panel-footer {
            padding: 10px 10px 0;

            .configuration-panel-footer__content {
                border-top: 1px solid kit-variables.$gd-border-color;
                padding: 10px 0;
            }
        }
    }
}

// sdk-edit-mode-on is in selector to override same classes in KD.
// Can be removed when old implementation in KD removed
.sdk-edit-mode-on {
    .configuration-category {
        margin-bottom: 20px;

        &:last-child {
            margin-bottom: 0;
        }

        h3 {
            position: relative;
            overflow: hidden;
            margin: 25px 0 10px;
            font-size: 11px;
            font-weight: bold;
            text-transform: uppercase;
            color: kit-variables.$gd-color-state-blank;

            &.is-disabled {
                color: variables.$dialog-border;
            }

            &::after {
                content: "";
                position: absolute;
                top: 50%;
                display: inline-block;
                width: 100%;
                height: 0;
                margin-left: 10px;
                border-top: 1px solid kit-variables.$gd-border-color;
            }

            .configuration-panel-header-title {
                color: kit-variables.$gd-color-state-blank;
                font-size: 11px;
                font-weight: bold;
                text-transform: uppercase;
            }

            .configuration-panel-header-title.clickable {
                cursor: pointer;
            }

            .configuration-panel-screen {
                overflow: hidden;
                display: flex;
            }

            .configuration-panel-header-title i {
                font-size: 14px;
                margin-right: 5px;
                position: relative;
                top: 2px;
            }

            .configuration-panel-header-close-button::before {
                font-size: 12px;
                padding-right: 0;
                margin-right: 0;
            }
        }

        > h3:first-child {
            margin-top: 0;
        }

        label {
            display: block;
            margin-top: 2px;
            font-size: 13px;
            color: kit-variables.$gd-color-label;

            + label {
                margin-top: 0;
            }

            &.filter-by-item {
                display: flex;
            }
        }

        .gd-input-search {
            margin: 0 15px 10px;
        }

        .attribute-select {
            margin-top: 10px;
        }

        .subsection-disabled label {
            color: kit-variables.$gd-color-disabled;
        }

        .warning + h3 {
            margin-top: 10px;
        }

        .gd-message {
            display: block;
            word-break: break-word;
            overflow-wrap: break-word;

            &.error,
            &.warning {
                margin: 10px 0;
                padding: 10px;
                font-size: 12px;
                line-height: 18px;
            }
        }
    }

    .configuration-category-vis {
        overflow: hidden;
    }

    .filter-by-item {
        justify-content: space-between;
        align-items: center;
        padding-right: 0;

        input,
        .gd-spinner {
            flex: 0 0 auto;
        }

        span {
            flex: 1 1 auto;
            overflow: hidden;
            white-space: nowrap;
        }

        .input-label-text {
            display: flex;
        }

        .gd-bubble-trigger {
            margin: 0;
        }

        .gd-spinner {
            margin-left: 10px;
        }
    }

    .configuration-subcategory {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        margin-left: 23px;
    }

    .subcategory-label {
        flex: 0 0 auto;
        margin-right: 10px;
    }

    .subcategory-dropdown {
        flex: 1 1 auto;
        overflow: hidden;
        padding: 6px 0;
    }

    .date-filter-error,
    .attribute-filter-error {
        .title {
            color: kit-variables.$gd-palette-error-base;
        }
    }

    .is-highlighted {
        // overwrite
        // stylelint-disable-next-line declaration-no-important
        border: 1px solid kit-variables.$gd-palette-primary-base !important;

        // refactor
        // stylelint-disable-next-line max-line-length
        box-shadow:
            0 0 3px 0 variables.$gd-palette-primary-base-t50,
            0 1px 2px 0 button-variables.$button-shadow-darker;
        color: kit-variables.$gd-palette-primary-base;
    }

    .dataSets-list {
        .gd-list-item-header {
            padding: 11px 10px 6px;
        }
    }

    .drill-to-dropdown-container {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        width: 100%;
    }

    .drill-to-dropdown {
        display: inline-block;
        // 25px is the space needed to accommodate both the X button and scrollbar on Windows (it is wider than on macOS)
        // allow the dropdown to shrink a bit if there is a wider scrollbar
        max-width: variables.$gd-configuration-panel-inner-width - 25px;

        &:last-child {
            width: 100%;
        }
    }

    .button-remove-drill-to {
        position: relative;
        margin: -1px -8px -1px 0;
        text-decoration: none;

        &:hover {
            text-decoration: none;
        }
    }

    .gd-visualizations-list {
        overflow: hidden;
        text-align: left;

        .gd-dropdown-tabs {
            margin-left: 15px;
            margin-right: 15px;
        }

        .gd-infinite-list-item:hover {
            // overwrite
            // stylelint-disable-next-line declaration-no-important
            z-index: 1 !important;
        }

        .gd-infinite-list-item {
            background: none;
        }

        .gd-visualizations-list-item {
            margin-left: 15px;
            margin-right: 15px;
            padding-right: 5px;
            padding-left: 5px;
        }

        .gd-visualizations-list-no-data.gd-no-data {
            margin: 0;
            padding: 10px 20px;
            color: kit-variables.$gd-color-state-blank;
            text-align: left;

            &.gd-visualization-list-not-found {
                text-align: center;
                padding: 0 20px;
            }

            .gd-button {
                padding: 0;
            }
        }
    }

    .gd-visualizations-list-item-wrap {
        &.is-first {
            margin-top: 10px;
        }

        &.is-last {
            margin-bottom: 10px;
        }
    }

    .flex-panel-full-height {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        align-content: stretch;
        height: 100%;

        .flex-panel-item-stretch {
            display: flex;
            flex-grow: 1;
            flex-direction: column;
            align-items: stretch;
            align-content: stretch;

            .visualizations-list-wrap {
                position: relative;
                flex: 1 1 auto;
                height: 0;

                // refactor
                // stylelint-disable-next-line max-nesting-depth
                .gd-visualizations-list {
                    // refactor
                    // stylelint-disable-next-line max-nesting-depth
                    .gd-flex-item-stretch {
                        overflow-x: hidden;
                    }
                }
            }
        }
    }

    .gd-kpi-date-dataset-dropdown {
        .gd-button {
            width: 159px;
        }
    }

    .metrics-dropdown {
        width: variables.$gd-configuration-panel-inner-width;

        .dropdown-body {
            flex-direction: column;
        }
    }

    .zoom-and-pan-section {
        .gd-configuration-bubble-wrapper.overlay-wrapper .gd-configuration-bubble .bubble-content & {
            margin-top: 10px;
        }

        h6 {
            display: none;
        }

        .gd-icon-circle-question {
            cursor: help;
            margin-left: -12px;
            margin-top: -3px;

            &:hover::before {
                color: var(--gd-palette-complementary-5-from-theme, #999);
            }

            &::before {
                font:
                    14px/1 "Indigo",
                    sans-serif;
                color: var(--gd-palette-complementary-5-from-theme, #bbb);
            }
        }

        .input-label-text {
            font-size: 13px;
            color: var(--gd-palette-complementary-8, #464e56);
        }

        .gd-message {
            margin-top: 5px;
        }

        .input-checkbox-label {
            display: inline-block;
        }
    }

    .configuration-panel-content {
        display: flex;
        height: 100%;
        flex-direction: column;
    }

    .description-configuration-section {
        .dropdown-button.description-config-dropdown-button {
            width: auto;
            padding: 0 10px 0 10px;
        }

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

        .description {
            font-size: 13px;
            resize: none;

            &:not(:disabled) {
                color: kit-variables.$gd-color-text;
            }
        }

        .include-metrics-wrapper {
            margin-top: 10px;

            .input-checkbox-label {
                display: inline-block;
            }

            .gd-bubble-trigger {
                display: inline-block;
                vertical-align: middle;
            }
        }

        .gd-icon-circle-question {
            cursor: help;
            color: kit-variables.$gd-color-state-blank;

            &:hover {
                color: kit-variables.$gd-medium-gray;
            }
        }
    }
}

.gd-cross-filtering-configuration {
    margin-top: 10px;

    .question-mark-icon {
        margin-left: 5px;
        position: relative;
        top: 4px;
    }
}

.gd-configuration-export-options {
    width: 100%;

    .gd-export-options-pdf-presentation,
    .gd-export-options-pptx-presentation,
    .gd-export-options-xlsx,
    .gd-export-options-csv,
    .gd-export-options-csv-raw,
    .gd-export-options-png {
        justify-content: flex-start;
    }

    .gd-export-icon {
        margin-right: 10px;
        display: flex;
    }
}
