/**
 * ---------------------------------------------------------------------
 * Formcreator is a plugin which allows creation of custom forms of
 * easy access.
 * ---------------------------------------------------------------------
 * LICENSE
 *
 * This file is part of Formcreator.
 *
 * Formcreator is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Formcreator is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Formcreator. If not, see <http://www.gnu.org/licenses/>.
 * ---------------------------------------------------------------------
 * @copyright Copyright © 2011 - 2021 Teclib'
 * @license   http://www.gnu.org/licenses/gpl.txt GPLv3+
 * @link      https://github.com/pluginsGLPI/formcreator/
 * @link      https://pluginsglpi.github.io/formcreator/
 * @link      http://plugins.glpi-project.org/#/plugin/formcreator
 * ---------------------------------------------------------------------
 */
@-moz-keyframes ripple {
  0%, 100% {
    opacity: 0;
  }
  1% {
    opacity: 1;
  }
}
@-webkit-keyframes ripple {
  0%, 100% {
    opacity: 0;
  }
  1% {
    opacity: 1;
  }
}
@keyframes ripple {
  0%, 100% {
    opacity: 0;
  }
  1% {
    opacity: 1;
  }
}

@keyframes fadeIn {
   0% {
      opacity: 0
   }
   99% {
      opacity: 0;
   }
   100% {
      opacity: 1;
   }
}
@keyframes fadeOut {
   0% {
      opacity: 1;
   }
   1% {
      opacity: 0;
   }
  100% {
      opacity: 0;
  }
}

.line0 {
   background-color: #F0F0F0;
}
.line1 {
   background-color: #E7E7E7;
}
.line0:hover, .line1:hover {
   background-color: #FFF;
}

/*
 * Form designer
 */

/* modals */
.modal-dialog .card-header {
   // Fix ribbon position
   position: relative;
}

/* Sections */
#plugin_formcreator_form.plugin_formcreator_form_design {
   ol {
      list-style-type: none;
      text-align: left;
      padding-left: 0;
      margin-top: .5em;

      > .plugin_formcreator_section {
         line-height: 32px;
         background-color: var(--table-head-bg);
         padding-bottom: 1px;
         display: flex;
         flex-wrap: wrap;
         align-items: center;

         > a {
            font-size: larger;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            flex: 1;
            margin: 5px 0 0 5px;
            color: inherit;
         }
      }
   }

   ol > .plugin_formcreator_section:not(:first-of-type) {
      margin-top: 20px;
   }

   ol > .plugin_formcreator_section.not-sortable > a {
      padding-left: 15px;
   }

   /* questions */
   .grid-stack {
      list-style-type: none;
      text-align: left;
      padding-left: 0;
      position: relative;
      min-height: 32px;
      flex: 1 0 100%;
   }

   .grid-stack-item {
      line-height: 32px;
   }

   .grid-stack-item .grid-stack-item-content {
      text-align: left;
      padding-left: 16px;
      padding-right: 10px;
      margin: 0 2px;
      background-color: var(--light-mix);
      display: flex;
      align-items: center;

      > i {
         min-width: 14px;
      }
   }

   .grid-stack-item .grid-stack-item-content a[data-field=name] {
      flex-grow: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
   }

   .grid-stack-item.ui-draggable-dragging {
      z-index: 100;
   }

   .grid-stack > .grid-stack-item > .ui-resizable-se {
      right: 3px;
      bottom: 1px;
      background-image: url("../pics/corner-handle.png");
      transform: inherit;
      width: 16px;
      height: 16px;
   }

   .plugin_formcreator_question {
      background-color: var(--tabs-active-bg);
      margin: 5px 2px;
      padding-left: 15px;
      flex: 1;

      a {
         color: inherit;
      }
   }

   /* actions on sections or questions */
   .form_control {
      min-width: 20px;
      min-height: 1px;
      font-size: larger;

      > i {
         display: table-cell;
         vertical-align: middle;
         height: 32px;
      }
   }
}

.form_section .grid-stack .grid-stack-item {
   .grid-stack-item-content, .placeholder-content {
      left: 0;
      right: 0;
   }
}

/*
 * Translations
 */
.plugin_formcreator_filter_translations {
   position: absolute;
   right: 3%;
   // top: 10px;

   input {
      padding-left: 20px !important;
      width: 200px;
      height: 28px;
   }
}

/*
* Form Render
*/
#plugin_formcreator_form.plugin_formcreator_form {
   > ol {
      list-style-type: none;
      text-align: left;
      padding-left: 0;
   }

   [data-itemtype = "PluginFormcreatorQuestion"]:not([hidden]), .plugin_formcreator_gap {
      vertical-align: top;
      display: inline-block;
   }
}

