@import "widgy_common.scss";

$font-default: "Open Sans", Arial, Helvetica, sans-serif;

.ajax-loading * {
  cursor: progress !important;
}

.widgy {
  font-family: $font-default;
  font-size: 12px;

  .editor {
    background: $reallylightgrey;
  }

  .node {
    @include rounded(4px);
    @include shadow($black10,1px,1px,0px);
    @include inset-shadow(transparent,0px,0px,0px);
    list-style: none;
    padding: 0px;

    &.deleting {
      @include shadow($black50,0px,5px,15px);
      border-color: $red;

      div.widget {
        p.drag-row {
          span.title {
            color: $red;
          }
        }
      }
    }
  }

  .widget {
  }

  .preview {
    padding: 0;

    &:not(:empty) {
      padding: 1em;
    }
  }

  // Anything but the root node
  .node:not(section) {
    background: white;
    border: 1px solid #E0E0E0;

    .draggable > .drag-row {
      @include cursor(grab, pointer);
    }
    .being_dragged .drag-row {
      @include cursor(grabbing, pointer);
    }

    .drag-row {
      @include rounded(4px 4px 0px 0px);
      @include clearfix;
      @include gradient(#eee,#fff);
      display: block;
      float: none;
      height: auto;
      min-height: 20px;
      margin: 0px;
      padding: 2px;
      position: relative;
      width: auto;

      span.title {
        color: #666;
        font-size: 13px;
        font-weight: normal;
        line-height: 20px;
      }

      button.edit,
      button.delete {
        float: right;
        margin: 1px 1px 0px 3px;
      }

      .dragHandle {
        left: 0px;
        float: left;
        font-size: 14px;
        position: relative;
        top: 3px;
      }
    }
  }
}

// Root Node
.widgy section.node {
  > .widget > .drag-row > .title {
    font-family: $font-default;
    font-size: 2.4em;
    padding: 5px 0 5px 10px;
  }

  > .widget > .nodeChildren {
    padding-left: 1em;
  }


  &:first-child > .widget > p.drag-row button {
    float: none;
    position: relative;
    top: -5px;
  }
}

// Dragging
.widgy {
  .node_drop_target {
    @include rounded(3px);
    @include transition;

    border: none;
    background: lighten($green, 25%);
    font-size: 1.0em;
    font-style: italic;
    margin-left: 1em;
    margin-right: 1em;
    text-align: center;

    &.active {
      border: 1px dashed $green;
      background: lighten($green, 40%);
      color: darken($green, 10%);
    }

    &.previous {
      background: $orange;
    }
  }
}

// Shelf
.widgy {
  .shelf {
    > .title {
      display: none;
    }
  }

  .shelfItem {
    @include gradient(#eeeeee,#ffffff);
    @include rounded(4px);
    @include shadow($black10,1px,1px,0px);
    @include inset-shadow(#ffffff,-1px,1px,0px);
    @include cursor(grab, pointer);
    border: 1px solid #E0E0E0;
    margin: 0 4px 4px 0;
    padding: 1px 1px 1px 1px;
    vertical-align: top;
    width: 215px !important;

    span.title {
      font-size: 11px;
      max-width: 160px;
      padding: 4px 0 2px 0;
      text-transform: capitalize;
      width: 160px;

      &:before {
        // These are all of the common properties for the shelfItem icons.  We
        // put the icon in a pseudo-element so that we can control the size of
        // the background-image without affecting the size of the actual
        // span.title.
        // TODO: This code assumes that each icon is exactly 16x16.
        background-repeat: no-repeat;
        content: "";
        float: left;
        height: 16px;
        // The margin-top and margin-bottom need to be the same as the
        // padding-top/padding-bottom of the span.title.  We use margin here
        // instead of padding because we MUST NOT be bigger than 16x16.
        margin: 4px 5px 2px 5px;
        width: 16px;
      }
    }

    span.icon-move {
      float: right;
      margin-top: 4px;
    }

    &.being_dragged {
      @include cursor(grabbing, pointer);
    }
  }

  // Global Shelf
  section.node > .widget > .shelf {
    > .title {
      display: block;
      margin-bottom: 10px;
    }

    .shelfItem {
      padding: 0px 5px 0px 5px;
      width: 190px;
    }

    span.icon-move {
      color: #999999;
      font-size: 20px;
      margin-top: 8px;
    }

    span.title {
      display: inline;
      float: left;
      font-size: 14px;
      line-height: 22px;
      padding: 5px 0 5px 0;
      max-width: 130px;

      &:before {
        margin: 5px 6px;
      }
    }
  }

  // local shelf
  .node:not(section) .shelf {
    border-bottom: 2px solid $lightgrey;
    padding: 10px 0 5px 1em;
    
    &.empty {
      display: none;
    }
  }
}

// EditorView
.widgy .widget_editor {
  @include clearfix;
  @include default;
  padding-bottom: 15px;

  form > div,
  > div {
    @include clearfix;
    @include default;
    clear: both;
    padding: 0px;
    position: relative;
  }

  .formField {
    margin-bottom: 10px;

    > div {
      @include clearfix;
      @include default;
      clear: both;

      &.pagedown-buttonbar {
        padding: 0px 0px 10px 0px;
      }

      &.pagedown-preview {
        border-top: 1px dotted $lightgrey;
        margin-top: 15px;
        padding: 10px 0px 0px 0px;
      }
    }

    > div {
      @include clearfix;
      @include default;
      clear: both;

      &.pagedown-buttonbar {
        padding: 0px 0px 10px 0px;
      }

      &.pagedown-preview {
        border-top: 1px dotted $lightgrey;
        margin-top: 15px;
        padding: 10px 0px 0px 0px;
      }
    }

    select {
      width: 50%;
    }

    &.required {
      label:after {
        content: "*";
        color: $red;
      }
    }

    &.error {
      #{$inputFields},
      textarea {
        border-color: $red;
      }

      ul.errorlist {
        li.error {
          padding-left: 115px;
        }
      }
    }

    p.datetime {
      display: inline;
      float: left;
      width: 50%;

      br {
        display: inline;
      }

      input[type='text'] {
        margin: 0px 5px;
        width: 100px;
      }
    }
  }

  #{$inputFields},
  button {
    &:focus {
      @include inset-shadow(lighten($purple,15%), 0px, 1px, 3px);
      border-color: $purple;
    }
  }

  #{$inputFields} {
    @include rounded(3px);
    @include inset-shadow($black10,0px,1px,2px);
    border: 1px solid $lightgrey;
    font-family: $font-default;
    font-size: 13px;
    font-weight: normal !important;
    height: auto;
    padding: 5px 1%;
    width: 48%;
  }

  input {
    &[type='checkbox'],
    &[type='radio'] {
      margin-left: 0px;
    }

    &[type='submit'] {
      @include button;
      float: right;
    }
  }

  input[type='submit'] {
    float: right;
  }

  label {
    clear: left;
    padding: 0 10px 10px 0;
  }

  textarea {
    clear: both;
    max-width: 98.5%;
    height: 120px;
    width: 98.5%;

    + span.cke {
      clear: both !important;
    }
  }

  select {
    font-family: $font-default;
    font-size: 13px;
    font-weight: normal;
  }

  select {
    font-family: $font-default;
    font-size: 13px;
    font-weight: normal;
  }

  .cancel {
    position: absolute;
    right: 55px;
    top: 0px;
  }
}

// Element styles
.widgy {
  button,
  input[type='submit'],
  a.pop_out {
    @include button;
    font-family: $font-default;
    margin-left: 10px;
    font-size: 11px;
    text-decoration: none;
    text-transform: capitalize;
  }

  h1 {
    color: #535353;
    font-family: $font-default;
    font-size: 32px;
    font-weight: 400;
    line-height: 38px;
  }

  h2 {
    color: #535353;
    font-size: 22px;
    line-height: 28px;
  }

  h3 {
    color: #535353;
    font-size: 16px;
    font-weight: bold;
    line-height: 20px;
  }

  h4 {
    color: #535353;
    font-size: 18px;
    font-weight: bold;
  }

  h5{
    color: #535353;
    margin: 0px 0px 4px 0px;
  }

  p {
    margin: 0;
  }

  p.title {
    color: #353535;
    font-family: $font-default;
    font-size: 22px;
    font-weight: 300;
    line-height: 28px;
    margin: 0 0 10px 0;
  }

  span.title {
    color: #353535;
    font-family: $font-default;
  }
}


input.cke_dialog_ui_input_text, input.cke_dialog_ui_input_password, textarea.cke_dialog_ui_input_textarea {
  height: auto !important; // fixes the tiny URL window in ckeditor link popup
}

.change-form div.submit-row {
  z-index: 100; // fixes the mezzanine action bar floating under the widgy shelf
}

/* Widgy Tools Buttons
--------------------------------------------------*/

ul.widgy-tools {
  @include clearfix;
  margin-bottom: 15px;

  li {
    display: inline;
    float: left;
    margin-right: 5px;

    a {
      @include outside-button;
      font-size: 13px;
      font-weight: bold;
      padding: 2px 8px !important;

      &.commit {
        border-color: $green;
        color: $green;

        &:hover {
          background-color: lighten($green,50%);
        }
      }

      &.reset {
        border-color: $red;
        color: $red;

        &:hover {
          background-color: lighten($red,35%);
        }
      }
    }
  }
}
