//@import "bootstrap/bootstrap.less";
@import "bootstrap/buttons.less";
@import "bootstrap/variables.less";
@import "bootstrap/mixins.less";
@import "variables.less";

// Body
body {
  //padding-top: 60px;
}

// Navigation bar
.navbar-inner-text (@base) {
  text-shadow: 0 1px 0 contrast(@base, lighten(@base, 15%), darken(@base, 15%));
  color: @text-color;
  @caret-color: average(@base, @text-color);
  @caret-hover-color: average(@caret-color, @text-color);

  .caret {
    border-bottom-color: @caret-color;
    border-top-color: @caret-color;
  }

  &:hover .caret, &:focus .caret {
    border-bottom-color: @caret-hover-color;
    border-top-color: @caret-hover-color;
  }
}

.brand (@color, @dark, @light) when (@color = @dark) {
  span {
    background-image: url(../img/tentacle-20x20.png);

    @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
      background-image: url(../img/tentacle-20x20@2x.png);
    }
  }
}
.brand (@color, @dark, @light) when (@color = @light) {
  span {
    background-image: url(../img/tentacle-20x20-light.png);

    @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
      background-image: url(../img/tentacle-20x20-light@2x.png);
    }
  }
}

.nowrap {
  white-space: nowrap;
}

.actioncol {
  text-align: center;
  .nowrap;

  a {
    text-decoration: none;
    color: #000;

    &.disabled {
      color: #ccc;
      cursor: default;
    }
  }
}

.navbar-inner-color (@base) {
  @top: lighten(@base, 25%);
  @bottom: darken(@base, 15%);

  @text-color-light: #f2f2f2;
  @text-color-dark: #333333;
  @text-color: contrast(@base, @text-color-dark, @text-color-light);

  #gradient > .vertical(@top, @bottom);

  .brand, .nav>li>a {
    .navbar-inner-text(@base);
  }

  .brand {
    .brand(@text-color, @text-color-dark, @text-color-light);
  }

  .nav {
    li.dropdown.open>.dropdown-toggle, li.dropdown.active>.dropdown-toggle, li.dropdown.open.active>.dropdown-toggle {
      // invert for dropdown
      #gradient > .vertical(@bottom, @top);
    }
  }
}

#navbar .navbar-inner {
  @base: #F2F2F2;
  .navbar-inner-color(@base);

  &.red {
    @base: #F22828;
    .navbar-inner-color(@base);
  }
  &.orange {
    @base: #F27728;
    .navbar-inner-color(@base);
  }
  &.yellow {
    @base: #F2DE28;
    .navbar-inner-color(@base);
  }
  &.green {
    @base: #77FF28;
    .navbar-inner-color(@base);
  }
  &.blue {
    @base: #2877FF;
    .navbar-inner-color(@base);
  }
  &.violet {
    @base: #7728FF;
    .navbar-inner-color(@base);
  }
  &.black {
    @base: #383838;
    .navbar-inner-color(@base);
  }
  &.white {
    @base: #ffffff;
    .navbar-inner-color(@base);
  }
  &.transparent {
    @base: #ffffff;
    .navbar-inner-color(@base);
    background-image: url("../img/trans-background.png");
    background-repeat: repeat;
  }

  .brand span {
    background-size: 20px 20px;
    background-position: left center;
    padding-left: 24px;
    background-repeat: no-repeat;
  }
}

