@import "variables.css";

.ComponentDemo {

    & .padded {
        padding: 20px;
        @media (max-width: 600px) { padding: 0px; }
    }

    &.section {
        padding: 0px 20px 20px;
        @media (max-width: 600px) { padding: 0px 10px 10px; }
        background: var(--lighterColor);
        border-left: 2px solid var(--accentColor);
        @media (max-width: 600px) { border-left: none; }
        color: black;
        margin: 10px 0px;

        & > h3 {
            font-weight: 500;
            font-size: 1.5em;
            text-align: center;
        }
    }

    &.flex-container {

        display: flex;
        flex-wrap: wrap;
        margin-top: 30px;
        box-shadow: 3px 3px 1px #DDD;

        & > * {
            flex: 1;
            flex-basis: 0px;
            position: relative;
            min-width: 400px;
            max-width: 100%;
            max-height: 100%;
            transition: all 0.5s;

            @media (max-width: 1100px) {
                min-width: calc(100% - 40px);
                animation: none;
            }
        }

        & > div > .expander {
            position: absolute;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: var(--darkerColor);
            top: -32px;
            right: 0px;
            width: 30px;
            height: 30px;
            font-size: 20px;
            border: 1px solid var(--darkerColor);
            box-shadow: 0px 0px 1px #000;
            box-sizing: border-box;
            opacity: 0.5;
            transition: all 0.25s ease-in-out;

            &:hover {
                opacity: 1;
                color: var(--accentColor);
                box-shadow: none;
            }
        }

        & > div.demo-area {
            background-image: repeating-linear-gradient(145deg,
                var(--lighterColor),
                var(--lighterColor) 30px,
                color(var(--lighterColor) b(4%)) 30px,
                color(var(--lighterColor) b(4%)) 60px);
            align-self: flex-start;
        }

        & > div.code {
            display: flex;
            flex-direction: column;
            @media (max-width: 1100px) { border-top: 2px solid var(--accentColor); }

            & > pre[class*=language-] {
                position: relative;
                flex: 1 0 auto;
                @media (max-width: 1100px) { height: auto; }
                min-height: 250px;
                margin: 0;
                box-shadow: none;
            }
            & > pre > code {
                position: absolute;
                padding-bottom: 10px;
            }

            & .tabs {
                border-bottom: 2px solid var(--accentColor);
                font-size: 12px;
                overflow-x: hidden;

                @media (max-width: 1100px) {
                    background-color: var(--darkerColor);
                    color: #DDD;
                    text-align: center;
                }

                & > * {
                    display: inline-block;
                    vertical-align: middle;
                    cursor: pointer;
                    padding: 5px 10px;
                    /*border-bottom: 1px solid rgba(0, 0, 0, 0.1);*/
                    transition: all 0.25s ease-in-out;

                    &:hover {
                        background-color: var(--lighterColor);
                        color: var(--accentColor);

                        @media (max-width: 600px) {
                            color: var(--lighterColor);
                            background: var(--accentColor);
                        }
                    }
                    &.selected {
                        background-color: var(--accentColor);
                        color: var(--lighterColor);
                    }
                }
            }
        }

        &.expanded {
            & > div:not(.expand) {
                overflow: hidden;
                flex-grow: 0;
                min-width: 0;
                max-height: 500px;

                @media (max-width: 1100px) {
                    display: none;
                    animation: none;
                }
            }
            & > div.expand { align-self: baseline; }
            & > div.code {
                &:not(.expand) .tabs {
                    /*height: 0px;*/
                }
                &.expand {
                    & > pre > code {
                        position: relative;
                    }
                }
            }
        }
    }
}
