/*
 * This file is part of the Meeds project (https://meeds.io/).
 *
 * Copyright (C) 2023 Meeds Association contact@meeds.io
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 * This program 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
@import "../variables.less";
@import "../mixins.less";

.v-application {
  @import './lib/vuetify-reset.less';
}
.VuetifyApp {
  @import './lib/vuetify.less';
  @import './lib/Chart.min.less';

  .v-card--flat {
    &, &.v-sheet:not(.v-sheet--outlined) {
      box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12);
    }
  }

  .v-application {
    background: transparent !important;

    .display-4 {
      font-family: inherit !important;
    }
    .display-3 {
      font-family: inherit !important;
    }
    .display-2 {
      font-family: inherit !important;
    }
    .display-1 {
      font-family: inherit !important;
    }
    .headline {
      font-family: inherit !important;
    }
    .title {
      font-family: inherit !important;
    }

    .v-card__text {
      box-sizing: border-box;
    }

    .container.fluid .layout .flex {
      box-sizing: border-box;
    }
  
    .grid-list-md {
      box-sizing: border-box;
    }

    .v-tooltip__content {
      z-index: @zindexTooltip !important;
    }

    .v-btn--icon {
      border: 0;
    }

    a {
      color: @primaryColor;
      text-decoration: none;
    }

    a.v-tab {
      color: @menuTextColor;
    }

    a.v-btn {
      color: @btnColor;
    }

    a.v-card {
      color: @textColor;
    }

    a.v-list-item {
      color: @textColor;
    }

    p {
      margin-bottom: 10px;
    }

    textarea {
      border: 1px solid @greyColor;
      max-width: 100%;
      padding: 3px 10px;
    }

    .border-box-sizing {
      box-sizing: border-box;
    }

    .v-divider--vertical {
      vertical-align: middle;
    }

    .v-select__selections {
      max-width: 80%;
    }

    .layout {
      max-width: 100%;
    }

    .v-messages {
      min-height: auto;
    }

    .v-divider {
      margin: 0;
      border-color: @borderColor;
    }

    .v-timeline::before {
      background: @borderColor;
      width: 1px;
    }

    .v-text-field {
      padding-top: 22px;

      input {
        min-height: auto;
      }
    }

    .v-text-field__details {
      display: contents;
    }
    .v-data-footer__select .v-select {
        padding: 0;
        input {
          padding: 0;
        }
    }
    .v-input.text-center input {
      text-align: center;
    }

    .uiPopup .popupHeader {
      margin-bottom: 22px;
    }

    label {
      margin-bottom: 0;
    }

    textarea {
      margin-bottom: 0;
    }

    code {
      padding: 0;
      max-width: 100%;
      white-space: normal;
    }

    .v-input {
      text-align: start;

      input {
        margin-bottom: 0;
        border: 0;
        box-shadow: none;
      }

      i {
        color: @greyColorLighten1;
        font-size: 16px;
      }
    }

    input::placeholder, textarea::placeholder {
      color: @greyColorLighten1 !important;
    }

    .paragraph {
      white-space: pre-line;
    }

    .v-dialog {
      transform: translate(0);
      max-width: 100vw !important;
      max-height: ~"var(--100vh, 100vh)";
      margin: 0;
    }

    .v-dialog.with-overflow {
      overflow-y: auto;
      overflow-x: hidden;
    }
    .v-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      height: ~"var(--100vh, 100vh)";
      width: 100vw;
      max-height: ~"var(--100vh, 100vh)";
      max-width: 100vw;
      overflow: hidden;

      &.flex .v-overlay__content {
        height: 100%;
        max-height: 100%;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        display: flex;
      }
    }

    // Apply Custom Branding
    .primary {
      background-color: @primaryColor !important;
      border-color: @primaryColor !important;
    }
    .primary--text {
      color: @primaryColor !important;
      caret-color: @primaryColor !important;
    }
    .secondary {
      background-color: @secondaryColor !important;
      border-color: @secondaryColor !important;
    }
    .tertiary--text {
      color: @tertiaryColor!important;
    }
    .accent {
      background-color: @primaryColor !important;
      border-color: @primaryColor !important;
    }
    .accent--text {
      color: @primaryColor !important;
      caret-color: @primaryColor !important;
    }
    .btn, .v-btn.btn {
      border: 1px solid @btnBorder;
      color: @btnColor;
      background-color: @btnBackgroundColor;
      background-image: @btnBackgroundImage;
      text-shadow: none;
      box-shadow: none;
      font-weight: normal;
      &:hover, &:focus {
        color: @btnColor !important;
      }
    }

    .v-btn.primary:not(.v-btn--text), .btn-primary:not(.v-btn--text) {
      font-family: @sansBoldFontFamily !important;

      &:not(.v-btn--outlined) {
        font-weight: bold !important;
        .buttonBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight, @btnPrimaryBorder, @btnPrimaryColor) !important;
      }

      &.v-btn--outlined {
        border: thin solid @primaryColor !important;
        font-weight: normal;
        .buttonBackground(@btnPrimaryColor, @btnPrimaryColor, @btnPrimaryBorder, @btnPrimaryBackground) !important;
      }

      &:hover {
        background-color: @btnPrimaryHoverBackgroundColor !important;
        background-position: @btnPrimaryHoverBackgroundPosition !important;
      }

      &.disabled, &[disabled] {
        background-color: @btnPrimaryDisableBackground !important;

        &:hover {
          background-color: @btnPrimaryDisableHoverBackground !important;
        }
      }
    }

    .uiAction .v-btn.primary.disabled:first-child,
    .uiAction .v-btn.primary[disabled]:first-child ,
    .v-btn.primary[disabled]:first-child,
    .v-btn.primary[disabled],
    .uiAction .btn.disabled:first-child,
    .uiAction .btn[disabled]:first-child,
    .uiAction .btn-primary.disabled:first-child,
    .uiAction .btn-primary[disabled]:first-child ,
    .btn-primary[disabled]:first-child,
    .btn-primary[disabled],
    .uiAction .btn.disabled:first-child,
    .uiAction .btn[disabled]:first-child {
      color: @btnPrimaryColor !important;
    }
    .primary--text {
      color: @primaryColor !important;
    }
    .primary:not([disabled]) {
      background-color: @primaryColor !important;
      color: #fff !important;
    }
    .primary--text {
      color: @primaryColor !important;
      caret-color: @primaryColor !important;
    }
    .v-tab--active {
      color: @secondaryColor !important;
    }
    .v-tabs-slider-wrapper {
      .v-tabs-slider.primary {
        background-color: @secondaryColor !important;
      }
      .v-tabs-slider {
        color: @secondaryColor !important;
      }
    }
    .row {
      padding: 0;
    }
    .v-text-field .v-input__prepend-inner {
      margin: auto;
    }
    .v-text-field--outlined fieldset {
      margin-left: 0;
      margin-right: 0;
    }
    .v-stepper {
      box-shadow: none;

      .v-stepper__step:not(.v-stepper__step--inactive) .v-stepper__step__step {
        background-color: @secondaryColor !important;
      }
    }
    .v-stepper--vertical {
      margin-left: -23px;
      margin-top: -23px;
    }
    .v-slide-group__next--disabled,
    .v-slide-group__prev--disabled {
      display: none !important;
    }

    /* Added to use different Text Color for buttons defined in Menus different from Application Body */
    .v-menu__content:not(.application-menu) .theme--light.v-list-item:not(.v-list-item--active):not(.v-list-item--disabled) {
      &, .v-list-item__title, .v-list-item__subtitle {
        color: @btnColor !important;
        font-size: @btnFontSize !important;
        font-weight: normal !important;
        font-style: normal !important;
      }
    }

    .warning {
      background: @warningBackground !important;
      border-color: @warningBorder !important;
      color: @warningText !important;

      i:before {
        color: @warningColor !important;
      }
    }
    .error {
      background: @errorBackground !important;
      border-color: @errorBorder !important;
      color: @errorText !important;

      i:before {
        color: @errorColor !important;
      }
    }
    .success {
      background: @successBackground !important;
      border-color: @successBorder !important;
      color: @successText !important;

      i:before {
        color: @successColor !important;
      }
    }
    .info {
      background: @infoBackground !important;
      border-color: @infoBorder !important;
      color: @infoText !important;

      i:before {
        color: @infoColor !important;
      }
    }
    .error--text {
      color: @errorColor !important;

      i:before {
        color: @errorColor !important;
      }
    }
    .warning--text {
      color: @warningColor !important;

      i:before {
        color: @warningColor !important;
      }
    }
    .success--text {
      color: @successColor !important;

      i:before {
        color: @successColor !important;
      }
    }
    .info--text {
      color: @infoColor !important;

      i:before {
        color: @infoColor !important;
      }
    }
    .autocompleteSelectedItem {
      background: @mentionBackground !important;
      color: @mentionColor !important;
      border: @mentionBorder !important;
    }
    .v-skeleton-loader {
      .v-skeleton-loader__avatar, .v-skeleton-loader__button, .v-skeleton-loader__chip, .v-skeleton-loader__divider, .v-skeleton-loader__heading, .v-skeleton-loader__image, .v-skeleton-loader__text {
        background: @skeletonColor;
      }
    }

    .btn-group {
      display: flex;
      position: relative;

      > .btn:first-child {
        border-radius: 4px 0 0 4px;
      }
      > .btn:last-child, > .dropdown-toggle {
        border-radius: 0 4px 4px 0;
        margin-left: 1px;
      }
      .dropdown-menu {
        position: absolute;
        top: 100%;
        display: none;
        padding: 0;
        margin: 0;
        width: 100%;
        min-width: auto;
        border: 0;
        margin-top: 1px;
      }
      .dropdown-button {
        width: 100%;
        box-sizing: border-box;
        padding-left: 0;
      }
      &.open .dropdown-menu {
        display: inline-block;
      }
    }
    .v-treeview-node__toggle {
      padding: 0;
    }

    .v-treeview.hide-disabled-selection .v-treeview-node__checkbox.v-icon--disabled {
      visibility: hidden;
    }

    .v-data-table table {
      table-layout: fixed;
    }

    .v-autocomplete.v-input--is-focused {
      box-shadow: ~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)";
      box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.11);
      outline: 0;
      border: Solid 1px @inputFocusBorder;

      &.required-field.invalid {
        border-color: #e9322d;
        box-shadow: 0 0 6px #f8b9b7;
      }
    }

    .v-input--switch.reverse {
      width: fit-content;
      width: -moz-fit-content;
      max-width: 100%;

      .v-input__slot {
        display: flex;
        flex-direction: row-reverse;

        label {
          margin-right: 16px;
        }
      }
    }
    .v-card--reveal {
      bottom: 0;
      opacity: 1 !important;
      position: absolute !important;
      width: 100%;
      z-index: 1;
    }
    .v-pagination__item {
      box-shadow: none;
      border: 1px solid @btnBorder;
      color: @btnColor !important;
      .v-icon, button {
        color: @btnColor !important;
      }
    }
    .v-pagination__item--active {
      box-shadow: none;
      border: 1px solid @btnBorder;
    }
    .v-pagination__navigation {
      box-shadow: none;
      border: 1px solid @btnBorder;
      color: @btnColor !important;
      .v-icon, button {
        color: @btnColor !important;
      }
    }
    .v-btn:not(.v-btn--round).v-size--small {
      margin-top: 0 !important;
    }

    .v-btn__content {
      height: 100%;
    }

    .file-selector .v-input__control {
      display: none;
    }
    .v-alert {
      .layout-drawer();
    }
  }
}

