$panel-width: 440px;
$transparent: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==';
$control-background: linear-gradient(to bottom, #f8f8f8 0%, #f0f0f0 100%);
$control-border: 1px solid #ccc;
$control-border-radius: 2px;


// Layout

.Editro {
  &-wrapper {
    position: relative;
    height: 100%;
  }
  &-code {
    display: none;
  }
  &-code[is-opened] {
    position: relative;
    display: block;
    min-height: 50%;
  }
  &-previewWrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: $panel-width;
    height: 100%;
    background: url($transparent);
  }
  &-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: none;
  }
  &-nav {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 1;
    font-size: 16px;
    font-weight: bold;

  }
  &-navBtn {
    font-size: 16px;
    font-weight: bold;
    padding: 2px 6px;
  }
  &-navBtn + &-navBtn {
    margin-left: -1px;
  }

  &-reset {
    display: none;
  }
  &-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: $panel-width;
    height: 100%;
    background: white;
    box-shadow: -4px 0 10px 0px rgba(20,20,20,0.2);
  }
}


// Just button

.EditroButton {
  background: $control-background;
  border: $control-border;
  cursor: pointer;
  outline: none;

  &-wrapper {
    display: block;
    padding: 3px 7px;
    background: transparent;
    transition: background 0.3s;
  }
  &:active &-wrapper {
    background: #e2e2e2;
  }

  &[disabled] .EditroIcon {
    opacity: 0.2;
  }
}


// Placeholder for panel

.EditroPanelPlaceholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  background: #fafafa;
  align-items: center;

  &-text {
    width: 100%;
    text-align: center;
    font-size: 24px;
    line-height: 2;
    font-weight: 100;
    color: #ccc;
  }
}


// Form

.EditroControl {}
.EditroForm {
  display: inline-block;
  width: 100%;
  vertical-align: top;
  margin-bottom: 30px;

  &:last-child {
    margin-bottom: 0;
  }

  &--controls-separated {
    .EditroControl + .EditroControl {
      margin-top: 10px;
    }
  }

  &-title {
    margin-bottom: 10px;
    font-size: 13px;
    text-transform: uppercase;
    color: #bbb;
  }
  &-controls {
    & + & {
      margin-top: 10px;
    }
  }
}
.EditroField {
  display: flex;

  & + & {
    margin-top: 10px;
  }

  &-label {
    width: 40%;
    margin-right: 20px;
    white-space: nowrap;

    &:before {
      content: '';
      display: inline-block;
      width: 0;
      height: 27px;
      vertical-align: middle;
    }
  }
  &--controlOnly &-label {
    display: none;
  }
  &-labelWrapper {
    display: inline-block;
    vertical-align: middle;
    white-space: normal;
    font-size: 13px;
    line-height: 1;
  }
  &-control {
    width: 60%;

    &--inline {
      display: flex;
    }
  }
  &--controlOnly &-control {
    width: 100%;
  }
  &-controlLabel {
    display: inline-block;
    vertical-align: middle;
    margin-left: 5px;
    font-size: 12px;
  }
}


// Action

.EditroAction {
  display: inline-block;
  vertical-align: top;
  height: 34px;
  border: $control-border;
  border-radius: $control-border-radius;
  background: $control-background;
  outline: none;
  font-size: 0;

  &-text {
    display: inline-block;
    padding: 0 20px;
    text-align: left;
    line-height: 34px;
    font-size: 14px;
  }
  &-choice {
    vertical-align: top;
    height: 32px;
    padding: 0 7px;
    background: none;
    border: none;
    border-left: $control-border;
    cursor: pointer;
    outline: none;

    &:hover {
      background: rgba(black, 0.1);
    }
  }

  &--delete {
    width: auto;
    margin-right: 0;
    float: right;
    border-color: #a0252b;
    background: linear-gradient(to bottom, #e4353e 0%, #d9333b 100%);
    color: white;
    cursor: pointer;
  }
}


// Edit text content

.EditroTextContent {
  position: relative;
  padding: 5px 8px;
  border: $control-border;
  border-radius: $control-border-radius;
  background: $control-background;
  font-size: 12px;
  outline: none;
  line-height: 1.4;

  &-preview {
    color: #ccc;
  }
  &-previewLabel {
    position: absolute;
    bottom: 2px;
    right: 2px;
    color: #999;
    font-size: 11px;
    line-height: 1;
  }
  &-editable {
    outline: none;
  }
}



// Toggler

.EditroToggler {
  &[collapsed=false] &-less,
  &-less[collapsed=false] {
    display: none;
  }
  &[collapsed=true] &-more,
  &-more[collapsed=true] {
    display: none;
  }
}


@import "controls";
@import "icons";
