// The space around account entries:
@accounts-padding: 8px;
@accounts-corner: 6px;
@accounts-width: 200px;

//
// LAYOUT
//

.main-panel {
  position: absolute;
  height: 100%;
  width: 100%;
  display: -webkit-flex;
  -webkit-flex-direction: row;

  > .body {
    -webkit-flex: 1 1 auto;
    overflow: auto;
  }

  .accounts {
    -webkit-flex: 0 0 auto;
    overflow-y: auto;
    overflow-x: hidden;

    display: -webkit-flex;
    -webkit-flex-direction: column;
    ul {
      -webkit-flex: 1 1 1000px;
    }
    .btn-toolbar {
      -webkit-flex: 0 0 auto;
    }

  }

}

//
// Style
//


.main-panel > .body {
  padding: 20px;
  background-color: white;
}

.main-panel .accounts {
  background-color: #333;
  width: @accounts-width;
  padding: @accounts-padding;
  padding-right: 0px;
}

.main-panel .accounts ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-panel .accounts li {
  position: relative;
  cursor: pointer;
  color: white;
  padding: 15px;
  background-color: #444;
  margin-bottom: @accounts-padding;
  border-top-left-radius: @accounts-corner - 1;
  border-bottom-left-radius: @accounts-corner - 1;
  z-index: 100;
  display: flex;
  display: -webkit-flex;
  &:hover {
    background-color: #555;
  }
}

.main-panel .accounts li span.domain {
  display: block;
  font-weight: bold;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-panel .accounts li span.username {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

/*.main-panel .accounts li span.icon {
  display: block;
  height: 32px;
  width: 32px;
  background-color: #999;
  float: left;
}
*/

.main-panel .accounts li.active {
  background-color: white;
  color: #333;
}

.main-panel .accounts li.active span.arc {
  display: block;
  height: @accounts-corner;
  width: @accounts-corner;
  background-color: white;
  position: absolute;
  right: 0;
}

.main-panel .accounts li.active span.arc.top {
  top: 0;
  margin-top: -@accounts-corner;
}
.main-panel .accounts li.active span.arc.bottom {
  bottom: 0;
  margin-bottom: -@accounts-corner;
}
.main-panel .accounts li.active span.arc:after {
  display: block;
  content: "";
  border-radius: 100%;
  height: 0px;
  width: 0px;
  margin-left: -@accounts-corner;
}
.main-panel .accounts li.active span.arc.top:after {
  border: @accounts-corner solid transparent;
  border-right: @accounts-corner solid #333;
  margin-top: -@accounts-corner;
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
}
.main-panel .accounts li.active span.arc.bottom:after {
  border: @accounts-corner solid #333;
}

.main-panel .accounts .btn.expander {
}

.main-panel .accounts .app-buttons {
  margin-bottom: @accounts-padding;
}

.main-panel .accounts li .account-details {
  width: 140px;
  margin-right: 5px;
}

.main-panel .accounts li .vpn-status {
  margin-top: auto;
  margin-bottom: auto;
}

.main-panel .accounts li .vpn-status.down {
  color: #ef5350;
}

.main-panel .accounts li .vpn-status.connecting {
  color: #fbc02d;
}

.main-panel .accounts li .vpn-status.up {
    color: #66bb6a;
}

//
// SECTIONS
//
// html structure:
//
// .service-section
//   .expander
//   .shader
//     .icon
//     .inner
//       .header-row
//         .header
//         .buttons
//       .body-row
//     .status
//
@icon-size: 32px;
@status-size: 24px;
@section-padding: 15px;

// service sections layout

.main-panel .service-section {
  display: -webkit-flex;
  -webkit-flex-direction: row;
  .expander {
    -webkit-flex: 0 0 auto;
  }
  .shade {
    -webkit-flex: 1 1 auto;
    display: -webkit-flex;
    -webkit-flex-direction: row;
    .icon {
      -webkit-flex: 0 0 auto;
    }
    .status {
      -webkit-flex: 0 0 auto;
    }
    .inner {
      -webkit-flex: 1 1 auto;
      .header-row {
        display: -webkit-flex;
        -webkit-flex-direction: row;
        .header {
          -webkit-flex: 1 1 auto;
        }
        .buttons {
          -webkit-flex: 0 0 auto;
        }
      }
      .body-row {
      }
    }

  }
}

.main-panel .service-section div {
  //outline: 1px solid rgba(0,0,0,0.1);
}

// service sections style

.main-panel .service-section {
  margin-bottom: 10px;
  .shade {
    background: #eee;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    padding: @section-padding;
  }
  &.wide-margin .shader {
    padding: 18px 20px 20px 10px; // arbitrary, looks nice
  }
  .expander {
    padding: 22px 6px 0px 6px;
    width: 12px + 6px + 6px;
    background: #e3e3e3;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    &:hover {
      background: #cfcfcf;
    }
  }
  .icon {
    padding-right: @section-padding;
    height: @icon-size;
    img {
      width: @icon-size;
      height: @icon-size;
    }
  }
  .header {
    h1 {
      margin: 0;
      padding: 0;
      font-size: @icon-size - 10;
      line-height: @icon-size;
      display: inline;
      word-break: break-all;
    }
    span.info {
      word-break: break-all;
      margin-left: 10px;
    }
  }
  .buttons {
    padding-left: 10px;
  }
  .status {
    padding-top: 5px; // maybe there is a better way to do this
    padding-left: @section-padding;
    width: @section-padding + @status-size;
    img {
      // this fixes a bug where sometimes the status icons are not
      // correctly rendered in the web widget
      width: 100%;
      height: auto;
    }
    &.spin img {
      animation: icon-spin 10s linear infinite;
      -webkit-animation: icon-spin 10s linear infinite;
    }
  }
  .body-row {
    .alert {
      margin-bottom: 0px;
    }
    // all immediate child divs are considered to be separate sections in
    // in the body row of the section.
    & > div {
      margin-top: @section-padding;
    }
  }
}

@-webkit-keyframes icon-spin {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}
@keyframes icon-spin {
    from {transform:rotate(0deg);}
    to {transform:rotate(360deg);}
}