.v-application--wrap {
  min-height: auto !important;
  position: static;
}

.v-navigation-drawer {
  position: fixed !important;
  z-index: @zindexDrawer !important;
}

.drawer-parent {
  position: relative !important;
  z-index: @zindexDrawerParent !important;
}

@media (max-width : 959px) {
  .VuetifyApp .v-application {
    .uiPopup.v-dialog:not(.v-dialog--fullscreen) .v-card__text {
      max-height: ~"calc(var(--100vh, 100vh) - 235px)";
      overflow-y: auto;
      overflow-x: hidden;

      > .container {
        max-width: ~"calc(100% - 32px)";
      }
    }

    .v-dialog {
      overflow: visible;
      border-radius: 4px;
      transform: translate(0);
      max-width: 100vw !important;
      max-height: ~"var(--100vh, 100vh)";
      margin: 0;
    }

    .v-snack {
      z-index: @zindexSnackBar!important;
    }
  }
}

@media (min-width: @minTabletWidth) {
  .VuetifyApp .v-application .d-sm-grid {
    display: grid !important;
  }
}
@media (min-width: @minLargeTabletWidth) {
  .VuetifyApp .v-application .d-md-grid {
    display: grid !important;
  }
}
@media (min-width: @minDesktop) {
  .VuetifyApp .v-application .d-lg-grid {
    display: grid !important;
  }
}
@media (min-width: @minLargeDesktop) {
  .VuetifyApp .v-application .d-xl-grid {
    display: grid !important;
  }
}
