// Include paths are set in Gulpfile.js
@import "bootstrap";
@import "_colorpicker.scss";

//Variables
$dmarc-blue: #006699;
$panel-border-radius: 0;

/*
 * ---------------------------------------------------------------------------------------------------------------------
 * JUST COPIED THIS FROM BOOTSTRAP TEMPLATE
 */

/* Move down content because we have a fixed navbar that is 50px tall */
body {
    padding: 50px 0;
    font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
/*
 * Top navigation
 * Hide default border to remove 1px line.
 */
.navbar-fixed-top {
    border: 0;
}

/*
 * Sidebar
 */

/* Hide for mobile, show later */
.sidebar {
    display: none;
}
@media (min-width: 768px) {
    .sidebar {
        position: fixed;
        top: 51px;
        bottom: 0;
        left: 0;
        z-index: 1000;
        display: block;
        padding: 20px;
        overflow-x: hidden;
        overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
        //background-color: #f5f5f5;
        border-right: 2px solid #eee;
    }
}

/* Sidebar navigation */

.nav-sidebar {
    margin-right: -21px; /* 20px padding + 1px border */
    margin-bottom: 20px;
    margin-left: -20px;

    li {
        &:not(:first-child) {
            border-top: 1px solid #ddd;
        }
        a {
            color: $dmarc-blue;
            padding: 5px 20px;
        }
        &.active > a,
        &.active > a:hover,
        &.active > a:focus {
            color: #fff;
            background-color: $dmarc-blue;
        }
    }
}


.container-margin {
    width: 80%;
    margin: auto;
}

/*
 * ---------------------------------------------------------------------------------------------------------------------
 * Editor
 */
#view-editor {
    @extend .container-margin;

    form label {
        font-weight: normal;
        margin: 5px 0;
    }
    $viewFilterFormFields:
        (title, 12, 12, 12, 12),
        (description, 12, 12, 12, 12),
        (enabled, 3, 3, 3, 3),
        (type_map, 3, 3, 3, 3),
        (type_table, 3, 3, 3, 3),
        (type_line, 3, 3, 3, 3),
        (report_type, 12, 12, 12, 12),
        (dr_type, 12, 12, 12, 12),
        (begin, 6, 6, 3, 3),
        (end, 6, 6, 3, 3),
        (quantity, 6, 6, 3, 3),
        (unit, 6, 6, 3, 3);

    @each $id, $colXs, $colSm, $colMd, $colLg in $viewFilterFormFields {
        #id_#{$id}_container {
            @extend .col-xs-#{$colXs};
            @extend .col-sm-#{$colSm};
            @extend .col-md-#{$colMd};
            @extend .col-lg-#{$colLg};
        }
    }

    $filterSetContainerFields:
        (label, 8),
        (color, 4),
        (report_receiver_domain, 4),
        (source_ip, 4),
        (report_sender, 4),
        (raw_spf_domain, 6),
        (raw_spf_result, 6),
        (raw_dkim_domain, 6),
        (raw_dkim_result, 6),
        (multiple_dkim, 12),
        (aligned_dkim_result, 4),
        (aligned_spf_result, 4),
        (disposition, 4);

    // @each $id, $colXs, $colSm, $colMd, $colLg in $filterSetContainerFields {
    @each $id, $colXs in $filterSetContainerFields {
        .filter_#{$id} {
        @extend .col-xs-#{$colXs};
        // @extend .col-sm-#{$colSm};
        // @extend .col-md-#{$colMd};
        // @extend .col-lg-#{$colLg};
        }
    }


    // Radio Input to Button Group magic :)
    // like a wolf in sheep's clothing
    #id_dr_type {
        @extend .btn-group;
        @extend .btn-group-justified;
        .radio {
            @extend .btn;
            @extend .btn-default;
            padding: 0;
            label {
                line-height: 34px;
                padding: 0;
                width: 100%;
            }
            input {
                display: none;
            }
        }
    }

    .form-group {
        margin-bottom: 10px;
    }

    .filter_multiple_dkim {
        margin: 10px 0;
        .form-group, .checkbox {
            display: inline;
        }
    }

    //Filterset border
    [data-formset-form] {
        border: 1pt solid grey;
        padding: 20px 60px;
        margin: 20px 0;
        @include border-top-radius(3px);
        @include border-bottom-radius(3px);
    }

    .selectize-control .selectize-input [data-value] {
        color: whitesmoke;
        background-color: $dmarc-blue;
        background-image: none;
    }

    .disabled {
        opacity: 0.3;
        label {
            color: black;
        }
        input, select {
            border-color: #ccc;
            background: white;
        }
        .help-block {
            @extend .hidden;
        }
    }
}

