
@use "sass:map";
@import './modal';
@import './vars';

.klaro-ide {

    @import './switch';
    @import './controls';
    @import './tabs';
    @import './list';
    @import './dropdown';

    label {
        display: inline-block;
    }

    .cm-global-fields,
    .cm-config-controls,
    .cm-translations-fields,
    .cm-service-fields {
        max-width: 600px;

    }

    .cm-json {
        .cm-file-import {
            display: none;
        }

        .cm-upload-label {
            cursor: pointer;

            button {
                pointer-events: none;
            }
        }

        pre code {
            white-space: pre-wrap;
        }
    }

    .cm-message {
        padding: map.get($cm-space, md);

        &.cm-error,
        &.cm-success {
            @include var(border-radius, border-radius);
            @include var(color, white1);
            box-shadow: $cm-box-shadow-light-sm;
            margin-bottom: map.get($cm-space, lg);
        }

        &.cm-error {
            @include var(background-color, red2);
        }

        &.cm-success {
            @include var(background, green2);
        }
    }

    .cm-space-sm {
        margin-bottom: map.get($cm-space, sm) !important;
    }

    .cm-space-md {
        margin-bottom: map.get($cm-space, md) !important;
    }

    .cm-space-lg {
        margin-bottom: map.get($cm-space, lg) !important;
    }

    .cm-json,
    .cm-global-fields,
    .cm-config-controls,
    .cm-translations-fields,
    .cm-service-fields {
        h1,
        h2,
        h3,
        h4 {
            font-size: 2em;
            text-transform: uppercase;
            margin-top: 10px;
            margin-bottom: 10px;
            font-weight: 600;
        }

        h1 {
            @include var(border-style, border-style);
            @include var(border-width, border-width);
            @include var(border-color, light2);
            text-transform: none;
            margin-bottom: 20px;
            display: inline-block;
        }

        h2 {
            font-size: 1.6em;
        }

        h3 {
            font-size: 1.3em;
        }

        h4 {
            font-size: 1em;
            font-weight: 600;
        }
    }

    p.cm-section-description {
        @include var(color, dark2);
        text-align: justify;
        margin-top: map.get($cm-space, sm);
        margin-bottom: map.get($cm-space, lg);
    }

    .cm-purpose-order {
        ul {
            margin-top: map.get($cm-space, md);
            margin-bottom: map.get($cm-space, md);

            li {
                display: flex;

                span.cm-buttons {
                    @include var(border-radius, border-radius);
                    flex-grow: 0;
                    box-shadow: $cm-box-shadow-light-sm;

                    a {
                        padding: map.get($cm-space, md);
                        display: inline-block;

                        &:hover {
                            @include var(background, green1);
                        }
                    }
                }

                span.cm-value {
                    flex-grow: 1;
                    padding: map.get($cm-space, md);
                }
            }
        }
    }

    .cm-translations-fields {
        .cm-translations-for-key {
            @include var(border-radius, border-radius);
            @include var(background-color, white1);
            box-shadow: $cm-box-shadow-light-sm;
            padding: map.get($cm-space, md);
            margin-bottom: map.get($cm-space, lg);

            li {
                display: flex;
                justify-content: space-between;
                align-items: flex-start;

                span.cm-lang {
                    font-family: Courier;
                    display: block;
                    padding: 20px;
                    margin-top: 5px;
                    flex-grow: 0;
                }
            }
        }
    }

    .cm-service-list,
    .cm-config-list {
        .cm-status {
            text-align: left;

            span {
                padding-left: 10px;
            }

            .cm-status-is-active {
                @include var(color, green1);
            }

            .cm-status-is-inactive {
                @include var(color, red1);
            }
        }

        .cm-name {
            text-transform: uppercase;
            font-weight: 600;
        }
    }


    p.cm-no-cookies,
    p.cm-no-services {
        margin-top: 6px;
        margin-bottom: 6px;
        font-weight: 600;
    }

    .cm-cookie-config {
        .cm-cookie-forms {
            .cm-cookie-form {
                @include var(border-bottom-style, border-style);
                @include var(border-bottom-width, border-width);
                @include var(border-bottom-color, light2);
            }
        }
    }

    .cm-demo {
        .cm-config-controls {
            .cm-retracting-label-input {
                width: auto;
                flex-grow: 1;
                margin-right: map.get($cm-space, md);
            }

            &:first-child {
                @include var(border-bottom-style, border-style);
                @include var(border-bottom-width, border-width);
                @include var(border-bottom-color, light2);
            }
        }
    }

    .cm-config-controls {
        margin-top: map.get($cm-space, sm);
        margin-bottom: map.get($cm-space, lg);
        max-width: none;
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        align-items: baseline;
        justify-content: space-between;

        h2 {
            margin-right: map.get($cm-space, lg);
            display: block;
            flex-grow: 1;
        }

        .cm-control {
            flex-shrink: 1;
            display: inline-block;
            margin-bottom: 20px;

            .cm-retracting-label-input {
                max-width: 400px;
                display: block;
            }

            input {
                max-width: 400px;
            }

            select {
                @include var(border-color, green1);
                @include var(border-radius, border-radius);
                @include var(border-style, border-style);
                @include var(border-radius, border-radius);
                @include var(background-color, white1);
                padding: map.get($cm-space, md);
                margin-bottom: map.get($cm-space, md);
                display: block;
            }
        }

        .cm-control-button {

            @include var(border-radius, border-radius);
            @include var(background-color, blue2);
            @include var(color, white1);

            border-style: none;
            padding: 12px;
            margin-top: 4px;
            cursor: pointer;
            box-shadow: $cm-box-shadow-dark-sm;
            margin-right: 6px;

            &.cm-delete {
                @include var(background-color, red3);
                float: right;
            }

            &.cm-secondary {
                @include var(background-color, red2);
            }

            &.cm-success {
                @include var(background-color, green1);
            }

            &:disabled {
                @include var(background-color, light1);
                @include var(color, dark1);
                cursor: not-allowed;
            }
        }
    }

    .cookie-modal {
        .cm-modal {
            &.cm-ide {
                @include modal(1020px, 1000px);
            }
        }
    }
}
