// SPDX-FileCopyrightText: 2023 Icinga GmbH <https://icinga.com>
// SPDX-License-Identifier: GPL-3.0-or-later

// Style

@visual-width: 1.5em;
@max-view-width: 50em;

.migration-state-banner, .change-database-user-description {
  .rounded-corners();

  border: 1px solid @gray-light;
  color: @text-color;
}

.migrations {
  a {
    color: @icinga-blue;
  }

  .empty-state {
    margin: 0 auto;
  }

  .list-item {
    .visual.upgrade-failed, span.upgrade-failed, .errors-section > header > i {
      color: @state-critical;
    }

    span.version {
      color: @text-color;
    }
  }

.migration-form {
  input[type="submit"] {
    line-height: 1.5;

      &:disabled {
        color: @disabled-gray;
        cursor: not-allowed;
        background: none;
        border-color: fade(@disabled-gray, 75)
      }
    }
  }
}

// Layout

#layout.twocols:not(.wide-layout) .migration-form fieldset .control-label-group {
  text-align: right;
}

.migration-state-banner, .change-database-user-description {
  padding: 1em;
  text-align: center;

  &.change-database-user-description {
    max-width: 50em;
    padding: .5em;
  }
}

.pending-migrations-hint {
  text-align: center;

  > h2 {
    font-size: 2em;
  }
}

.migration-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.migrations {
  .migration-form fieldset {
    max-width: @max-view-width;
  }

  .migration-list-control {
    padding-bottom: 1em;

    > .item-list {
      max-width: @max-view-width;
    }
  }

  .item-list:not(.file-list) > .list-item {
    > .main {
      border-top: none;
    }

    footer {
      display: block;
    }
  }

  .list-item {
    align-items: baseline;

    .main {
      margin-left: 0;
    }

    header {
      align-items: baseline;
      justify-content: flex-start;

      input {
        margin-left: auto;
      }

      .title span.upgrade-failed {
        margin: .5em;
      }
    }

    .caption, .errors-section pre {
      margin-top: .25em;
      height: auto;
      -webkit-line-clamp: 3;
    }

    .errors-section {
      margin: 1em -.25em;
      border: 1px solid @state-critical;
      padding: .25em;
      .rounded-corners(.5em);

      .status-icon {
        margin-top: .3em;
        margin-left: -1.5em;
        margin-right: .25em;
      }

      .caption, header {
        margin-left: 1.8em;
      }
    }

    footer {
      width: 100%;
      padding-top: 0;

      > * {
        font-size: 1em;
      }

      .list-item:first-child .main {
        padding-top: 0;
      }

      a {
        margin-left: @visual-width;
      }
    }
  }
}

.item-list.file-list {
  .visual {
    width: @visual-width;
  }

  .main {
    margin-left: @visual-width;
  }

  .visual + .main {
    margin-left: 0;
  }
}
