// This Sass file wants to be compiled with Bootstrap Sass headers

// Colors
$body-bg: #fff !default;
$body-color: $text-color !default; // BS3 compat
// TODO: combine gray-1 to gray-3 into one var?
$gray-1: mix($body-bg, $body-color, 84.3%) !default; // #d7d7d7
$gray-2: mix($body-bg, $body-color, 88.6%) !default; // #e2e2e2
$gray-3: mix($body-bg, $body-color, 86.7%) !default; // #dddddd
$primary: $brand-primary !default; // BS3 compat

// Fonts
$font-size-base: 14px !default;
$font-size-lg:   $font-size-base * 1.25 !default;
$font-size-sm:   $font-size-base * .875 !default;
$h1-font-size:   $font-size-base * 2.5 !default;
$h4-font-size:   $font-size-base * 1.5 !default;
$font-weight-light: 300 !default;

// Borders
$border-width: 1px !default;
$border-color: mix($body-bg, $body-color, 84.3%) !default;
$border-radius: .25rem !default;

// Sidebar
$sidebar-bg: rgba($primary, 0.1) !default;

// Custom nav
$custom-nav-active-color: if(type-of($headings-color) == color, $headings-color, mix($body-bg, $body-color, 20%)) !default;
$custom-nav-color: rgba($custom-nav-active-color, 0.6) !default;

// Mixin shims (for BS3 compat)
@mixin border-radius-shim($radius) {
  @if mixin-exists("border-radius") {
    @include border-radius($radius);
  } @else {
    border-radius: $radius;
  }
}
@mixin font-size-shim($size) {
  @if mixin-exists("font-size") {
    @include font-size($size);
  } @else {
    font-size: $size;
  }
}


/*
 Dashboard CSS derives from Keen IO Dashboards
 (https://github.com/keen/dashboards)
*/

body {
  background: mix($body-bg, $body-color, 95%); // #f2f2f2
  padding: 60px 0 0 8px; /* padding-top overridden by output template */
}

body hr {
  border-color: $gray-1;
  margin: 10px 0;
}

.navbar-inverse .navbar-nav > li > a,
.navbar .navbar-brand {
  text-decoration: none;
}

.navbar-logo {
  margin-top: 1px;
}

.navbar-logo img {
  margin-right: 12px;
}

.navbar-author {
  margin-left: 10px;
  @include font-size-shim($font-size-base * 1.1);
}

.navbar .dropdown-menu .fa {
  min-width: 20px;
}

.navbar .dropdown-menu {
  min-width: 150px;
  max-height: 500px;
  overflow: auto;
}

.chart-wrapper,
.nav-tabs-custom,
.sbframe-commentary
{
  background: $body-bg;
  border: $border-width solid $border-color;
  @include border-radius-shim($border-radius);
  margin-bottom: 8px;
  margin-right: 8px;
}

.chart-title {
  border-bottom: $border-width solid $border-color;
  @include font-size-shim($font-size-base);
  font-weight: $font-weight-light;
  padding: 7px 10px 4px;
  color: $headings-color;
  font-family: $headings-font-family;
}

.chart-wrapper .chart-title:empty {
  display: none;
}

.chart-wrapper .chart-stage {
  overflow: hidden;
  padding: 5px 10px;
  position: relative;
}

.chart-wrapper .chart-notes {
  background: mix($body-bg, $body-color, 98.5%);
  border-top: $border-width solid $border-color;
  color: mix($body-bg, $body-color, 50%);
  @include font-size-shim($font-size-sm);
  padding: 8px 10px 5px;
}

/*
 CSS for handling flexbox layout
*/

#dashboard-container {
  visibility: hidden;
}

.tab-content>.dashboard-page-wrapper.active {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}

.dashboard-page-wrapper {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
      -ms-flex-direction: column;
          flex-direction: column;
}

.dashboard-row-orientation {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
      -ms-flex-direction: column;
          flex-direction: column;
}

.dashboard-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
      -ms-flex-direction: row;
          flex-direction: row;
}

.dashboard-row-flex {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
      -ms-flex: 1;
          flex: 1;
}

.dashboard-column-orientation {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
      -ms-flex-direction: row;
          flex-direction: row;
}

.dashboard-column {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
      -ms-flex: 1;
          flex: 1;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
      -ms-flex-direction: column;
          flex-direction: column;
}

.chart-wrapper-flex {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
      -ms-flex: 1;
          flex: 1;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
      -ms-flex-direction: column;
          flex-direction: column;
}

