@use "variables";

$added-color: #5ecb0e;
$deprecated-color: #ff9a4d;

$sidebar-width: 22%;
$beer-height: 70px;

.documentation-body {
    background: variables.$grey;
    display: flex;

    .main {
        padding: 0 60px;
        height: 100vh;
        width: 100% - $sidebar-width;
        overflow: auto;
    }

    .main-demos {
        padding: 0;
        overflow: hidden;

        iframe {
            width: 100%;
            height: 100vh;
            background: variables.$grey;
        }
    }

    .main-demo-inner {
        width: 100%;
    }

    .section-title {
        padding: 50px 0 0;
    }

    h3 {
        display: inline-block;
        font-weight: bold;
        font-size: 26px;
    }

    h4 {
        padding: 20px 0 0;
    }

    p,
    dd,
    ul {
        & > code,
        *:not(pre) > code {
            color: #616870;
            background: #dfe5eb;
            padding: 0 5px;
            border-radius: 4px;
        }

        a code {
            color: inherit;
        }
    }

    code.type {
        padding: 0 3px;
        color: variables.$primary-color-dark;

        &::before {
            content: "<";
        }

        &::after {
            content: ">";
        }
    }

    .button.button-demo {
        border-color: rgba(variables.$secondary-color, 0.6);
        color: variables.$secondary-color;
        width: auto;
        padding: 10px 30px;

        &:hover,
        &:focus {
            text-decoration: none;
            border-color: variables.$secondary-color;
            background: variables.$secondary-color;
            color: variables.$white;
        }
    }

    ::-webkit-scrollbar {
        width: 17px;
    }

    ::-webkit-scrollbar-track {
        background: variables.$grey;
    }

    ::-webkit-scrollbar-thumb {
        background: #cfd7de;
        border: 2px solid variables.$grey;

        &:hover {
            background: #616870;
        }
    }
}

.header-documentation {
    margin-top: 50px;

    .documentation-logo-link {
        display: block;
        margin: 0 auto;
        width: 80%;
        max-width: 350px;

        .documentation-logo {
            width: 100%;
        }
    }

    .documentation-title {
        text-align: center;
        font-family: variables.$panton;
        font-weight: 100;
        line-height: 1;

        @media (max-width: 1290px) {
            font-size: 2.5vw;
        }
    }

    .documentation-menu {
        text-align: center;
        margin-top: 40px;
        background: variables.$secondary-color;

        a {
            display: inline-block;
            padding: 20px 5px;

            &:hover,
            &:focus {
                text-decoration: underline;
            }
        }

        @media (max-width: 1550px) {
            padding: 5px 7%;

            a {
                width: 48%;
                padding: 10px 0;
            }

            .documentation-menu-dot {
                display: none;
            }
        }
    }
}

.sidebar {
    position: relative;
    top: 0;
    left: 0;
    height: 100vh;
    color: variables.$white;
    background: variables.$primary-color linear-gradient(to bottom left, variables.$primary-color, variables.$primary-color-light);
    width: $sidebar-width;

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: variables.$primary-color-light;
        border: 1px solid variables.$primary-color-light;
        border-right: none;

        &:hover {
            background: variables.$white;
        }
    }

    &::after {
        content: "";
        display: block;
        position: absolute;
        left: 0;
        bottom: $beer-height;
        width: calc(100% - 17px);
        height: 100px;
        background: linear-gradient(to bottom, rgba(variables.$primary-color-light, 0), variables.$primary-color-light);
        pointer-events: none;
    }

    .sidebar-inner {
        overflow: auto;
        overflow-y: scroll;
        overflow-x: hidden;
        height: calc(100vh - #{$beer-height});
    }

    ul,
    li {
        padding: 0;
        margin: 0;
        list-style: none;
    }

    a {
        text-decoration: none;
        color: variables.$white;
        transition: color variables.$transition-duration, text-indent variables.$transition-duration;
    }

    .documentation-summary {
        position: relative;
        font-size: 18px;
        margin-bottom: 100px;

        > ul {
            max-width: 340px;
            margin: 0 auto;
            padding: 0 30px;

            a,
            .documentation-summary-title {
                display: block;
                height: 30px;
                line-height: 30px;
                text-overflow: ellipsis;
                width: 100%;
                white-space: nowrap;
                overflow: hidden;
            }

            > li {
                margin-top: 30px;

                &:first-child {
                    margin-top: 50px;
                }

                > a,
                .documentation-summary-title {
                    font-weight: 600;
                    text-transform: uppercase;
                    margin-bottom: 5px;
                }

                > a {
                    &:hover,
                    &:focus {
                        color: variables.$primary-color-dark;
                    }
                }

                ul li a {
                    &:hover,
                    &:focus {
                        color: variables.$primary-color-dark;
                        text-indent: 10px;
                    }
                }
            }
        }
    }

    .documentation-sidebar-beer {
        position: fixed;
        width: $sidebar-width;
        bottom: 0;
        left: 0;
        background: variables.$white;
        height: $beer-height;

        a {
            position: relative;
            display: block;
            height: $beer-height;
            width: 100%;
            text-align: left;
            padding: 10px 17px 0 0;
            background: none;
            border: none;
            border-top: 1px solid #e9eef3;
            color: #9ca4ac;

            &:focus {
                outline: none;
            }

            .beer-icon {
                display: none;
            }

            @media (min-width: 1700px) {
                .beer-icon {
                    position: absolute;
                    display: block;
                    width: calc((100% - 236px) / 2);
                    height: 50px;
                    margin: 0 auto;
                }
            }

            .beer-label {
                position: relative;
                display: block;
                max-width: 236px;
                margin: 0 auto;
            }

            @media (max-width: 1290px) {
                .beer-label {
                    font-size: 14px;
                    margin: 0;
                    padding: 7px 0 0 15px;
                    width: 200px;
                }
            }
        }
    }
}

