.plone-modal-open > .component-wrapper{
  -webkit-filter: none !important;
  -moz-filter: none !important;
  -o-filter: none !important;
  -ms-filter: none !important;
  filter: none !important;
}

// Kill the scroll on the body
.modal-open {
  overflow: hidden;
}

//Default Styles
.castle-modal-wrapper{
  @import (multiple) "@{bowerPath}/bootstrap/less/close.less";
  @import (multiple) "@{bowerPath}/bootstrap/less/component-animations.less";
  @import (multiple) "@{bowerPath}/bootstrap/less/modals.less";
  @import (multiple) "@{bowerPath}/bootstrap/less/forms.less";
  @import (multiple) "@{bowerPath}/bootstrap/less/input-groups.less";
}

.modal-open .castle-modal-wrapper .modal{
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 3001;
  background: rgba(0, 0, 0, 0.5);
}
.plone-modal-wrapper .plone-modal{
  background:none;
}

.castle-modal-wrapper, .plone-modal-wrapper, .mosaic-modal-wrapper{
  *{
    box-sizing: border-box;

    button, .plone-btn, .plone-btn-primary, .plone-btn-default, input[type="submit"], .btn, .btn-default{
      font-family:'Open Sans 700', Arial, sans-serif;
      font-weight:700;
      border:none;
      border-radius: 0;
      padding:8px 14px;
      font-size:0.95em;
      text-shadow:none;

      transition: background-color 300ms ease-out 0s;

      .disabled{
        opacity:0.65;
      }
    }


    .btn.btn-default,
    .plone-btn.plone-btn-default {
      background-color: #f7f7f7;
      color:#333;
      font-size:0.9em;
      font-family:'Open Sans', Arial, sans-serif;
      border:1px solid #ccc;
      padding:6px 12px;
      margin:0 6px 0 0;
      border-radius: 0;
      cursor: pointer;
      transition: background-color 300ms ease-out 0s;

      &:hover, &:focus {
        background-color:darken(#f7f7f7, 10%);
        text-decoration: none;
      }
    }

    .formHelp{
      color:#767676;
      margin-top: 0px;
      margin-bottom: 0px;
      font-style: italic;
      display: block;
      font-size: 13px;
      font-family: 'Open Sans 600';
    }

    h1, h2, h3, h4{
      font-family:"Open Sans 700", Arial, sans-serif !important;
      font-weight:700;
    }
  }

  .modal-header, .plone-modal .plone-modal-dialog .plone-modal-header, .mosaic-modal .plone-modal-dialog .plone-modal-header {
    background-color: @castle-primary;
    border-bottom: none;
    height: auto;
    padding:13px 20px;

    h4, h2{
      font-family:"Open Sans 700", Arial, sans-serif;
      font-weight:700;
      font-size: 1.4em;
      line-height: 1em;
      color:#fff;
      margin-top:0.2em;
      margin-bottom:0.2em;
    }

    .close, .plone-modal-close, .mosaic-overlay-close, button.close, button.mosaic-overlay-close {
      font-family:'Open Sans', Arial, sans-serif;
      opacity: 1;
      text-shadow: none;
      padding:0;
      background: transparent;
      color: #fff;
      text-align: center;
      margin-top:-3px;
      font-size:30px;
      line-height: 36px;

      &:hover, &:focus {
        text-shadow: none;
        background: transparent;
        box-shadow: none;
      }
    }
  }

  .modal-content, .plone-modal .plone-modal-content, .mosaic-overlay {
    font-family:'Open Sans', Arial, sans-serif;
    color:@font-color-primary;
    background:#fff;
    border-radius:0;
    border:none;

    .modal-body, .plone-modal-body{
      margin: 0;
      padding:20px;

      h1, h2{
        font-family: 'Open Sans Condensed', Arial, sans-serif;
        color:@font-color-primary;
      }
      h3, h4, h5, h6{
        font-family: 'Open Sans 700', Arial, sans-serif;
        color:@font-color-primary;
        margin-top:0.2em;
        margin-bottom:0.2em;
      }

      h2{ font-size:1.5em; }
      h3{ font-size:1.25em; }
      h4{ font-size:1.2em; }
      h5{ font-size:1.1em; }
      h6{ font-size:1em; }
    }

    p{
      margin-top:0;
    }
  }
}

//tables
.castle-modal-wrapper{
  table{
    border-spacing: 0;

    thead {
      background:#fff;

      tr {
        border-spacing: 0px;

        th, td {
          font-size: 15px;
          vertical-align: middle;
          text-align: left;
          border-width: 0px;
          padding: 7px 5px;
        }
        td {
          border-bottom-width: 1px;
        }
        th {
          color: @castle-primary;
          padding: 10px 5px;
          border-bottom: 2px solid #b5b5b5;
          font-weight:bold;
        }
      }
    }

    tbody {
      tr td:first-child {
        border-top: 1px solid transparent;
        border-bottom: 1px solid transparent;
      }

      tr {
        border-spacing: 0px;

        &:nth-of-type(even){
          background:#fff;
        }

        &:nth-of-type(odd){
          background:#f9f9f9;
        }

        td {
          font-size: 15px;
          vertical-align: middle;
          padding: 8px 5px 8px 8px;
          border-width: 0px;

          a[class*="contenttype-"]::before {
            width: 14px;
            height: 14px;
            margin-top: -8px;
            margin-right: 0.4375em;
            display: inline-block;
          }
        }
      }
    }
  }
}

//Footer
.castle-modal-wrapper, .plone-modal-wrapper, mosaic-overlay{
  .modal-footer, .plone-modal-footer{
    padding:20px;
    background:#fcfcfd;
    border-top:1px solid #e5e5e5;
    box-shadow: none;
    text-align:right;

    button, .plone-btn, .plone-btn-primary, .plone-btn-default, input[type="submit"], .btn, .btn-default{
      font-family:'Open Sans 700', Arial, sans-serif;
      font-weight:700;
      border:none;
      border-radius: 0;
      padding:8px 14px;
      font-size:0.95em;
      text-shadow:none;

      transition: background-color 300ms ease-out 0s;

      .disabled{
        opacity:0.65;
      }
    }

    .btn-default, .plone-btn-default, #form-buttons-cancel {
      background-color: #dedede;
      color:#777;

      &:hover, &:focus {
        background-color: darken(#dedede, 10%);
      }
    }

    .plone-btn-primary,
    .btn-primary,
    #form-buttons-save {
      background-color: @modal-button;
      color:#fff;

      &:hover, &:focus {
        background-color: @modal-button-hover;
      }
    }
  }
  .btn-container{
    border-top:none;
    margin-bottom:16px;

    button:not(:last-child){
      margin-right:8px;
    }
  }

  .pattern-modal-buttons{
    #buttons-save{
      float:right;
      margin-left:8px;
      background-color: @modal-button;
      color:#fff;
    }
  }
}