.form_answer h1 {
   text-align: center;
   font-weight: bold;
   font-size: 1.8em;
   margin: 0 0 15px;

}

form#plugin_formcreator_form {
   max-width: 950px;
   margin: 10px auto 50px !important;
   display: block;
   position: relative;
   line-height: 1.4em;
}

#plugin_formcreator_form {
   > h1 {
      text-align: center;
      font-weight: bold;
      font-size: 1.8em;
      margin: 0 0 15px;
   }

   > .form_header {
      padding: 10px 15px;
   }

   /*
   * Validation header
   */
   > .refused_header, .accepted_header {
      padding: 10px 15px;
      background: #EED0D0; /*#EEE;*/
      border-radius: 4px;
      box-shadow: 2px 2px 2px #CCC;
      margin: 0 0 10px;

      > div {
         padding: 3px 10px;
         border-left: 5px solid #A00;
         color: #C00;
         font-style: italic;
         font-weight: bold;
         margin: 0 4px;
      }
   }

   > .accepted_header {
      background: #C0DDC0; /*#EEE;*/

      > div {
         border-left: 5px solid #060;
         color: #060;
      }
   }

   > .form_header {
      background: #EEE;
      margin: 0 0 10px;

      > h1 {
         font-size: 1.2em;
         margin: 0 0 10px;
      }
   }

   .form-group {
      padding: 5px 15px;

      > label {
         display: block;
         font-size: 1.2em;
         line-height: 32px;
         font-weight: bold;
      }

      .form_field {
         text-align: justify;
         word-wrap: break-word;

         ul:not(.select2-selection__rendered) {
            list-style: initial;
            margin: initial;
            padding: initial;
            padding-left: 40px;
         }

         .label-radio, .label-checkbox {
            display: inline;
            margin-bottom: 0.2em;
         }

         .radio, .checkbox {
            padding-bottom: 1em;
         }
      }
   }

   .form-group:after {
      content: '';
      display: block;
   }
}

#plugin_formcreator_form .form-group option {
   background: none;
   border: none;
}
#plugin_formcreator_form .form-group .form_field > input[type = file] {
   background: none;
   border: none;
   box-shadow: none;
   width: auto;
}
#plugin_formcreator_form .form-group > .help-block {
   font-size: 0.8em;
   color: var(--text-muted);
   padding: 3px 0;

   p {
      margin: 0;
      padding: 3px 0;
   }
}

#footer-login {
   position: relative !important;
   height: 30px;
   margin: 0 15px 0 0;
}

.form_description {
   display: none;
}
.form_description div {
   padding: 10px;
   background-color: #FFF;
   border-left: 5px solid #AAA;
   color: #333;
   font-style: italic;
   margin: 0 4px;
}

/*
* Spinner
*/

.plugin_formcreator_spinner {
   margin-left: auto;
   margin-right: auto;
   display: block;
   width: 48px;
}

.plugin_formcreator_description {
   table {
      border-width: 1px;

      tr, td {
         border-width: 1px;
      }
   }
}

/* CONDITIONS */

.div_show_condition_field, .div_show_condition_operator,
.div_show_condition_value, .div_show_condition_logic,
.div_show_condition_add, .div_show_condition_remove {
   display: inline-block;
}
.div_show_condition_field .select2-container,
.div_show_condition_operator .select2-container,
.div_show_condition_logic .select2-container {
   width: 95% !important;
   margin: 5px 0 0 !important;
}

.div_show_condition_value input {
   width: 90% !important;
   margin: 5px 0 0 5px !important;
   padding: 2px 5px !important;
}

.div_show_condition_field {
   width: 300px !important;
}
.div_show_condition_operator {
   width: 70px !important;
}
.div_show_condition_value {
   width:  300px !important;
}
.div_show_condition_logic {
    width: 70px !important;
}
.div_show_condition_add img, .div_show_condition_remove img {
   width: 12px;
   vertical-align: middle;
}
tr[data-itemtype="PluginFormcreatorCondition"] .div_show_condition_logic {
   visibility: hidden;
}
tr[data-itemtype="PluginFormcreatorCondition"] ~ tr[data-itemtype="PluginFormcreatorCondition"] .div_show_condition_logic {
   visibility: visible;
}
.select2-container + select {
   display: none !important;
}

#footer-login {
   display: none;
}

#tag_question_value .select2-container, #tag_specific_value .select2-container {
   width: 98%;
}