.octoprint-container {
  margin-top: 20px;

  /** OctoPrint application tabs */

  .tab-content {
    padding: 9px 15px;
    border-left: 1px solid #DDD;
    border-right: 1px solid #DDD;
    border-bottom: 1px solid #DDD;

    @radius: 4px;
    .border-bottom-right-radius(@radius);
    .border-bottom-left-radius(@radius);
  }

  .nav {
    margin-bottom: 0px;
  }

  .tab-content h1 {
    display: block;
    width: 100%;
    padding: 0;
    margin-bottom: 20px;
    font-size: 21px;
    line-height: 40px;
    color: #333;
    border: 0;
    border-bottom: 1px solid #E5E5E5;
    font-weight: normal;
  }

  /** Accordions */

  .accordion-heading {
    .accordion-heading-button {
      float: right;

      a {
        display: inline-block;
        padding: 8px 15px;
        font-size: 14px;
        line-height: 20px;
        color: #000;
        text-decoration: none;
        background: none;

        -webkit-box-shadow: none;
        -moz-box-shadow: none;
        box-shadow: none;
      }
    }

    a.accordion-toggle {
      display: inline-block;
    }

    [class^="icon-"],
    [class*=" icon-"] {
      color: #000;
    }
  }
}

.print-control .btn {
  padding-left: 4px;
  padding-right: 4px;
}

.upload-buttons .btn {
  margin-right: 0;
}

/** Tables */

table {
  table-layout: fixed;

  .popover-title {
    text-overflow: ellipsis;
    word-break: break-all;
  }

  th, td {
    overflow: hidden;

    // gcode files
    &.gcode_files_name {
      text-overflow: ellipsis;
      text-align: left;
      .nowrap;
    }

    &.gcode_files_action {
      width: 90px;
      .actioncol;
    }

    // timelapse files
    &.timelapse_files_name {
      text-overflow: ellipsis;
      text-align: left;
    }

    &.timelapse_files_size {
      text-align: right;
      width: 55px;
    }

    &.timelapse_files_action {
      width: 45px;
      .actioncol;
    }

    // user settings
    &.settings_users_name {
      text-overflow: ellipsis;
      text-align: left;
    }

    &.settings_users_active, &.settings_users_admin {
      text-align: center;
      width: 55px;
    }

    &.settings_users_actions {
      width: 60px;
      .actioncol;
    }

    // log files
    &.settings_logs_name {
      text-overflow: ellipsis;
      text-align: left;
    }

    &.settings_logs_size {
      text-align: right;
      width: 70px;
    }

    &.settings_logs_date {
      text-align: left;
      width: 130px;
    }

    &.settings_logs_action {
      width: 70px;
      .actioncol;
    }

    // Printer profiles
    &.settings_printerProfiles_profiles_name {
      text-overflow: ellipsis;
      text-align: left;
    }

    &.settings_printerProfiles_profiles_model {
      text-align: left;
      width: 250px;
    }

    &.settings_printerProfiles_profiles_action {
      width: 80px;
      .actioncol;
    }

  }
}


/** Temperature tab */

#temperature-graph {
  height: 350px;
  width: 100%;
  background-image: url("../img/graph-background.png");
  background-position: center;
  background-repeat: no-repeat;
}

.tab-content, .tab-pane {
  overflow: visible;
}

.tempInput {
  width: 50px;
}

#temp_newTemp, #temp_newBedTemp, #speed_innerWall, #speed_outerWall, #speed_fill, #speed_support,
#webcam_timelapse_interval, #webcam_timelapse_postRoll, #webcam_timelapse_fps {
  text-align: right;
}

ul.dropdown-menu li a {
  cursor: pointer;
}

/** Connection settings */

#connection_ports, #connection_baudrates, #connection_printers {
  width: 100%;
}

/** Offline overlay */

#offline_overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
}

#offline_overlay_background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000000;
  filter:alpha(opacity=50);
  -moz-opacity:0.5;
  -khtml-opacity: 0.5;
  opacity: 0.5;
}

#offline_overlay_wrapper {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  padding-top: 60px;

  .container {
    margin: auto;
  }
}

/** Webcam */