//??????????????????
.col-md-1.action {
  width: 16.666667% !important;
  float: left !important;
  display: block;
  padding-left: 0px !important;
  button {
    margin-left: 0px !important;
  }
}
.col-md-8.title {
  width: 58.33333333% !important;
  float: left !important;
  display: block;
  .dz-filename span {
    vertical-align: middle;
    line-height: 40px;
  }
}
.col-md-3.info {
  width: 25%;
  float: left;
  .dz-size {
    vertical-align: middle;
    line-height: 44px;
    width: calc(~"100% - 35px");
    float: left
  }
  img {
    float: left !important;
    vertical-align: middle;
    line-height: 44px;
    margin-top: 7px !important;
  }
}


//RELATED ITEMS
.plone-modal-open .select2-drop.select2-drop-active .select2-results{
  max-height: 200px;
}

.plone-modal-wrapper{
  .select2-results .select2-highlighted{
    background:@castle-primary;
  }
}

//Form Styles
.castle-modal-wrapper,
.plone-modal-wrapper,
.mosaic-modal-wrapper {
  label {
    font-family: 'Open Sans 700', Arial, sans-serif;
    font-weight:700;
    margin-bottom:4px;
    font-size: 14px;
    color: #4d4d4d;
    cursor: pointer;
  }


  .field{
    margin:15px 0;
  }

  select, input, textarea{
    box-sizing: border-box;
    font-family: @font-family-base;
  }

  .form-control, input[type="text"], textarea, select, .select2-container .select2-choice, .select2-container-multi .select2-choices {
    height:auto;
    background-color: #fff;
    font-family: @font-family-base;
    font-size:14px;
    border:1px solid #dedede;
    border-radius:0;
    box-shadow: none;
    padding:7px 10px;
    transition:border-color ease-in-out .15s, box-shadow ease-in-out .15s;

    &:hover{
      border:1px solid #999;
    }

    &:focus{
      outline:2px solid lighten(@castle-primary, 40%);
      background-color:#f8f8f8;
      box-shadow:none;
    }
  }

  input[type="checkbox"] {
     margin-right: 8px;
  }

  select{
    -webkit-appearance:none !important;
    -moz-appearance: none;
    appearance: none;
    background: url(../../images/icon-caret-down.png) no-repeat 98% 49% !important;
    min-width:10em;

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

  .styled-select{
     background: url(../../images/icon-caret-down.png) no-repeat 98% 49%;
     height: 33px;
     overflow: hidden;

     select {
       -webkit-appearance:none !important;
       -moz-appearance: none;
       appearance: none;
       background: transparent;
    }
  }

  .select2-container-multi .select2-choices{
    background-image:none;
    padding:7px 10px;

    .select2-search-choice{
      font-size:0.9em;
      padding:6px 6px 6px 18px;
      margin:0;

      .select2-search-choice-close{
        top:6px;
        left:4px;
      }

      .select2-input{
        padding:4px;
        min-height:36px;
      }
    }
  }
  .select2-container .select2-choice{
    padding:7px 10px;
    background-image:none;
    line-height: inherit;

    abbr{
      background:none;
    }
    .select2-arrow{
      background:none;
      border-left:none;
      border-radius: 0;

      b{
        background: url(../../images/icon-caret-down.png) no-repeat 40% 49% !important;
      }
    }

    .select2-input.select2-input {
      background:#fff;

      &:hover{
        border:1px solid #999;
      }
    }
  }

  .input-group .form-control{
    width: 100%;
    border-radius:0;

    &:focus{
      outline:2px solid lighten(@castle-primary, 40%);
      box-shadow:none;
    }
  }
  .input-group-addon{
    background-color: #fff;
    font-weight:700;
    font-size:0.875em;
    color:lighten(@font-color-primary, 20%);
    border:none;
    border-radius: 0;

    .contenttype-folder{
      margin-left:3px;

      &::before{
        margin-right:0;
      }
    }
  }

  .input-group-btn{
    button.plone-btn.plone-btn-primary{
      background-color: @modal-button;
      color:#fff;
      font-family:'Open Sans 700', Arial, sans-serif;
      font-weight:700;
      border:none;
      padding:8px 14px;
      border-radius: 0;
      transition: background-color 300ms ease-out 0s;
      font-size: 14px;


      &:hover, &:focus {
        background-color: @modal-button-hover;
      }
    }
  }

  input[type="text"], input[type="password"], input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="month"], input[type="week"], input[type="email"], input[type="number"], input[type="search"], input[type="tel"], input[type="time"], input[type="url"], textarea {
    color: @castle_dark_grey_color;
  }
  input[type="text"]:focus, input[type="password"]:focus, input[type="date"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="month"]:focus, input[type="week"]:focus, input[type="email"]:focus, input[type="number"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="time"]:focus, input[type="url"]:focus, textarea:focus {
    color: @castle_darker_color;
  }


  //tabs
  .pat-autotoc.autotabs {
    border-radius: 0;
    box-shadow: none;
    margin:0;
    padding:0;

    nav.autotoc-nav {
      margin: 0px;
      background:#f8f8f8;
      border-bottom: 1px solid @modal-border;

      a {
        font-family:"Open Sans", Arial, sans-serif;
        font-size:0.95em;
        color: lighten(@font-color-primary, 60%);
        border-radius: 0;
        border:none;
        margin: 0;
        padding: 8px 15px;
        background:transparent;

        &:hover{
          cursor: pointer;
          color:@castle-primary;
        }

        &.active {
          color:@font-color-primary;
          background-color: #fff;
          border:none;
          border-right: 1px solid @modal-border;
          border-left: 1px solid @modal-border;
          border-top:4px solid @castle-primary;
          position: relative;
          top:1px;

          &:first-child{
            border-left:0;
          }
        }
      }
    }

    > div, > p{
      padding:15px;
      min-height:100px;
    }

    fieldset{
      padding:15px;
      border:none;
      margin-top:0;
    }
  }

    .input-group {
      margin-bottom: 10px;
      .input-group-addon {
        border-right: 0px;
        min-width: 90px;
        text-align: right;
      }
    }
    .content-list {
      text-align: left;
    }
}

//aliases
.plone-modal-wrapper{
  fieldset legend{
    width:auto;
    border-bottom:none;
    font-size:18px;
    padding:0 4px;
  }
}


@media( min-width:1200px ){
  .castle-modal-wrapper .modal-dialog, .plone-modal-wrapper .plone-modal .plone-modal-content{
    width:70%;
  }
}

@media(min-width:768px) and (max-width:1199px){
  .castle-modal-wrapper .modal-dialog, .plone-modal-wrapper .plone-modal .plone-modal-content{
    width:80%;
  }
}


@media( max-width:768px ){
  .castle-modal-wrapper .modal-dialog, .plone-modal-wrapper .plone-modal .plone-modal-content{
    margin:100px auto !important;
    left:0;
    top:0;
  }
  .plone-modal .plone-modal-content{
    width: 100% !important;
  }
}
