@import '~bootstrap/scss/functions';
@import '~bootstrap/scss/variables';
@import '~bootstrap/scss/mixins';
@import '../styles/variables';
@import '../styles/mixins';
@import '../styles/utils';

body {
    &.iframe-mode {
        .content-wrapper {
            margin: 0 !important;
        }
    }

    @include customScrollBar();
}

// Add button follow the accent
// -----------------------------------------------
@each $color, $value in $accent-colors {
    .btn-#{$color} {
        @include button-variant($value, $value);
    }
}

@each $color, $value in $accent-colors {
    .btn-outline-#{$color} {
        @include button-outline-variant($value);
    }
}

// .content class
// -----------------------------------------------
.content-wrapper > .content {
    border-bottom: 1px solid transparent;
}

// .strong class
// -----------------------------------------------
.strong {
    font-weight: 600;
}

// .custom-scrollbar class
// -----------------------------------------------
.custom-scrollbar {
    @include customScrollBar();
}

// Fix cursor for .close and a tag
// -----------------------------------------------
a,
.close {
    cursor: pointer;
}

.close {
    text-decoration: none !important;
}

// Fix size when adding .text-sm
// -----------------------------------------------
.text-sm {
    .btn.btn-xs {
        font-size: .75rem !important;
    }

    &.brand-link,
    & .brand-link {
        .brand-image {
            margin-left: .8rem;
        }
    }

    .sidebar-collapse .nav-flat .nav-icon {
        margin-left: 0.6rem;
    }

    // Fix height of main content
    .wrapper .content-wrapper {
        min-height: calc(100vh - calc(3.5rem) - calc(2.5rem));
    }

    // Make .nav-icon center vertical in .nav-item and bigger
    .nav-sidebar > .nav-item {
        .nav-link {
            color: #c2c7d0;
        }

        > .nav-link {
            padding-top: .6rem;
            padding-bottom: .6rem;
        }

        .nav-icon {
            transform: translateY(2px);
            font-size: 1rem !important;
        }

        .nav-icon ~ .fas {
            margin-top: 2px;
        }
    }

    // Correct line-height of .btn in .input-group
    .input-group:not(.input-group-lg) {
        .btn {
            line-height: 24px;
        }
    }
}

// Table
// -----------------------------------------------
.table-responsive {
    .table {
        margin-bottom: 0;
    }
}

// Make textarea resizable vertically only
// -----------------------------------------------
textarea.form-control {
    resize: vertical;
}

// Error state for CKEditor
// -----------------------------------------------
.form-group.has-error .cke_chrome {
    border-color: #dc3545;
}

// ICheck
// -----------------------------------------------
[class*=icheck-] > input.is-invalid:first-child + input[type=hidden] + label::before,
[class*=icheck-] > input.is-invalid:first-child + label::before {
    border-color: #dc3545 !important;
}

.icheck-wrapper {
    width: 22px;
    overflow: hidden;
}

// Dropzone
// -----------------------------------------------
.dropzone {
    border: 3px dashed #ddd !important;
    border-radius: 5px !important;

    .dz-message {
        font-size: 24px;
        color: #bbb;
    }
}

// SweetAlert2
// -----------------------------------------------
.swal2-header {
    border: 0;
    padding: 0;
}

// Ekko Lightbox
// -----------------------------------------------
.ekko-lightbox {
    .modal-title {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
    }
}

// Model drop image
// -----------------------------------------------
.modal-crop-image {
    .modal-dialog {
        @include screen-sm {
            max-width: calc(100% - 2.4rem);
        }
    }

    .image-container {
        img {
            max-height: calc(100vh - 28px - 28px - 69px - 69px - 16px - 16px - 2px);
        }
    }

    .modal-footer {
        .input-group {
            width: 200px;
        }
    }
}

// Image
// -----------------------------------------------
.image {
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 15px;

    &:before {
        content: '';
        display: block;
        padding-top: 100%;
    }

    .image-bg {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1;
        background: #f5f5f5 no-repeat 50% 50% / contain;
    }

    .image-overlay {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1;
        background-color: rgba(0, 0, 0, .7);
        display: none;

        .image-overlay-inner {
            width: 100%;
            position: absolute;
            left: 0;
            top: 50%;
            transform: translate(0, -50%);

            .btn:not(:last-child) {
                margin-right: 5px;
            }
        }
    }

    &:hover {
        .image-overlay {
            display: block;
        }
    }
}

// Loading
// -----------------------------------------------
.loading {
    position: relative;
    background: #fff !important;
    overflow: hidden;
    padding: 30px;
    height: 120px;

    &:before {
        position: absolute;
        content: '';
        top: 50%;
        left: 50%;
        width: 60px;
        height: 60px;
        margin: -30px 0 0 -30px;
        background: no-repeat 50% 50%;
        background-size: 50px 50px;
        animation: rotate 1.6s infinite linear;
        z-index: 999;
    }
}

@keyframes rotate {
    0% {
        transform: rotate(0);
    }

    100% {
        transform: rotate(360deg);
    }
}

// Error page
// -----------------------------------------------
.page-error .content-header {
    display: none;
}
