$jicon-css-prefix: icon;
$fa-css-prefix: fa;
$fa-font-path: "../../../media/vendor/fontawesome-free/webfonts";

// Font Awesome
@import "../../../media/templates/administrator/atum/scss/vendor/fontawesome-free/fontawesome";

// "Font Awesome 6 Free"
@import "../../../media/vendor/fontawesome-free/scss/fontawesome";
@import "../../../media/vendor/fontawesome-free/scss/regular";
@import "../../../media/vendor/fontawesome-free/scss/solid";
@import "../../../media/vendor/fontawesome-free/scss/brands"; // order of loading is important.

// B/C with Font Awesome 5
@import "../../../media/vendor/fontawesome-free/scss/shims";

// B/C for Icomoon
@import "../../../build/media_source/system/scss/icomoon";

// Bootstrap
@import "../../../media/vendor/bootstrap/scss/functions";

// Variables from the Atum template
@import "../../../build/media_source/templates/administrator/atum/scss/variables";
@import "../../../build/media_source/templates/administrator/atum/scss/variables-dark";

$table-bg: transparent;

@import "../../../media/vendor/bootstrap/scss/variables";
@import "../../../media/vendor/bootstrap/scss/variables-dark";
@import "../../../media/vendor/bootstrap/scss/maps";
@import "../../../media/vendor/bootstrap/scss/mixins";
@import "../../../media/vendor/bootstrap/scss/utilities";
@import "../../../media/vendor/bootstrap/scss/bootstrap";

// Backend Template stuff
@import "../../../media/templates/administrator/atum/scss/blocks/global";
@import "../../../media/templates/administrator/atum/scss/blocks/header";
@import "../../../media/templates/administrator/atum/scss/vendor/bootstrap/custom-forms";
@import "../../../media/templates/administrator/atum/scss/vendor/joomla-custom-elements/joomla-alert";

// Safari fix
@import "../../../media/templates/administrator/atum/scss/vendor/bootstrap/reboot";

// Custom Atum colors
:root {
  @each $color, $value in $atum-colors {
    --#{$prefix}#{$color}: #{$value};
  }
}

@if $enable-dark-mode {
  @include color-mode(dark, true) {
    @each $color, $value in $atum-colors-dark {
      --#{$prefix}#{$color}: #{$value};
    }
  }
}

@if $enable-dark-mode {
  @include color-mode(dark, true) {
    @each $color, $value in $atum-colors-dark {
      --#{$prefix}#{$color}: #{$value};
    }
  }
}

.border-primary {
  border-color: var(--primary) !important;
}

.border-secondary {
  border-color: var(--secondary) !important;
}

.border-success {
  border-color: var(--success) !important;
}

.border-info {
  border-color: var(--info) !important;
}

.border-warning {
  border-color: var(--warning) !important;
}

.border-danger {
  border-color: var(--danger) !important;
}

.border-light {
  border-color: var(--light) !important;
}

.border-dark {
  border-color: var(--dark) !important;
}

.border-white {
  border-color: var(--white) !important;
}

.text-primary {
  color: var(--primary) !important;
}

.text-secondary {
  color: var(--secondary) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-info {
  color: var(--info) !important;
}

.text-warning {
  color: var(--warning) !important;
}

.text-danger {
  color: var(--danger) !important;
}

.text-light {
  color: var(--light) !important;
}

.text-dark {
  color: var(--dark) !important;
}

.text-black {
  color: var(--black) !important;
}

.text-white {
  color: var(--white) !important;
}

.text-body {
  color: var(--body-color) !important;
}

.bg-primary {
  background-color: var(--primary) !important;
}

.bg-secondary {
  background-color: var(--secondary) !important;
}

.bg-success {
  background-color: var(--success) !important;
}

.bg-info {
  background-color: var(--info) !important;
}

.bg-warning {
  background-color: var(--warning) !important;
}

.bg-danger {
  background-color: var(--danger) !important;
}

.bg-light {
  background-color: var(--light) !important;
}

.bg-dark {
  background-color: var(--dark) !important;
}

.bg-black {
  background-color: var(--black) !important;
}

.bg-white {
  background-color: var(--white) !important;
}

.bg-body {
  background-color: var(--body-bg) !important;
}

*,
*::after,
*::before {
  box-sizing: border-box;
}

body {
  background: var(--body-bg);
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    body {
      background: var(--main-bg);
    }
  }
}

.header {
  .h2 {
    margin-bottom: 0;
  }
}