#tag_question_title, #tag_specific_title {
   line-height: 31px;
}

#formcreator_servicecatalogue_ticket_summary {
   margin: 5px 60px 0 5px;
   height: inherit;
   z-index: 15;
   width: 260px;
   transition: .4s;
   height: 1rem;

   .status {
      min-width: 2.3rem;
      display: inline-block;
      margin-right: 5px;
      margin-top: -5px;
      padding: 5px;
      text-align: center;
      background-color: rgba(0, 0, 0, .15);
      vertical-align: top;
      box-sizing: border-box;
   }

   .status:hover {
      background-color: rgba(0, 0, 0, .3);
   }

   .status_number {
      font-size: 2em;
   }

   .status_label {
      font-size: .7em;
      display: none;
   }

   .status:hover .status_label {
      display: block;
      line-height: 0;
   }
}

/* SLINKY CSS */
.slinky-menu {
   overflow: hidden;
   transform: translateZ(0);
   transition: all 300ms ease;
   -webkit-transform: translateZ(0);
   -webkit-transition: all 300ms ease;

    > ul {
      left: 0;
      position: relative;
      transform: translateZ(0);
      transition: all 300ms ease;
      -webkit-transform: translateZ(0);
      -webkit-transition: all 300ms ease;
   }

   ul,
   li {
      list-style: none;
      padding-bottom: 10px;
   }

   ul {
      width: 100%;
   }

   a {
      display: block;
      border: none;
      padding: 10px;
      height: 40px;
      span {
         white-space: nowrap;
         overflow: hidden;
         text-overflow: ellipsis;
         display: inline-block;
         width: calc(100% - 20px);
      }
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      width: calc(100% - 20px);
   }

   li ul {
      display: none;
      left: 100%;
      position: absolute;
      top: 0;
   }

   .header {
      position: relative;
      background: #AAA;
   }

   h2 ~ a.back {
      left: 0;
      position: absolute;
      top: 0;
   }

   h2 {
      font-size: 1em;
      margin: 0;
      text-align: center;
      padding: 1em;
   }

   a.next:after {
      content: '\276f';
      float: right;
   }

   a.back:before {
      content: '\276e';
      margin-right: 1em;
      float: left;
   }
}

#plugin_formcreator_wizard_categories, #plugin_formcreator_kb_categories {
   max-width: 275px;
   min-height: calc(100vh - 56px - 80px - 20px - 20px);
   border-right: 1px solid #DDD;

   div > a {
      display: inline-block;
      width: 100%;
      padding: 14px;
      box-sizing: border-box;
   }

   a {
      background-color: inherit;
   }

   a[data-category-id]:not([data-parent-category-id="0"]) {
      margin-left: 20px;
   }

   .category_active:not(.next),
   .category_active ~ul .header {
      position: relative;
   }

   .category_active:not(.next):before,
   .category_active ~ul .header:before {
      position: absolute;
      left: calc(100% - 46px);
      top: 50%;
      border: solid transparent;
      content: " ";
      height: 0;
      width: 0;
      border-right-color: #DDD;
      border-width: 23px;
      margin-top: -23px;
      z-index: 20;
   }

   .card-title {
      padding: 0.83em 0;
      margin: 0;
      padding: 14px;
      font-weight: bolder;
   }

   li {
      background-color: inherit;
      height: 40px;
   }
}

.break-column {
   flex-basis: 100%;
   width: 0;
}

#plugin_formcreator_last_req_forms, #plugin_formcreator_val_forms {
   max-width: 275px;
   max-height: 300px;

   .card-title {
      font-weight: bold;
      padding: 0.83em 0;
      margin: 0;
      padding: 14px;
   }

   .card-body {
      padding: 4px;
   }

   li[data-itemtype="PluginFormcreatorFormanswer"] {
      list-style-type: none;
   }
}

#plugin_formcreator_formlist {
   margin-top: 10px;
}


