$primary-color: var(--brandnestor-primary-color);
$font-disabled-color: var(--brandnestor-grey-color);
$font-color: var(--brandnestor-dark-grey-color);
$border-color: var(--brandnestor-grey-color);

@import 'node_modules/slim-select/src/slim-select/slimselect.scss';

:root {
  --brandnestor-light-color: #efefef;
  --brandnestor-light-grey-color: #f5f7f9;
  --brandnestor-grey-color: #c2c2c2;
  --brandnestor-dark-grey-color: #424242;
  --brandnestor-primary-color: #ec8924;
  --brandnestor-secondary-color: #2488ec;
  --brandnestor-danger-color: #ec2424;
  --brandnestor-role-color: #ffe3a3;
  --brandnestor-user-color: #c1c5ff;
  --brandnestor-border-radius: 10px;
}

.brandnestor-depth-1 {
  box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),
              0 3px 1px -2px rgba(0,0,0,0.12),
              0 1px 5px 0 rgba(0,0,0,0.2);
}
.brandnestor-depth-1-half {
  box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.14), 0 1px 7px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -1px rgba(0, 0, 0, 0.2);
}

.brandnestor-depth-2 {
  box-shadow: 0 4px 5px 0 rgba(0,0,0,0.14),
              0 1px 10px 0 rgba(0,0,0,0.12),
              0 2px 4px -1px rgba(0,0,0,0.3);
}

.brandnestor-depth-3 {
  box-shadow: 0 8px 17px 2px rgba(0,0,0,0.14),
              0 3px 14px 2px rgba(0,0,0,0.12),
              0 5px 5px -3px rgba(0, 0, 0, 0.2);
}

.brandnestor-depth-4 {
  box-shadow: 0 16px 24px 2px rgba(0,0,0,0.14),
              0 6px 30px 5px rgba(0,0,0,0.12),
              0 8px 10px -7px rgba(0,0,0,0.2);
}

.brandnestor-depth-5 {
  box-shadow: 0 24px 38px 3px rgba(0,0,0,0.14),
              0 9px 46px 8px rgba(0,0,0,0.12),
              0 11px 15px -7px rgba(0,0,0,0.2);
}

#brandnestor_logo {
  text-align: center;
  height: 150px;
}

#wpwrap {
  background: #f5f7f9;
}

.wrap {
  margin: 0 auto;
  padding: 6rem 10px;
  max-width: 1600px;
}

#settings_buttons {
  display: flex;

  a {
    display: block;
    margin-left: auto;
    text-decoration: none;
    text-transform: uppercase;
    font-weight: bold;
    padding: 5px 14px;
    color: var(--brandnestor-dark-grey-color);
    border: 2px solid var(--brandnestor-dark-grey-color);
    border-radius: 4px;

    &:hover {
      color: var(--brandnestor-light-color);
      background: var(--brandnestor-dark-grey-color);
    }
  }
}

#loading_indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,.75);
  z-index: 999;
}

.loading-spinner {
}

.loading-spinner,
.loading-spinner::after,
.loading-spinner::before {
  box-sizing: border-box;
  position: relative;
  display: block;
  width: 70px;
  height: 70px;
}

.loading-spinner::after,
.loading-spinner::before {
  content: "";
  position: absolute;
  border-radius: 100px;
}

.loading-spinner::before {
  animation: spinner 1s cubic-bezier(.6,0,.4,1) infinite;
  border: 8px solid transparent;
  border-top-color: currentColor;
}

.loading-spinner::after {
  border: 8px solid;
  opacity: .2;
}

@keyframes spinner {
  0% { transform: rotate(0deg) }
  to { transform: rotate(359deg) }
}

