@import '~src/styles/theme';

::ng-deep {
  .monitor-select-menu-modal {
    .ant-modal-body {
      padding: 0;
      max-height: 70vh;
      overflow: hidden;
    }

    .-inner-content {
      height: 70vh;
      max-height: 70vh;
    }

    .ant-spin-container {
      max-height: 70vh;
      overflow: hidden;
    }

    app-monitor-select-menu {
      height: 100%;
    }
  }
}

.export-type-container {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
}

.export-type-card {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 24px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.export-type-card:hover {
  border-color: @primary-color;
  box-shadow: 0 0 8px rgba(24, 144, 255, 0.2);
}

.export-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-right: 16px;
  font-size: 24px;
  color: @primary-color;
  background: rgba(24, 144, 255, 0.1);
  border-radius: 8px;
}

.export-type-info {
  flex: 1;
}

.export-type-info h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 500;
}

.export-type-info p {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.export-type-card.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.monitor-card-list {
  width: 100%;
  position: relative;
}

.monitor-selected-count {
  color: rgba(0, 0, 0, 0.45);
  font-size: 12px;
}

.monitor-list-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding: 8px 0;
  flex-wrap: wrap;
  gap: 8px;
}

.monitor-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  // Align the select-all checkbox with the per-row checkboxes, which sit at the card's 12px padding.
  padding-left: 12px;
}

.monitor-card-list-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.monitor-card {
  display: flex;
  width: 100%;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 12px;
  transition: all 0.3s;
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.monitor-card:hover {
  border-color: @primary-color;
  box-shadow: 0 1px 8px rgba(24, 144, 255, 0.2);
  transform: translateY(-2px);
}

.monitor-card-checkbox {
  padding-right: 16px;
  display: flex;
  align-items: center;
}

.monitor-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.monitor-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.monitor-card-title {
  font-size: 16px;
  font-weight: 500;
}

.monitor-card-title button {
  padding: 0;
  height: auto;
  font-size: 16px;
  font-weight: 500;
  color: @primary-color;
}

.monitor-card-info {
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 8px;
}

.monitor-card-info-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.host-item {
  display: flex;
  justify-content: space-between;
  align-items: center;

  button {
    padding: 0;
    height: auto;

    i {
      margin-right: 4px;
    }
  }

  .action-button {
    height: 32px;
    padding: 0 8px;
    min-width: 32px;
    margin-left: auto;
  }
}

.meta-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.label-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  max-width: 60%;
}

.time-ago {
  margin-left: auto;
  color: #999;
  font-size: 12px;
  white-space: nowrap;

  i {
    margin-right: 4px;
  }
}

.info-label {
  display: none;
}

.monitor-card-status {
  margin-left: auto;

  .ant-tag {
    margin-right: 0;
  }
}

.label-item {
  display: none;
}

.danger-text {
  color: #ff4d4f;
}

@media (max-width: 768px) {
  .meta-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .time-ago {
    margin-left: 0;
    margin-top: 8px;
  }

  .label-tags {
    max-width: 100%;
  }
}

[data-theme='dark'] {
  :host {
    .monitor-card {
      background-color: @common-background-color-dark;
      border-color: #303030;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);

      &:hover {
        border-color: @primary-color;
        box-shadow: 0 1px 8px rgba(24, 144, 255, 0.3);
      }
    }

    .monitor-card-title button {
      color: @primary-color;
    }

    .time-ago {
      color: #a0a0a0;
    }

    .host-item button[nzType='text'] {
      color: #d9d9d9;

      &:hover {
        color: @primary-color;
      }
    }

    .action-button {
      background-color: #303030;
      border-color: #434343;

      &:hover {
        background-color: #1f1f1f;
        border-color: @primary-color;
      }
    }

    .label-tags .ant-tag {
      background-color: #303030;
    }

    .export-type-card {
      background-color: @common-background-color-dark;
      border-color: #303030;

      &:hover {
        border-color: @primary-color;
        box-shadow: 0 0 8px rgba(24, 144, 255, 0.3);
      }

      &.loading {
        opacity: 0.5;
        background-color: #1f1f1f;
      }
    }

    .export-type-icon {
      color: @primary-color;
      background: rgba(24, 144, 255, 0.2);
    }

    .export-type-info {
      h3 {
        color: #d9d9d9;
      }

      p {
        color: #a0a0a0;
      }
    }
  }
}


.monitor-unavailable {
  opacity: 0.6;
  transition: opacity 0.3s ease;
  
  .monitor-card-content {
    filter: grayscale(50%);
  }
}

.monitor-disappeared {
  opacity: 0.7;
  background-color: #f5f5f5;
  border: 1px dashed #d9d9d9;
  transition: all 0.3s ease;
}

.status-faded {
  opacity: 0.5;
}

.monitor-card.monitor-unavailable {
  .action-button[disabled] {
    opacity: 0.3;
    cursor: not-allowed;
  }
  
  button[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
  }
}