#webcam_container {
  width: 100%;
  position: relative;
  outline: none;

  //min-height: 440px;

  .flipH {
    -webkit-transform: scaleX(-1);
    -moz-transform: scaleX(-1);
  }

  .flipV {
    -webkit-transform: scaleY(-1);
    -moz-transform: scaleY(-1);
  }

  .flipH.flipV {
    -webkit-transform: scaleX(-1) scaleY(-1);
    -moz-transform: scaleX(-1) scaleY(-1);
  }

  .keycontrol_overlay {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: rgba(0, 0, 0, 0.5);
    font-size: 85%;
    color: white;
    padding: 0;

    kbd {
      border: 1px solid #eeeeee;
      border-radius: 3px;
      margin-left: 2px;
      margin-right: 2px;
      font-size: 90%;
      padding: 2px;
      min-width: 1em;
    }

    .keycontrol_overlay_heading {
      position: relative;
      padding: 10px;
      font-weight: bold;
    }

    .keycontrol_overlay_column {
      position: relative;
      width: 45%;
      padding: 10px;
      float: left;
    }
  }
}

/** GCODE file manager */

#files {
  .gcode_files {
    @padding: 5px;
    @scrollBar: 5px;
    @line-height: 20px;

    padding-right: @scrollBar + 2px;

    .entry {
      padding: @padding;
      line-height: @line-height;
      border-bottom: 1px solid #ddd;
      position: relative;

      &:hover {
        background-color: #f5f5f5;
      }

      .title {
        text-overflow: ellipsis;
        word-break: break-all;
      }

      .uploaded, .size, .additionalInfo {
        font-size: 85%;
        color: #999;
      }

      .action-buttons {
        position: absolute;
        bottom: @padding;
        right: @padding;
      }

      .additionalInfo {
        padding-bottom: @line-height + 2px;
      }
    }
  }

  .upload-buttons {
    margin-top: 10px;
  }

  .form-search {
    text-align: center;
    margin-bottom: 5px !important;
  }
}

/** Control tab */

#control {
  overflow: hidden;

  .jog-panel {
    float: left;
    margin-right: 19px;
  }

  h1 {
    text-align: left;
  }

  .jog-panel {
    >div {
      text-align: center;
    }

    >div.distance {
      text-align: left;
    }

    .slider {
      margin-bottom: 10px;
    }
  }

  .box {
    width: 30px;
    height: 30px;
    margin-right: 10px;
    margin-bottom: 10px;
    padding-left: 8px;
  }

  .control-box {
    display: block;
    height: 30px;
    margin-bottom: 10px;
  }

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

  .btn-group.distance > .btn {
    width: 43px;
    padding: 3px 0;
    height: 30px;
  }

  .slider-handle {
    width: 14px;
    height: 14px;
    margin-left: -7px;
    margin-top: -3px;
  }

  .custom_parametric_command {
    .slider {
      margin-left: 10px;
      margin-right: 10px;
      margin-bottom: 2px;
    }
  }
}

/** GCODE viewer */

#gcode {
  .progress {
    width: 582px;

    .bar {
      .transition(width 0s linear);
    }
  }

  #gcode_layer_slider {
    height: 568px;
    float: right;

    .slider-handle {
      width: 14px;
      height: 14px;
      margin-left: -3px;
      margin-top: -7px;
    }
  }

  #gcode_command_slider {
    .slider-handle {
      width: 14px;
      height: 14px;
      margin-left: -7px;
      margin-top: -3px;
    }
  }
}

/** Terminal output */

#term {
  .terminal {
    #terminal-output {
      min-height: 340px;
      margin-bottom: 5px;
    }

    margin-bottom: 30px;
  }

  #terminal-sendpanel {
    text-align: right;
  }
}

/** Settings dialog */
#settings_dialog {
}

/** Footer */
.footer {
  ul {
    margin: 0;

    li {
      &:first-child {
        margin-left: 0;
      }

      display: inline;
      margin-left: 1em;
      font-size: 85%;
      a {
        color: #555;
      }
    }

  }
}

/** Notifications */

.ui-pnotify .alert a {
  color: #c09853;
}
.ui-pnotify .alert-error a,
.ui-pnotify .alert-danger a {
  color: #b94a48;
}
.ui-pnotify .alert-success a {
  color: #468847;
}
.ui-pnotify .alert-info a {
  color: #3a87ad;
}