@keyframes fade-in-out {
  0% {
    opacity: 0;
  }

  10%, 90% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.brandnestor-btn {
  cursor: pointer;
  border: none;
  color: #fff;
  padding: 0 10px;
  min-height: 30px;
  white-space: nowrap;
  background-color: var(--brandnestor-secondary-color);
  transition: filter .3s ease-in-out, box-shadow .3s ease-in-out;

  @extend .brandnestor-depth-1;

  &:hover:not([disabled]) {
    filter: brightness(1.15);

    @extend .brandnestor-depth-2;
  }

  &:disabled {
    opacity: .65;
    cursor: not-allowed;
  }

  &.brandnestor-btn-primary {
    background-color: var(--brandnestor-primary-color);
  }

  &.brandnestor-btn-danger {
    background-color: var(--brandnestor-danger-color);
  }

  &.brandnestor-btn-neutral {
    background-color: var(--brandnestor-dark-grey-color);
  }
}

.brandnestor {
  display: flex;
  justify-content: center;

  @media (max-width: 960px) {
    flex-direction: column;
  }

  h3 {
    margin-top: 0;
  }

  a .dashicons {
    text-decoration: none
  }

  nav {
    display: flex;
    flex-flow: row wrap;
    height: min-content;
    background-color: #fff;

    @media (min-width: 960px) {
      flex-direction: column;
    }

    .tab-button {
      color: var(--brandnestor-dark-grey-color);
      background-color: transparent;
      padding: .9em 1.7em;
      font-size: 1.2em;
      font-weight: bold;
      text-align: center;
      text-decoration: none;
      box-sizing: border-box;
      white-space: nowrap;

      cursor: pointer;
      border: none;
      border-radius: 0;

      &:hover, &.active {
        color: var(--brandnestor-secondary-color);
        background-color: var(--brandnestor-light-color);
      }

      &:focus {
        box-shadow: none;
      }
    }

    @extend .brandnestor-depth-1;
  }

  .settings-section {
    position: relative;
    flex-grow: 1;
    background-color: #fff;
    padding: 2em 5em;

    @extend .brandnestor-depth-1;
  }

  #submit {
    font-size: 1.1em;
  }

  .tab-panel {
    display: none;

    .tab-panel-title {
      font-size: 1.3rem;
    }

    .tab-panel-description {
      font-size: 1rem;
    }
  }

  .form-group {
    margin: 10px 0;
    display: grid;
    align-items: center;
    grid-template-columns: 33% 1fr min-content;
    grid-template-rows: auto;
    grid-template-areas:
      "label input side"
      ". description description";

    label {
      font-size: 1.1em;
      font-weight: bold;
    }

    &:first-child() {
      grid-area: label;
    }

    .form-input {
      display: flex;
      flex-flow: row wrap;
      align-items: center;
      gap: 5px;
      grid-area: input;

      input[type="text"] {
        flex-grow: 1;
      }

      select {
        width: inherit;
        flex-grow: 1;
      }
    }

    .form-input-text {
      height: 30px;

      .prefix {
        font-weight: light;
        color: var(--brandnestor-dark-grey-color);
        background: var(--brandnestor-light-color);
        border-radius: 5px;
        padding: 0px 9px;
      }

      img {
        max-height: 100%;
        max-width: 100%;
      }

      input[type="text"] {
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;

        &:focus {
          box-shadow: none;
        }
      }

      transition: border .2s ease-in-out;
      border-bottom: 1px solid var(--brandnestor-grey-color);

      &:focus-within {
        box-shadow: none;
        border-bottom: 1px solid var(--brandnestor-primary-color);
      }
    }

    .button {
      margin-left: 1em;
      grid-area: side;
    }

    .description {
      grid-area: description;
    }
  }

  .form-group.collapse {
    grid-template-rows: min-content min-content;
    grid-template-areas:
      "label input side"
      "collapsable collapsable collapsable";

    ul {
      display: none;
      grid-area: collapsable;
      margin: 0 0 0 15px;
    }
  }

  .collapse-toggle > i::before {
    content: "\f347";
  }

  .collapse-toggle.open > i::before {
    content: "\f343";
  }

  .form-switch {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
    background-position: left center;
    background-repeat: no-repeat;
    width: 2em;
    border-radius: 2em;
    transition: background-position .15s ease-in-out;
    margin: 0;

    &:checked {
      background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
      background-color: #0d6efd;
      border-color: #0d6efd;
      background-position: right center;
    }

    &:checked::before {
      content: '';
    }
  }

  .form-ruleset > :nth-child(2) {
    display: none;
  }

  .form-ruleset-head {
    background-color: #d4d4d4;
    padding: 1em;
    margin-bottom: 0.8em;
    border-radius: var(--brandnestor-border-radius);
    @extend .brandnestor-depth-1;
  }

  .form-rule {
    background-color: #f5f5f5;
    padding: 1em;
    margin: 15px 0;
    border-radius: var(--brandnestor-border-radius);
    @extend .brandnestor-depth-2;
  }

  .form-rule-delete {
    display: flex;
    justify-content: right;
  }

  .form-rule-head {
    span.label {
      padding: 4px 8px;
      margin-right: 10px;
      background-color: white;
      border-radius: 4px;
      font-size: 1.1em;

      &.users {
        background-color: var(--brandnestor-user-color);
      }

      &.roles {
        background-color: var(--brandnestor-role-color);
      }
    }
  }

  .form-rule-body {
    margin: 2em 0;
  }

  .form-checkboxes {
    display: flex;
    flex-flow: row wrap;
    gap: 10px;

    label {
      flex-basis: 40%;
    }
  }

  .editable {
    padding: 5px;
    margin-right: 2px;
    white-space: nowrap;
    overflow: hidden;

    br {
      display: none;
    }

    * {
      display: inline;
      white-space: nowrap;
    }

    &:empty:before {
      font-weight: normal;
      color: var(--brandnestor-dark-grey-color);
      content: attr(data-placeholder);
    }

    &:hover {
      background-color: #fffddd;
      text-decoration: underline dotted;
    }

    &:focus {
      background-color: #fffddd;
      outline: 1px solid #000;
      border-radius: 2px;
      box-shadow: 8px 11px 26px -25px rgba(0,0,0,0.75) inset;
    }
  }
}

.brandnestor .notifications {
  position: fixed;
  top: 5%;
  z-index: 10;

  > * {
    @extend .brandnestor-depth-4;

    color: var(--brandnestor-light-color);
    background-color: var(--brandnestor-dark-grey-color);
    border-radius: 2px;
    font-size: 1.2em;
    font-weight: bold;
    margin: 1em 0;
    padding: 0.9rem 7rem;
    text-align: center;
    width: 20ch;

    &.error {
      background-color: var(--brandnestor-danger-color);
    }
  }
}

.brandnestor-modal {
  transition: opacity ease 500ms;

  display: none;
  opacity: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  overflow: hidden;
  overflow-y: auto;
  z-index: 999;
  background: rgba(0,0,0,0.5);

  &.modal-visible {
    display: grid;
    place-items: center;
    opacity: 1;
    height: auto;
    bottom: 0;
  }

  .modal-container {
    background: #fff;
    width: 100ch;
    border-radius: var(--brandnestor-border-radius);
    padding: 3em 2em;
  }

  .modal-title {
    padding: 0;
  }

  .modal-content {
    margin: 2em 0;
  }
}

#link_reset_plugin {
  margin: 1em 0;
  float: right;
}

/*
 * vim: ft=sass
 */