@keyframes fadeInUp {
  from {
    opacity: 0;
    -webkit-transform: translate3d(0, 100%, 0);
    transform: translate3d(0, 100%, 0);
  }

  to {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
}

.plugin_formcreator_formTile {
   margin: 0 3px 17px 3px;
   width: 300px;
   display: inline-block;
   vertical-align: top;
   text-align: left;
   overflow: hidden;
   cursor: pointer;
   border-radius: 5px;
   box-sizing: border-box;
   animation-name: fadeInUp ;
   animation-iteration-count: 1;
   animation-timing-function: ease-in;
   animation-duration: 0.3s;
}
.plugin_formcreator_formTile:hover {
   background-color: #EEEEEE
}

.plugin_formcreator_formTile.default_form {
   background-color: #CCC;
}

.plugin_formcreator_formTile.tile_design_uniform_height {
   height: 150px;
   display: inline-block;
}

a.plugin_formcreator_formTile_title {
   padding: 10px 40px 15px 10px;
   display: block;
   font-weight: bold;
}

.plugin_formcreator_formTile:hover a.plugin_formcreator_formTile_title {
   cursor: pointer;
}

.plugin_formcreator_formTile {
    i.fa, i.fab, i.fas {
      font-size: 2.5em;
      margin-right: 10px;
      float: left;
      margin: 10px;
   }
}

.plugin_formcreator_formTile_description {
   padding: 0 15px 5px 15px;
}

.plugin_formcreator_formTile div:first-child {
   color: #F00;
   float: right;
   margin: 0 5px;
}

#plugin_formcreator_wizard .plugin_formcreator_lists_separator {
   padding: 0;
}

#plugin_formcreator_wizard_right {
   min-width: 116px;
   overflow-x: hidden;
   overflow-y: auto;
}

#plugin_formcreator_wizard_forms {
   clear: both;

   > div {
      text-align: center;
  }
}

#plugin_formcreator_header {
   margin: 20px 25px 10px 6px;
}

#plugin_formcreator_searchBar {
   position: relative;
   margin: 20px 25px 20px 6px;
   padding: 10px 0 10px 0;
   box-sizing: border-box;

   input ~ label {
      position: absolute;
      float: left;
      display: block;
      top: 34%;
      text-align: center;
      width: 100%;
      transition:
         background 0.2s,
         color 0.2s,
         top 0.2s,
         bottom 0.2s,
         right 0.2s;
      cursor: text;
   }

   input:focus ~ label {
      color: #3874BC;
      top: 50%;
      font-size: 1em;
   }
}

#plugin_formcreator_search_input_bar {
   position:relative;
   display:block;
   width:100%;
}
#plugin_formcreator_search_input_bar:before,
#plugin_formcreator_search_input_bar:after {
   content:'';
   position: absolute;
   width: 0;
   height: 2px;
   bottom: 0;
   transition:0.2s ease all;
   background-color: #3874BC;
}
#plugin_formcreator_search_input_bar:before {
  left:50%;
}
#plugin_formcreator_search_input_bar:after {
  right:50%;
}
#plugin_formcreator_searchBar input:focus ~ #plugin_formcreator_search_input_bar:before,
#plugin_formcreator_searchBar input:focus ~ #plugin_formcreator_search_input_bar:after {
   width:50%;
}

#plugin_formcreator_searchBar input:valid ~ label {
   left: -9999px;
}

#plugin_formcreator_searchBar:after {
   width: 16px;
   height: 16px;
   content: '';
   display: inline-block;
   background-image: url("../pics/search.png");
   position: absolute;
   top: 39%;
   right: 10px;
}

#plugin_formcreator_lastForms {
   .plugin_formcreator_answer {
      margin: 3px;
      list-style: none;
      padding: 0;
      text-align: left;
      border-bottom: 1px solid rgba(0,0,0,.1);
   }

   li a {
      background-repeat: no-repeat;
      background-position: left center;
      padding: 11px;
   }

   .plugin_formcreator_waiting {
      background-image: url("../pics/waiting.png");
   }

   .plugin_formcreator_refused {
      background-image: url("../pics/refused.png");
   }

   .plugin_formcreator_accepted {
      background-image: url("../pics/accepted.png");
   }

   > div {
      padding-left:  10px;
      padding-right: 10px;
   }
}

.plugin_formcreator_date {
   display: block;
   text-align: right;
   font-size: .8em;
   font-style: italic;
}


.plugin_formcreator_heading {
   font-weight: bold;
}

#plugin_formcreator_serviceCatalog #header_top {
   height: 45px;
   line-height: 45px;
   position: relative;
   z-index: 10;
}
.formcreator_header_top#header_top {
   margin-left:  300px;
   width: calc(100vw - 300px);
   text-align: right;
   color: #FFF;
   z-index: 50;
   transition: .3s;
}