.pnotify_additional_info {
  .pnotify_more {
    font-size: 85%;
  }
}

/** General helper classes */

.text-right {
  text-align: right;
}

.overflow_visible {
  overflow: visible !important;
}

.hidden {
  display: none;
}


#drop_overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;

  &.in {
    display: block;
  }

  #drop_overlay_background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    filter:alpha(opacity=50);
    -moz-opacity:0.5;
    -khtml-opacity: 0.5;
    opacity: 0.5;
  }

  #drop_overlay_wrapper {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    padding-top: 60px;

    @dropzone_width: 400px;
    @dropzone_height: 400px;
    @dropzone_distance: 50px;
    @dropzone_border: 2px;

    #drop, #drop_background {
      position: absolute;
      top: 50%;
      left: 50%;
      margin-left: -1 * @dropzone_width / 2;
      margin-top: -1 * @dropzone_height / 2;
    }

    #drop_locally, #drop_locally_background {
      position: absolute;
      top: 50%;
      left: 50%;
      margin-left: -1 * @dropzone_width - @dropzone_distance / 2;
      margin-top: -1 * @dropzone_height / 2;
    }

    #drop_sd, #drop_sd_background {
      position: absolute;
      top: 50%;
      left: 50%;
      margin-left: @dropzone_distance / 2;
      margin-top: -1 * @dropzone_height / 2;
    }

    .dropzone {
      width: @dropzone_width + 2 * @dropzone_border;
      height: @dropzone_height + 2 * @dropzone_border;
      z-index: 10001;

      color: #ffffff;
      font-size: 30px;

      i {
        font-size: 50px;
      }

      .centered {
        display: table-cell;
        text-align: center;
        vertical-align: middle;
        width: @dropzone_width;
        height: @dropzone_height;
        line-height: 40px;

        filter:alpha(opacity=100);
        -moz-opacity:1.0;
        -khtml-opacity: 1.0;
        opacity: 1.0;
      }
    }

    .dropzone_background {
      width: @dropzone_width;
      height: @dropzone_height;
      border: 2px dashed #eeeeee;
      -webkit-border-radius: 10px;
      -moz-border-radius: 10px;
      border-radius: 10px;

      background-color: #000000;
      filter:alpha(opacity=25);
      -moz-opacity:0.25;
      -khtml-opacity: 0.25;
      opacity: 0.25;

      &.hover {
        background-color: #000000;
        filter:alpha(opacity=50);
        -moz-opacity:0.5;
        -khtml-opacity: 0.5;
        opacity: 0.5;

      }

      &.fade {
        -webkit-transition: all 0.3s ease-out;
        -moz-transition: all 0.3s ease-out;
        -ms-transition: all 0.3s ease-out;
        -o-transition: all 0.3s ease-out;
        transition: all 0.3s ease-out;
        opacity: 1;
      }
    }
  }
}

.icon-sd-black-14 {
  background: url("../img/icon-sd-black-14.png") 0 3px no-repeat;
  width: 11px;
  height: 17px;
  display: inline-block !important;
}

.center {
  float: none;
  margin-left: auto;
  margin-right: auto;
}

/** Styles for Bootstrap Slider */

.slider {
  .slider-selection {
    .buttonBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight);
  }

  &.slider-disabled .slider-selection {
    background-image: none;
    .opacity(65);
    .box-shadow(none);
  }

  .slider-track {
    background-color: @wellBackground;
    border: 1px solid darken(@wellBackground, 7%);
    .border-radius(@baseBorderRadius);
    .box-shadow(inset 0 1px 1px rgba(0,0,0,.05));
  }

  &.slider-disabled .slider-track {
    background-image: none;
    .opacity(65);
    .box-shadow(none);
  }

  .slider-handle {
    .btn;
    padding: 0;
    margin-bottom: 0;
    .opacity(100);

    &.hide {
      display: none;
    }

    &.round {
      .border-radius(50%);
    }
  }
}