.chart-stage-flex {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
      -ms-flex: 1;
          flex: 1;
  position: relative;
}

.chart-shim {
  position: absolute;
  left: 8px; top: 8px; right: 8px; bottom: 8px;
}

.no-padding .chart-shim {
  left: 0; top: 0; right: 0; bottom: 0;
}

.flowing-content-shim {
  overflow: auto;
  left: 0; top: 0; right: 0; bottom: 0;
  padding-left: 8px;
  padding-right: 8px;
}

.flowing-content-container {
  padding-top: 8px;
  padding-bottom: 8px;
}

.chart-stage .table-bordered {
  border: none;
}

.chart-stage .table-bordered > tbody > tr > th,
.chart-stage .table-bordered > tfoot > tr > th,
.chart-stage .table-bordered > tbody > tr > td,
.chart-stage .table-bordered > tfoot > tr > td {
  border: none;
}

.chart-stage .table-bordered > tbody > tr > td {
  border-top: $border-width solid $border-color;
}

.chart-stage .table-bordered > thead > tr > th {
  border: none;
  border-bottom: ($border-width*2) solid $border-color;
}

.bootstrap-table table>thead {
  background-color: $body-bg;
}

.bootstrap-table table.data,
.bootstrap-table table.shiny-table {
  width: inherit !important;
}

.bootstrap-table table.data>tbody>tr>th,
.bootstrap-table table.shiny-table>tbody>tr>th {
  border-top: none;
  border-bottom: ($border-width*2) solid $border-color;
  padding: 5px;
}

.bootstrap-table .data td[align=right] {
  font-family: inherit;
}

.chart-wrapper form {
  padding-left: 5px;
  padding-right: 5px;
}

.shiny-input-container label {
  font-weight: normal;
}

.chart-stage .html-widget {
  width: 100% !important;
  height: 100% !important;
}

.chart-stage .html-widget-static-bound {
  width: 100% !important;
  height: 100% !important;
}

.chart-stage .shiny-bound-output {
  width: 100% !important;
  height: 100% !important;
}

/* Omit display of empty paragraphs */

.chart-shim>p:empty {
  display: none;
}

.chart-stage>p:empty {
  display: none;
}

/* Omit display of special knitr options div*/

.chart-stage .knitr-options {
  display: none;
}

/* Automatically resizing images */

.image-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
}

.image-container img {
  opacity: 0;
  overflow: hidden;
}

/* STORYBOARD */

.storyboard-nav .sbnext,
.storyboard-nav .sbprev {
  @include font-size-shim($font-size-base * 3.5);
  color: $body-color;
}

.storyboard-nav .sbframelist ul li {
  background: $body-bg;
  border: $border-width solid $border-color;
  @include border-radius-shim($border-radius);
  color: mix($body-bg, $body-color, 25%); // #3a3c47
  @include font-size-shim($font-size-base);
}

.storyboard-nav .sbframelist ul li.active {
  color: $body-bg;
  background-color: rgba($primary, 0.7);
}

.sbframe-commentary {
  background: mix($body-bg, $body-color, 98.4%); // #fbfbfb
  @include font-size-shim($font-size-base);
}

/* NAV TABS */

.nav-tabs-custom > .nav-tabs {
  margin: 0;
  border-bottom: $border-width solid $border-color;
  color: $custom-nav-color;
  @include font-size-shim($font-size-base);
  font-weight: $font-weight-light;
  font-family: $headings-font-family;
  border-top-right-radius: 3px;
  border-top-left-radius: 3px;
}
.nav-tabs-custom > .nav-tabs > li {
  border-top: ($border-width*3) solid transparent;
  margin-bottom: -1px;
  margin-right: 5px;
}
.nav-tabs-custom > .nav-tabs > li > a,
.nav-tabs-custom > .nav-tabs > li > a:active {
  color: $custom-nav-active-color;
  font-weight: $font-weight-light;
  @include font-size-shim($font-size-base);
  border-radius: 0;
  padding: 3px 10px 5px;
  text-transform: none;
}

.nav-tabs-custom > .nav-tabs > li:not(.active) > a {
  border-bottom-color: transparent;
}