.added-feature,
.deprecated-feature {
    display: inline-block;
    padding: 3px 13px;
    margin: 0;
    color: variables.$white;
    font-size: 14px;
    border-radius: 50px;
    transform: translateX(10px) translateY(-4px);
}

.added-feature {
    background: $added-color;
}

.deprecated-feature {
    background: $deprecated-color;
}

.deprecated-info {
    padding: 7px 15px;
    border-radius: 4px;
    background: #f2dfc1;
    border: 1px solid $deprecated-color;

    a {
        color: $deprecated-color;
    }
}

.version-tag {
    display: inline-block;
    padding: 2px 6px;
    background: $added-color;
    color: #FFF;
    font-size: 12px;
    font-style: normal;
    border-radius: 20px;
}

.note .version-tag {
    transform: translateY(-1px);
}

.feature {
    position: relative;
    padding-bottom: 60px;

    &::after {
        content: " ";
        display: block;
        position: absolute;
        bottom: 0;
        left: 50%;
        width: 40%;
        height: 0;
        border-bottom: 1px solid variables.$primary-color-light;
        transform: translateX(-50%);
    }

    h3,
    h4 {
        display: inline-block;
        position: relative;
    }

    h3 {
        padding-top: 50px;
        margin-left: -15px;
        padding-left: 15px;
    }

    h4 {
        font-size: 20px;
        font-weight: bold;
    }

    h3 + h4,
    h3 + a + h4 {
        display: block;
    }

    .title-link {
        display: block;
        position: absolute;
        left: -45px;
        height: 30px;
        width: 30px;
        opacity: 0;
        text-align: center;
        text-decoration: none;
        background: variables.$primary-color;
        border-radius: 50%;
        transform: translateY(-36px);
        transition: opacity variables.$transition-duration, background variables.$transition-duration, color variables.$transition-duration;

        &:hover,
        &:focus {
            background: variables.$white;
            text-decoration: none;

            svg {
                fill: variables.$primary-color;
            }
        }

        svg {
            fill: variables.$white;
            width: 70%;
            height: 100%;
        }
    }

    h4 + .title-link {
        transform: translateY(-30px);
    }

    &:hover {
        .title-link {
            opacity: 1;
        }
    }

    .trumbowyg-box,
    .trumbowyg-editor {
        margin: 24px auto;
    }
}

.sample-data {
    background: variables.$white;
    padding: 25px;

    h4 {
        padding: 0;
    }

    input {
        width: 100%;
        border: none;
        padding: 5px 7px;
        color: #616870;
        background: #dfe5eb;

        &:not(:last-child) {
            margin-bottom: 10px;
        }
    }
}

dl {
    dt {
        display: inline-block;
        color: #1b2126;
        background: #dfe5eb;
        padding: 0 4px 0 6px;
        border-radius: 4px;
    }

    dd {
        padding: 5px 0 15px;
        margin-left: 15px;

        ul {
            margin: 0.5em 0;
        }
    }
}

.tree {
    list-style: none;
    background: white;
    padding: 1em 1.5em;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);

    ul {
        position: relative;
        list-style: none;
        margin: 0;
        padding-left: 8px;
        overflow: hidden;
    }

    li {
        padding-top: 8px;
    }

    & > li {
        padding-top: 0;
    }

    ul li {
        position: relative;
        padding-left: 16px;

        &::before,
        &::after {
            content: '';
            display: block;
            position: absolute;
            background: variables.$primary-color;
        }

        &::before {
            top: 20px;
            left: 0;
            width: 12px;
            height: 1px;
        }

        &::after {
            left: 0;
            bottom: calc(100% - 20px);
            width: 1px;
            height: 500px;
        }
    }
}
