/**
 * The MIT License (MIT)
 *
 * Copyright (c) 2022-2024 Camptocamp SA
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

/**
 * Styles shared between the different apps (mobile and desktop).
 */
@import 'gmf/sass/vars_only.scss';

html,
body {
  height: 100%;
}

body {
  overflow: hidden;
}

footer {
  position: relative;
  z-index: $above-content-index;
}

a {
  text-decoration: none;
}

.pull-right {
  float: right;
}

.btn.prime {
  background-color: $brand-primary;
  background-color: var(--brand-primary);
  border-color: $input-border-focus;
  border-color: var(--input-border-focus);
  &.active {
    box-shadow: inset $light-box-shadow $light-box-shadow-color;
    box-shadow: inset $light-box-shadow var(--light-box-shadow-color);
  }
  color: white;
  &:hover,
  &.active {
    background-color: $input-border-focus;
    background-color: var(--input-border-focus);
    border-color: $input-border-focus-darken;
    border-color: var(--input-border-focus-darken);
  }
}

.btn.btn-default {
  background-color: $map-tools-bg-color;
  background-color: var(--map-tools-bg-color);
  border-color: $onhover-color;
  border-color: var(--onhover-color);
  color: $map-tools-color;
  color: var(--map-tools-color);
  &.active {
    box-shadow: inset $light-box-shadow $light-box-shadow-color;
    box-shadow: inset $light-box-shadow var(--light-box-shadow-color);
  }
  &:hover,
  &.active {
    background-color: $onhover-color;
    background-color: var(--onhover-color);
    border-color: $onhover-color-darken;
    border-color: var(--onhover-color-darken);
  }
}

html [type='button'] {
  -webkit-appearance: none;
}

/**
 * The blur filter is used to avoid the loading icon to shake on firefox.
 * See: https://github.com/FortAwesome/Font-Awesome/issues/671
 */
.fa-refresh {
  filter: blur(0);
}

.list-group-sm .list-group-item {
  padding: $padding-small-vertical $padding-small-horizontal;
}

.input-sm,
select.input-sm {
  height: inherit;
  line-height: inherit;
}

i,
cite,
em,
var,
address,
dfn {
  font-style: italic;
}

.small {
  font-size: 90%;
}

.col-form-label {
  font-weight: normal;
}

.modal-content {
  border-radius: 0;
}

.modal-body,
.modal-header {
  padding: 0.62rem;
}

.modal-title {
  font-weight: bold;
  font-size: inherit;
}

.ui-draggable-handle {
  cursor: grab;
  cursor: -webkit-grab;
  cursor: -moz-grab;
}

.ui-draggable-dragging {
  .ui-draggable-handle {
    cursor: move;
  }

  iframe {
    display: none;
  }
}

// Fix GSGMF-1719: resizable buttons not centered
.gmf-app-data-panel.ui-resizable,
.gmf-app-tools-content.ui-resizable {
  height: 100% !important;
}

.ui-resizable {
  &.ui-resizable-resizing {
    iframe {
      display: none;
    }
  }
}

// default z-index is 90 but it is not configurable.
// See https://api.jqueryui.com/resizable/
.ui-resizable-handle {
  z-index: 2 !important;
}

.list-group > .list-group-item {
  text-align: left;
  padding: 0.25rem 0.5rem;
}

// Spinner for loading app
.custom-spinner-loading {
  fill: red;
  font-size: 3rem;
}

// Spinner for generic purpose
.custom-spinner-generic {
  fill: black;
}

// Spinner for KML import panel
.custom-spinner-importkml {
  fill: black;
  font-size: 2rem;
  margin: 20px 45%;
}

// Avoid dropdown menus expanding out of viewport.
.dropdown-menu {
  max-height: 50vh;
  overflow-y: auto;
}

/** Make some Bootstrap values configurable */
body {
  a,
  .btn-link {
    color: var(--link-color);
  }

  a:hover,
  .btn-link:hover {
    color: var(--link-hover-color);
  }

  .btn,
  .form-control {
    &:focus,
    &.focus {
      box-shadow: 0 0 0 $input-btn-focus-width var(--input-btn-focus-color);
      border-color: var(--brand-primary);
    }
  }

  .modal-header {
    border-color: var(--link-color);
  }
  .table tr {
    td,
    th {
      border-color: var(--table-border-color);
    }
  }

  .nav-pills {
    .nav-link.active,
    .show > .nav-link {
      background-color: var(--brand-primary);
    }
  }
}
