@use "../base/mixins";

@use "../base/colors" as color;
@use "../base/variables" as var;

.formeo-controls {
  width: 26%;
  overflow: hidden;

  &.formeo-sticky {
    position: sticky;
    top: 0;
    align-self: flex-start;
  }

  &.pull-left {
    .form-actions {
      float: left;
    }
  }

  .filtered-term {
    background-color: color.$white;
    text-align: center;
    border-radius: var.$input-border-radius var.$input-border-radius 0 0;
    border: 1px solid color.$gray-lighter;
    border-bottom: 0 none;
    width: calc(100% - 2px);
  }

  .tabbed-panels {
    nav {
      padding: 0;
    }
  }

  nav {
    position: relative;
    padding: 0 var.$action-btn-width;
    overflow: hidden;

    h5 {
      font-size: 13px;
      line-height: 22px;
    }

    button {
      position: absolute;
      width: var.$action-btn-width;
      color: color.$black;
      height: calc(100% + 1px);
      padding: 0;
      line-height: 0;
      margin: 0;
      border-color: color.$gray-lighter;

      &.next-group {
        right: 0;
        top: 0;
        border-top-left-radius: 0;
        border-top-right-radius: var.$border-radius;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
      }

      &.prev-group {
        border-top-left-radius: var.$border-radius;
        border-bottom-left-radius: 0;
        left: 0;
      }
    }
  }

  .formeo-panels-wrap {
    font-size: 0.85em;
    line-height: 1.8em;
  }

  .panel-labels {
    border-top: 1px solid color.$gray-lighter;

    // border-radius: $border-radius;
  }

  .panel-count-1 {
    border-bottom-left-radius: 0;

    .panel-nav {
      display: none;
    }

    .control-group {
      li:first-child {
        border-radius: var.$border-radius var.$border-radius 0 0;
      }
    }
  }

  ul {
    @include mixins.no-list-style;
  }

  .control-group {
    vertical-align: top;
    display: inline-block;
    width: 100%;
    border-top: 1px solid color.$gray-lighter;

    > li {
      &:first-child {
        border-top-right-radius: 0;
      }

      &:last-child {
        border-radius: 0 0 var.$border-radius var.$border-radius;
      }
    }
  }

  &.filtered {
    .panel-nav {
      display: none;
    }

    .control-group {
      display: block;

      > li {
        border-radius: 0;
      }

      &:last-child {
        > li {
          &:last-child {
            border-radius: 0 0 0 var.$input-border-radius;
          }
        }
      }
    }
  }

  .control-groups {
    white-space: nowrap;
  }

  .control-group-labels {
    height: 100%;
    background: color.$white;
    overflow: hidden;

    div {
      white-space: nowrap;
    }

    h4 {
      display: inline-block;
      width: 100%;
    }
  }

  .form-actions {
    float: right;
    margin-top: mixins.space();

    .svg-icon {
      fill: color.$gray;
      display: none;

      &:hover {
        fill: color.$black;
      }
    }

    .save-form,
    .clear-form {
      &:hover {
        color: color.$white;
      }
    }

    .save-form {
      &:hover {
        background-color: color.$brand-primary;
      }
    }

    .clear-form {
      &:hover {
        background-color: color.$brand-error;
      }
    }
  }

  @include mixins.breakpoint("phone-lrg") {
    width: 45px;

    .control-group {
      text-indent: -9999px;
    }

    .form-actions {
      display: inline-block;
      width: 100%;
      position: relative;
      vertical-align: middle;
      float: none;
      margin-top: 10px;

      > button + button {
        margin-top: -(var.$input-btn-border-width);
        margin-left: 0;
      }

      > button {
        max-width: 100%;
        padding: 10px;
        border-radius: 0;
        line-height: 0;
        width: 100%;
        float: none;
        position: relative;
        display: block;

        &:not(:first-child):not(:last-child) {
          border-radius: 0;
        }

        &:first-child:not(:last-child) {
          border-top-right-radius: var.$input-border-radius;
          border-top-left-radius: var.$input-border-radius;
          border-bottom-right-radius: 0;
          border-bottom-left-radius: 0;
        }

        &:last-child:not(:first-child) {
          border-bottom-left-radius: var.$input-border-radius;
          border-bottom-right-radius: var.$input-border-radius;
          border-top-right-radius: 0;
          border-top-left-radius: 0;
        }
      }

      .control-icon {
        display: inline-block;
        margin-right: 10px;
      }
    }
  }

  .field-control {
    @include mixins.field-control;

    .control-icon {
      pointer-events: none;

      .f-i-hash {
        padding: calc(var.$half-space/2);
      }
    }
  }
}
