/* [cssnext](http://cssnext.io/) syntax */

@keyframes spin {
    from {
        transform: rotate(0deg)
    }
    to {
        transform: rotate(360deg)
    }
}

button.PokeapiButton {
    background: #263238;
    margin: 10px;
    border: 1px solid #d8d8d8;
    color: #eee;
    font-size: 0.8em;

    &:hover {
        background: #263238 !important;
        color: #EF5350 !important;
    }
}

div.PokeapiLoadMore {
    background: #EF5350;
    color: white;
    padding: 8px 0px;
    cursor: pointer;
    transition: all 0.25s;
    &:hover, &.loading {
        background: #263238;
        color: #EF5350;
    }
    &.loading {
        pointer-events: none;

        & > i {
            animation: spin 1s infinite;
        }
    }
}

.PokeapiDemo {
    background: #263238;
    color: #EEE;

    & input[type="search"] {
        width: 100%;
        color: white;
        background: #EF5350;
        border-bottom: 2px solid #263238;
        padding: 10px;

        transition: border 0.3s;
        &::placeholder { color: #DDD; }
        &:focus { border-color: white; }
    }

    & .opener {
        cursor: pointer;
        margin-left: 5px;
        &::after {
            content: '+';
            display: inline-block;
        }
    }

    & .property-row {
        display: table-row;
        text-align: left;
        & > label {
            display: table-cell;
            font-weight: bold;
            border-left: 1px solid #EF5350;
            padding-left: 1em;
            padding-bottom: 5px;
        }
        & > span {
            display: table-cell;
            padding-left: 1em;
        }
    }

    & ul {
        list-style: none;
        margin: 0;
        padding-left: 2em;

        &.depth-0 {
            padding: 10px;
            display: flex;
            flex-wrap: wrap;
            align-items: flex-start;
            text-align: center;
            justify-content: space-around;

            & > li {
                flex: 0 0 20%;
                margin: 5px;
                transition: all 0.5s;
                min-width: 150px;

                &.category:not(.folded):not(.loading) {
                    flex-basis: 100%;
                    box-shadow: 0px 0px 2px #000;
                    border-top-right-radius: 5px;
                    border-top-left-radius: 5px;
                    & > span.item {
                        box-shadow: none;
                        border-bottom-left-radius: 0px;
                        border-bottom-right-radius: 0px;
                    }
                }
                & > span.item {
                    cursor: pointer;
                    color: #fff;
                    font-weight: bold;
                    padding: 8px 0;
                    margin: 0;
                    text-align: center;
                    background: rgba(0, 0, 0, 0.2);
                    border-radius: 5px;

                    transition: all 0.25s;
                    &:hover {
                        background-color: rgba(0, 0, 0, 0.4);
                        color: #EF5350;
                        box-shadow: 0 0 2px #000;
                    }
                    & > .opener {
                        float: right;
                        margin: 0;
                        margin-right: 10px;
                    }
                }
            }
        }

        &.depth-1 {
            padding-right: 1em;
            padding-top: 10px;
            padding-bottom: 20px;
            background-color: rgba(0, 0, 0, 0.2);
            & ul li > span.item {
                &:first-child { margin-top: 20px; }
                &:last-child { margin-bottom: 20px; }
            }
        }

        & li {
            & > span.item {
                display: block;
                margin-bottom: 5px;

                & .subsection + .opener, & item-display-component + .opener {
                    display: none;
                }

                & > .subcategory, & subcategory-display-component > .subcategory {
                    cursor: pointer;
                    color: #fff;
                    font-weight: 700;
                    text-align: left;
                    padding-bottom: 5px;
                    /*border-bottom: 1px solid #ef5350;*/
                    border-left: 3px solid #eee;
                    padding-left: 10px;
                    transition: all .25s;
                    display: inline-block;
                    width: calc(100% - 40px);
                    &:hover { color: #EF5350; border-color: #EF5350; }
                    & + .opener:hover { color: #EF5350; }
                }
            }

            &.category {
                &.disabled {
                    pointer-events: none;
                    color: #aaa;
                    font-style: italic;
                    & > span.item {
                        & > .opener { display: none; }
                        & > .subcategory, & > subcategory-display-component > .subcategory {
                            color: #aaa;
                            border: none;
                        }
                    }
                }
                &:not(.folded) > span.item > .opener::after {
                    transform: rotate(45deg);
                }
                &.loading > span.item {
                    & > .opener::after {
                        animation: spin 1s infinite;
                    }
                }
            }
        }
    }
}