.formcreator-nav-button {
   z-index: 1;
   height: 1.5rem; width: 1.8rem;
   background-color: transparent;
   background-image: linear-gradient(to right, #FFF, #FFF),
     linear-gradient(to right, #FFF, #FFF),
     linear-gradient(to right, #FFF, #FFF);
   background-position: center top, center, center bottom;
   background-repeat: no-repeat;
   background-size: 3.5rem .3rem;
   padding: 0;
   outline: 0;
   border: 0;
   cursor: pointer;
   -webkit-tap-highlight-color:rgba(0,0,0,0);
}
#formcreator-toggle-nav-desktop ~ .formcreator-nav-button {
   margin: 10px 0 0 10px;
   position: absolute;
   left: 100px;
   top: 15px;
   z-index: 15;
   transition: .4s;
}

.toggle_menu #formcreator-toggle-nav-desktop ~ .formcreator-nav-button {
   left: 50px;
}

#formcreator-toggle-nav-desktop,
#formcreator-toggle-nav-responsive,
#formcreator-toggle-nav-responsive ~ .formcreator-nav-button {
   display: none;
}

#c_menu li label {
   display: inline-block;
}
.toggle_menu #c_menu li span.label {
   display: none;
}
.toggle_menu .plugin_formcreator_leftHeader#header .plugin_formcreator_leftMenu {
   width: 53px;
}
.toggle_menu #c_menu .plugin_formcreator_selectedMenuItem:after {
   border: 0;
   top: 50%;
   left: initial;
   right: 0;
   width: 6px;
   background-color: rgba(0, 0, 0, .3);
   height: 48px;
}
.toggle_menu #page.plugin_formcreator_page {
   width: calc(100% - 53px);
   margin-left: 53px;
}

.tab_cadre_pager, .navigationheader {
   margin-top: 0;
   padding-top: 15px;
}

.section_row,
.section_row th {
   background-color: #CCC;
}

.form_header {
   ul {
      list-style-type: disc;
      margin: inherit;
      padding: inherit;
      padding-left: 40px;
   }
}

.form_section {
   ul {
      list-style-type: disc;
      margin: inherit;
      padding: inherit;
      padding-left: 40px;
   }
}

.form_header ul ul,
.form_header ol ul,
.form_section ul ul,
.form_section ol ul {
   list-style-type: circle;
}


/* Active / inactive light for forms */
.plugin-formcreator-active {
   cursor: pointer;
   color: #009933 !important;
}

.plugin-formcreator-inactive {
   cursor: pointer;
   color: #a0a0a0;
}

.plugin_formcreator_cancel_my_ticket {
   background: #fec95c;
}

/* Count of conditions in design view */
.plugin_formcreator_conditions_count {
   border-radius: 50%;
   background-color: var(--contrast-dark);
   color: var(--contrast-light);
   min-width: 18px;
   height: 18px;
   text-align: center;
   vertical-align: middle;
   padding: 4px;
   margin-right: 5px;
}

// Spinner in service catalog
.status .status_number .fas.fa-spinner {
   color: #fff;
}

/* ################--------------- Responsive  ---------------#################### */
@media screen and (max-width: 700px) {

   form#plugin_formcreator_form {
       width: 100%;
   }

   #plugin_formcreator_form .form-group > label,
   #plugin_formcreator_form .form-group .form_field,
   #plugin_formcreator_form .form-group .form_field > input,
   #plugin_formcreator_form textarea,
   #plugin_formcreator_form select {
      width: 100%;
   }
   #plugin_formcreator_form .form-group .form_field input.hasDatepicker  {
      width: 88%;
   }

   #plugin_formcreator_form .select2-container .select2-choice,
   #plugin_formcreator_form .select2-container-multi .select2-choices {
      width: 96%;
   }

   #plugin_formcreator_lastForms {
      position: static;
      width: 100%;
   }

   #searchcriterias .tab_cadre_fixe td {
      padding: 5px 0;
   }

   #plugin_formcreator_wizard_categories, #plugin_formcreator_kb_categories {
      height: inherit;
      width: 100%;
      position: initial;
      float: none;
      min-height: initial;

      .slinky-menu {
         position: static;
      }
   }

   #plugin_formcreator_wizard_right {
      width: 94%;
      height: inherit;
      overflow: inherit;
      margin: 0;
   }
}

.restricted-form {
   span {
      max-width: 400px;
   }
}

/* remove this CSS when requirement is GLPI 10.0.1 or later */
/* https://github.com/glpi-project/glpi/pull/11524 */
.formcreator_dashboard_container .dashboard .big-number .label {
   font-size: 12px !important;
}

.plugin_formcreator_sort .fa {
   padding-left: 5px;
   color: #717171;
}

.category-divider {
   height: 0;
   margin-bottom: 0.5rem;
   overflow: hidden;
   border-top: 1px solid rgba(98, 105, 118, 0.16);
}

a.category_active span {
   font-weight: bold;
}