.nav-tabs-custom > .nav-tabs > li > a.text-muted {
  color: $custom-nav-color;
}
.nav-tabs-custom > .nav-tabs > li > a,
.nav-tabs-custom > .nav-tabs > li > a:hover {
  background: transparent;
  margin: 0;
}
.nav-tabs-custom > .nav-tabs > li > a:hover {
  color: $custom-nav-color;
}
.nav-tabs-custom > .nav-tabs > li:not(.active) > a:hover,
.nav-tabs-custom > .nav-tabs > li:not(.active) > a:focus,
.nav-tabs-custom > .nav-tabs > li:not(.active) > a:active {
  border-color: transparent;
}
.nav-tabs-custom > .nav-tabs > li.active {
  border-top-color: $primary;
}
.nav-tabs-custom > .nav-tabs > li.active > a,
.nav-tabs-custom > .nav-tabs > li.active:hover > a {
  background-color: $body-bg;
  color: $custom-nav-active-color;
}
.nav-tabs-custom > .nav-tabs > li.active > a {
  border-top-color: transparent;
  border-left-color: $gray-1;
  border-right-color: $gray-1;
}
.nav-tabs-custom > .nav-tabs > li:first-of-type {
  margin-left: 0;
}
.nav-tabs-custom > .nav-tabs > li:first-of-type.active > a {
  border-left-color: transparent;
}
.nav-tabs-custom > .nav-tabs.pull-right {
  float: none !important;
}
.nav-tabs-custom > .nav-tabs.pull-right > li {
  float: right;
}
.nav-tabs-custom > .nav-tabs.pull-right > li:first-of-type {
  margin-right: 0;
}
.nav-tabs-custom > .nav-tabs.pull-right > li:first-of-type > a {
  border-left-width: 1px;
}
.nav-tabs-custom > .nav-tabs.pull-right > li:first-of-type.active > a {
  border-left-color: $gray-1;
  border-right-color: transparent;
}
.nav-tabs-custom > .nav-tabs > li.header {
  line-height: 35px;
  padding: 0 10px;
  @include font-size-shim($h4-font-size);
  color: $custom-nav-active-color;
}
.nav-tabs-custom > .nav-tabs > li.header > .fa,
.nav-tabs-custom > .nav-tabs > li.header > .glyphicon,
.nav-tabs-custom > .nav-tabs > li.header > .ion {
  margin-right: 5px;
}
.nav-tabs-custom > .tab-content {
  background: $body-bg;
  padding: 0;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}

.nav-tabs-custom > .tab-content > .chart-wrapper {
  background: $body-bg;
  border: none;
  margin: 0;
}


.nav-tabs-custom > .tab-content > .active {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}

.nav-tabs-custom .dropdown.open > a:active,
.nav-tabs-custom .dropdown.open > a:focus {
  background: transparent;
  color: $custom-nav-active-color;
}


@media (max-width: 767px) {
  .value-box {
    text-align: center;
    margin-right: 8px;
  }
  .value-box .icon {
    display: none;
  }
}

/* Fixed position sidebar */

.section.sidebar {
  position: fixed;
  top: 51px; /* overridden by output template */
  left: 0;
  bottom: 0;
  border-right: $border-width solid $border-color;
  background-color: $sidebar-bg;
  padding-top: 10px;
  padding-left: 10px;
  padding-right: 10px;
  visibility: hidden;
  overflow: auto;
}

.section.sidebar form p:first-child {
  margin-top: 10px;
}

/* Embedded source code */

#flexdashboard-source-code {
  display: none;
}

.featherlight-content #flexdashboard-source-code {
  display: inline-block;
}

.featherlight-content {
  width: 80%;
  max-width: 800px;
  padding: 0 !important;
  border-bottom: none !important;
}

.featherlight:last-of-type {
  background: rgba($body-color, 0.7);
}

.featherlight-inner {
  width: 100%;
}

.featherlight-content pre {
  margin: 0;
  border: 0;
  background: $body-bg;
  @include font-size-shim($font-size-sm);
}

.unselectable {
  -ms-user-select: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: -moz-none;
  -o-user-select: none;
  user-select: none;
}

#flexdashboard-source-code code {
  -ms-user-select: text;
  -webkit-user-select: text;
  -khtml-user-select: text;
  -moz-user-select: text;
  -o-user-select: text;
  user-select: text;
}

/* DataTables Tweaks */

.dataTables_filter input[type="search"] {
  -webkit-appearance: searchfield;
  outline: none;
}

.dataTables_wrapper.no-footer
.dataTables_info {
  padding-top: 0;
}


table.dataTable thead th {
  border-bottom: $border-width solid $border-color;
}

.dataTables_wrapper.no-footer .dataTables_scrollBody {
  border-bottom: $border-width solid $border-color;
}

/* Mobile phone only CSS */

.desktop-layout div.section.mobile {
  display: none;
}

.mobile-layout div.section.no-mobile {
  display: none;
}

.mobile-figure {
  display: none;
}

