/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

@import "../../../section-style";
@import "../../../dashboard.component.scss";

.computing-unit-list-item-card {
  padding: 3px;
  width: 100%;
  background-color: white;
  position: relative;
  min-height: 65px;
  height: auto;

  &:hover {
    background-color: #f0f0f0;

    .edit-button {
      display: flex;
    }

    &.resource-info {
      opacity: 0.3;
    }
  }
}

.computing-unit-list-item-card:hover .button-group {
  display: flex;
  background-color: transparent;
}

.edit-button {
  display: none;

  &:hover {
    display: block;
    background-color: #d9d9d9;
  }

  button {
    height: 25px;
  }
}

.type-icon {
  font-size: 30px;
}

.unit-id {
  padding: 6px;
}

.resource-name-group {
  min-width: 0;
}

.resource-name {
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.resource-name:hover {
  text-decoration: underline;
}

.resource-info {
  font-size: 13px;
  color: grey;
}

.truncate-single-line {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.unit-name-edit-input {
  width: 100%;
  max-width: 200px;
  font-size: inherit;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  padding: 2px 6px;
  background: white;
}

.resource-metrics {
  width: 250px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(1, 1fr);
  justify-content: start;
  align-items: center;
  gap: 5px;
}

.general-metric {
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: #f9fafb;
  border-radius: 3px;
  padding: 10px;
  gap: 3px;
}

.metrics-container {
  margin-right: 20px;
}

.metric-unit {
  color: #888;
  font-size: 0.9em;
  margin-left: 4px;
}

.metric-percentage {
  color: #555;
  font-size: 0.9em;
  margin-left: 6px;
  font-weight: 500;
}

.metric-name {
  font-size: 10px;
  margin: 0;
}

.metric-value {
  margin: 0;
}

.metric-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  width: 120px;
  min-width: 120px;
  padding: 0;
  border: none;
  flex-shrink: 0; /* Prevent shrinking */
}

.metric-label {
  font-size: 10px;
  width: 45px;
  flex-shrink: 0;
  line-height: 1;
  text-align: center;
}

.metric-bar-wrapper {
  flex-grow: 1;
  width: 90px;
  min-width: 60px;
  display: flex;
  align-items: center;
  padding: 0;
  height: 8px;
}

.cpu-progress-bar,
.memory-progress-bar {
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: middle;
}

.button-group {
  display: none;
  position: absolute;
  height: 70px;
  min-width: 150px;
  right: 0;
  bottom: 0;
  justify-content: right;
  align-items: center;
  transition: none;
  z-index: 10;

  button {
    margin-right: 32px;
    transition: none;
    background-color: #e0e0e0;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
  }

  button:hover {
    background-color: #c7c7c7;
  }
}

:host ::ng-deep .ant-progress {
  width: 100%;
}

:host ::ng-deep .ant-progress-inner {
  width: 100% !important;
  background-color: #cacaca !important;
}

:host ::ng-deep .ant-badge-status-dot {
  position: relative;
  top: -1px;
  vertical-align: middle;
}