/*
 * ---------------------------------------------------------------------------------------------------------------------
 * Deep Analysis
 */

#deep-analysis {
    #view-filter-details {
        position: relative;
        margin-bottom: 60px;
        .panel-heading {
            &:before {
                top: 1px;
                left: 1px;
                @include border-bottom-radius(0);
                @include border-top-radius(0);
                border-bottom-right-radius: 10px;
                border: 0;
                background-color: $dmarc-blue;
                content: "-";
                height: 20px;
                width: 20px;
                display: block;
                color: white;
                text-align: center;
                line-height: 16px;
                box-shadow: 0 0 3px #444;
                box-sizing: content-box;
                position: absolute;
                }
            &.collapsed:before {
                content: '+';
            }
            padding: 10px 25px;
            background-color: transparent;
        }
        .panel-title {
            line-height:inherit;
        }
        a {
            font-size: 12px;
        }
        p {
            margin-bottom: 2px;
            &:not(:first-child) {
                margin-left: 22px;
            }
        }
        .panel-body {
            div:not(:last-child) {
                margin-bottom: 15px;
            }
        }
        .filter-set-name {
            text-decoration: underline;
        }
        .field-name {
            font-weight: bold;
        }
    }
    .view-type {
        margin-bottom: 60px;
        .svg-container {
            border: 1px solid $panel-default-border;
            overflow: hidden;
        }
    }
    .view-type-map {
        .switch-filterset .btn {
            //text-shadow: 0 0 1px grey;
            font-weight: bold;
            border-bottom: 0pt;
            @include border-bottom-radius(0);
        }
    }
    .view-type-linechart {
        .svg-container {
            position: relative;
            #zoom-help {
                text-align: center;
                position:absolute;
                width: 80px;
                bottom: 30px;
            }
            &.loading #zoom-help{
                display: none;
            }
        }

    }
    .view-type-table {
        tr {
            background-color: transparent;
            td {
                vertical-align: middle;
                padding-top: 2px;
                padding-bottom: 2px;
                &:before{
                    top: 1px;
                    left: 1px;
                    @include border-bottom-radius(0);
                    @include border-top-radius(0);
                    border-bottom-right-radius: 10px;
                    border: 0;
                    background-color: $dmarc-blue;
                }
            }
            li {
                //display: inline-block;
                //padding: 0 10px 0 10px;
                //border-bottom: 0;
            }
        }
        .dataTables_wrapper {
            position: relative;
            min-height: 200px;
            .table-quick-filter {
                position: absolute;
                right: 0;
            }
        }
        .dataTables_processing {
            @extend .loading;
            position: absolute;
            background-color: rgba(255,255,255,0.8);
            top: 0;
            left: 0;
            margin: 0 0;
            height: 100%;
        }
        .pagination {
            a {
                color: $dmarc-blue;
            }
            .active a {
                color: #fff;
                background-color: $dmarc-blue;
                border-color: $dmarc-blue;
            }
        }
    }


}
/*
 * ---------------------------------------------------------------------------------------------------------------------
 * View Management
 */