.j-install {
  display: flex;
  flex-direction: column;
  min-height: 100vh;

  .logo {
    max-width: 270px;
  }

  img.logo-small,
  svg.logo-small {
    width: 2rem;
    height: 2rem;
  }

  .icon-question {
    color: $white;

    &:hover {
      color: var(--#{$prefix}link-color);
    }
  }
}

.j-container {
  width: 100%;
  max-width: 40rem;
  margin: 1rem auto;

  h1 {
    color: $dark-blue;
    text-align: center;
  }
}

.j-install-step {
  display: none;
  margin-bottom: 20px;
  background-color: #fff;
  box-shadow: 0 0 2px rgba(52, 58, 67, .1), 0 2px 5px rgba(52, 58, 67, .08), 0 5px 15px rgba(52, 58, 67, .08);

  &.active {
    display: block;
  }

  select {
    width: 100%;
    margin-inline-start: 0 !important;
  }
}

.j-install-step-header {
  position: relative;
  padding: 10px 25px;
  font-size: 1.1rem;
  line-height: 2.4rem;
  color: $dark-blue;
  background-color: #fff;
  border-bottom: 1px solid #efefef;

  span {
    position: relative;
    margin-inline-end: 5px;
    font-size: 1.2rem;
  }
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    .j-install-step {
      background-color: var(--secondary-bg);
    }

    // For now in dark mode we swap the color and the background around. But this probably is too much
    // emphasis than we require for the header
    .j-install-step-header {
      color: #fff;
      background-color: var(--secondary-bg);
    }
  }
}

.j-install-step-form {
  padding: .65rem 1.2rem;

  // Remove default bootstrap margins in the installer forms.
  .control-group {
    margin-bottom: 0;

    .control-label {
      padding: 0;
    }
  }
}

.languageForm {
  padding: 0 0 30px;

  .form-select {
    width: 100%;
  }
}

// Alerts
#system-message-container joomla-alert {
  margin-top: 25px;
}

.alert-heading {
  font-size: $h4-font-size;
}

.hidden,
[hidden="hidden"] {
  display: none;
}

.btn-primary {
  color: var(--btn-primary-color);
  background-color: var(--btn-primary-bg);
  border: var(--btn-primary-border);

  &:hover, &:focus, &:active {
    background-color: var(--btn-primary-bg-hvr);
    border: var(--btn-primary-border-hvr);
  }

}

.btn-success {
  color: #fff;
  background-color: #75b544;
  border-color: #75b544;
}

// Form

.form-control {
  &.input-full {
    max-width: 100%;
  }
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    .form-control {
      background-color: var(--form-control-bg);
    }
  }
}


label {
  margin-bottom: .5rem;
}

.control-group {
  margin-bottom: 18px;

  &::after {
    display: table;
    clear: both;
    content: "";
  }

  .control-label {
    padding-top: 5px;
    padding-inline-end: 5px;
    text-align: start;
  }
}

.spacer hr {
  width: 380px;
}

.card .form-select {
  width: 100%;
}

td .form-control {
  display: inline-block;
  width: auto;
}

legend {
  margin-bottom: 1.1rem;
}

.checkboxes {
  padding-top: 5px;

  .checkbox input {
    position: static;
    margin-inline-start: 0;
  }

}

.form-check {
  padding-top: 5px;
  margin-bottom: 0;
}

/* rtl:begin:ignore */
#jform_db_prefix {
  text-align: start;
  direction: ltr;
}
/* rtl:end:ignore */

// Possibly temporary until Bootstrap support it themselves
.form-select[multiple] {
  height: auto;
  background: none;
}

// Block display for the validation message
.form-control-feedback {
  display: block;
  color: $red;
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    .form-control-feedback {
      color: #d55;
    }
  }
}

// Language Table
caption {
  padding: 0;
  margin: 0 1rem 0 0;
  caption-side: top;
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    caption {
      color: #fff;
    }
  }
}

.bg-warning {
  color: #000;
}

// footer
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: $zindex-header;
  background-color: $white;
  box-shadow: 0 0 1px 1px rgba(0, 0, 0, .25);
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    .footer {
      background: var(--header-bg);
      box-shadow: none;
      a {
        color: var(--table-link-color);
      }
    }
  }
}

.table > :not(:last-child) > :last-child > * {
  border-bottom-color: $table-border-color;
}

// Installation progress
.progresslabel {width: 100%;}

progress {
  display: block;
  width: 100%;
  height: 25px;
  margin: 1rem auto;
  background: linear-gradient(#ccc 0%, #eee 50%, #eee 50%, #ccc 100%);
  border: 0 none;
  border-radius: 4px;
}

/* error page */
.j-header {
  display: flex;
  flex-direction: row;
  color: #fff;
  background-color: #0b3257;
}

.j-header-logo {
  width: 100%;
  max-width: 240px;
  margin: 20px;
}

.j-header-help {
  margin: 20px 20px 20px auto;
  a {
    padding: 1rem;
    font-size: 2rem;
    color: #fff;
  }
}

.j-footer {
  padding: 10px 20px;
  margin-top: auto;
  font-size: .8rem;
  color: #fff;
  text-align: right;
  background-color: #0b3257;
}

.alert {
  position: relative;
  display: flex;
  margin: 0 0 20px;
  background: #fafafa;
  border: 1px solid rgba(0,0,0,.1);
  box-shadow: 0 0 10px rgba(0,0,0,.05);
  p {
    margin-bottom: 0;
  }
}

.alert-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25%;
  margin-bottom: 0;
  font-size: 3rem;
  opacity: .6;
  .fa {
    width: 100%;
    text-align: center;
  }
}

.alert-text {
  padding: 10px 20px;
}

.j-installation-error {
  background-color: #1c3d5c;
  background-image: linear-gradient(90deg, #1c3d5c 0%, #2a5c8b 100%);
}
