@import 'variables';
@import 'functions';


.data-center {
    margin-left: $rack-info-width + 10px;
    .grid {
        float: left;
        background: #555;
        @include generate-cols($grid-count);
        @include generate-rows($grid-count);
        &.edit {
            .grid_wrapper {
                background-color: rgba(255, 255, 255, 0.1);
                .progress, .free, .display, .used {
                    display: none;
                }
                .rack {
                    &.new {
                        border-color: #ff3;
                        background-color: #997;
                    }
                    &.saved {
                        border-color: #444;
                        background-color: $rack-background;
                    }
                    &.move {
                        border-style: dashed;
                        &.not_allowed{background-color: red;}
                        &.allowed{background-color: #2a3;}
                        .wrapper .tools {display: none !important;} // always hide if rack in the move
                    }
                    .wrapper {
                        cursor: initial;
                        &:hover {
                            .tools {display: block;}
                        }
                        .tools{
                            display: none;
                            text-align: center;
                            line-height: 2rem;
                            i {
                                font-size: 1.20rem;
                                cursor: pointer;
                                &:hover {
                                    color: $primary-color;
                                }
                            }
                        }
                        .name {
                            cursor: move;
                        }
                    }
                }
            }
        }
        .grid_wrapper {
            position: relative;
            min-height: $grid-size * $grid-count;
            background-color: transparent;
            background-image:
                linear-gradient(
                    0deg,
                    $grid-color 0%,
                    $grid-color 1%,
                    transparent 2%,
                    transparent
                ),
                linear-gradient(
                    90deg,
                    $grid-color 0%,
                    $grid-color 1%,
                    transparent 2%,
                    transparent
                );
            background-size: $grid-size $grid-size;
            .rack {
                &.add {
                    text-align: center;
                    font-size: 40px;
                    line-height: 40px;
                    border: 0;
                    color: #3f3;
                    background: transparent;
                    cursor: pointer;
                    &:hover {
                        border: 0;
                        background: rgba(255, 255, 255, .2);
                    }
                }
                $label-height: 1.4em;
                @include generate-x-position($grid-count);
                @include generate-y-position($grid-count);
                &.rotate-left {transform: rotate(-90deg);}
                &.rotate-right {
                    transform: rotate(90deg);
                    .used, .name {
                        transform: rotate(180deg);
                    }
                    .wrapper .progress.red {
                        left: 0;
                    }
                }
                &.rotate-top, &.rotate-left {
                    .wrapper .progress {
                        top: $label-height;
                    }
                }
                &.rotate-bottom{
                    .used {
                        top: 0;
                    }
                    .name {
                        position: absolute;
                        bottom: 0;
                        min-width: 100%;
                    }
                    .wrapper .progress {
                        bottom: $label-height;
                    }
                    .tools {
                        transform: rotate(180deg);
                    }
                }
                @include generate-x-position($grid-count);
                @include generate-y-position($grid-count);
                box-sizing: border-box;
                position: absolute;
                background: $rack-background;
                width: $grid-size;
                height: $grid-size;
                border: 1px solid #444;
                &:hover {
                    background: lighten($rack-background, 20%);
                }
                .wrapper {
                    height: 100%;
                    min-height: 100%;
                    position: relative;
                    cursor: zoom-in;
                    display: block;
                    &:hover {
                        text-decoration: none;
                    }
                    .barcode, .sn {
                        text-overflow: ellipsis;
                        white-space: nowrap;
                        overflow: hidden;
                    }
                    .name {
                        height: $label-height;
                        line-height: $label-height;
                        overflow: hidden;
                        white-space: nowrap;
                        background: rgba(0, 0, 0, 0.8);
                        text-align: center;
                        color: #eee;
                        width: 100%;
                    }
                    .used {
                        position: absolute;
                        bottom: 0;
                        min-width: 100%;
                        color: #000;
                        text-align: center;
                        color:#fff;
                        min-width: 100%;
                        font-size: .825em;
                    }
                    .progress, .free, .display {
                        position: absolute;
                    }
                    .progress {
                        border:0;
                        margin:0;
                        padding:0;
                        border-radius: 0;
                        height: 5px;
                        &.red {background: #c22;z-index:2;right:0;box-sizing:border-box;}
                        &.green {background: #0E4;width:100%;z-index:1;}
                    }
                    .free {
                        text-align: center;
                        width: 100%;
                        top:10px;
                    }
                }
                &:hover, &.active {
                    @include active-border();
                }
            }
        }
    }
}