#view-management {
    @extend .container-margin;
    table td {

        &:last-child {
            min-width:270px;
        }
    }
}

/*
 * ---------------------------------------------------------------------------------------------------------------------
 * Overview
 */

#overview {
    @extend .container-margin;
    .charts-container {
        text-align: center;
    }
}
/*
 * ---------------------------------------------------------------------------------------------------------------------
 * Help
 */
#help {
    @extend .container-margin;
}

/*
 * ---------------------------------------------------------------------------------------------------------------------
 * Miscellaneous
 */
h1 {
    color: $dmarc-blue;
}
h2 {
    font-size: 22px;
}
h3 {
    font-size: 16px;
    text-decoration: underline;
}
h4 {
    line-height: inherit;
}
.hidden {
    display: none;
}

.btn-important {
   //@extend .btn-primary;
   float: right;
   margin: 10px 0;
   width: 200px;
   color: $dmarc-blue;
   font-weight: bold;
   border-color: $dmarc-blue;
   background-color: white;
   &:hover, &:active, &:focus{
       background-color: $dmarc-blue;
       color: white;
   }
    //@extend .clearfix;

}

.description {
    @extend .alert;
    @extend .alert-info;
    padding: 10px;
    margin: 0 0 20px;
}

$help-icon-size: 22px;
.context-help-icon {
    border: 1px solid #c7254e;
    color: #c7254e;
    background-color: white;
    height: $help-icon-size;
    line-height: $help-icon-size;
    width: $help-icon-size;
    display: inline-block;
    text-align: center;
    font-size: $help-icon-size * 3/4;
    font-weight: 500;
    vertical-align: top;
    margin: 0 $help-icon-size/2;
    @include border-bottom-radius($help-icon-size/2);
    @include border-top-radius($help-icon-size/2);
    &:hover {
        color: white;
        background-color: #c7254e;
    }
    &:before {
        content: '?';
    }
}
.tooltip {
    font-size: $help-icon-size * 3/4;;
    position: fixed;
}

code {
    width: 100%;
    display: inline;
}

.right {
    float:right;
}

.brand {
    color: white;
    padding: 15px 15px;
    font-size: 22px;
    line-height: 20px;
    height: 50px;
}

// .anchor {
//     padding-top: 50px;
//     margin-top: -30px;
//     }

.circle {
    display: inline-block;
    margin-right: 10px;
    width: 12px;
    height: 12px;
    @include border-bottom-radius(6px);
    @include border-top-radius(6px);
}
/*
 * ---------------------------------------------------------------------------------------------------------------------
 * Loading wheel
 */

@mixin animation($time) {
    animation:          spinner $time infinite linear;
    -o-animation:       spinner $time infinite linear;
    -ms-animation:      spinner $time infinite linear;
    -webkit-animation:  spinner $time infinite linear;
    -moz-animation:     spinner $time infinite linear;
}

@mixin keyframes($name) {
  @-webkit-keyframes #{$name} { @content; }
  @-moz-keyframes #{$name} { @content; }
  @-ms-keyframes #{$name} { @content; }
  @keyframes #{$name} { @content; }
}

.selectize-loading .selectize-input {
    color: $dmarc-blue;
    &:after {
        text-align: right;
        content: 'loading...';
    }
}


.loading {
    width: 100%;
    padding: 20px 0;
    text-align: center;
    color: $dmarc-blue;
    &:before {
        content: " ";
        width: 50px;
        height: 50px;
        margin: 0 auto;
        border: 9px double;
        border-color: transparent $dmarc-blue $dmarc-blue;
        display: table;
        @include border-bottom-radius(50%);
        @include border-top-radius(50%);
        @include animation(1200ms)
    }
    &:after {
        width: 50px;
        height: 50px;
        content: "loading..."
    }
}

@include keyframes(spinner) {
    100% { transform: rotate(360deg); transform: rotate(360deg); }
}

